Add cairo interface.
This commit is contained in:
parent
a03eb9599f
commit
9bcc0ae88e
63 changed files with 1247 additions and 450 deletions
|
@ -10,38 +10,38 @@ FileLogger::~FileLogger()
|
|||
|
||||
void FileLogger::SetWorkDirectory(const std::string& workDir)
|
||||
{
|
||||
mWorkDirectory = workDir;
|
||||
mWorkDirectory = workDir;
|
||||
}
|
||||
|
||||
void FileLogger::SetFileName(const std::string& fileName)
|
||||
{
|
||||
mFileName = fileName;
|
||||
mFileName = fileName;
|
||||
}
|
||||
|
||||
void FileLogger::Open()
|
||||
{
|
||||
mFileStream.open(mWorkDirectory + "/" + mFileName);
|
||||
mFileStream.open(mWorkDirectory + "/" + mFileName);
|
||||
}
|
||||
|
||||
void FileLogger::Close()
|
||||
{
|
||||
mFileStream.close();
|
||||
mFileStream.close();
|
||||
}
|
||||
|
||||
void FileLogger::LogLine(const std::string& line)
|
||||
{
|
||||
mFileStream << line << std::endl;
|
||||
mFileStream << line << std::endl;
|
||||
}
|
||||
|
||||
void FileLogger::LogLine(const std::string& logType, const std::string& line, const std::string& fileName, const std::string& functionName, int lineNumber)
|
||||
{
|
||||
std::time_t t = std::time(nullptr);
|
||||
const std::string cleanedFileName = fileName.substr(fileName.find_last_of("/\\") + 1);
|
||||
std::tm time_buf = { 0 };
|
||||
std::time_t t = std::time(nullptr);
|
||||
const std::string cleanedFileName = fileName.substr(fileName.find_last_of("/\\") + 1);
|
||||
std::tm time_buf = { 0 };
|
||||
#ifdef WIN32
|
||||
gmtime_s(&time_buf, &t);
|
||||
gmtime_s(&time_buf, &t);
|
||||
#else
|
||||
gmtime_r(&t, &time_buf);
|
||||
gmtime_r(&t, &time_buf);
|
||||
#endif
|
||||
mFileStream << logType << "|" << std::put_time(&time_buf, "%T") << "|" << cleanedFileName << "::" << functionName << "::" << lineNumber << "|" << line << std::endl;
|
||||
mFileStream << logType << "|" << std::put_time(&time_buf, "%T") << "|" << cleanedFileName << "::" << functionName << "::" << lineNumber << "|" << line << std::endl;
|
||||
}
|
||||
|
|
|
@ -8,19 +8,17 @@
|
|||
|
||||
class FileLogger
|
||||
{
|
||||
std::string mWorkDirectory;
|
||||
std::string mWorkDirectory;
|
||||
std::string mFileName;
|
||||
std::ofstream mFileStream;
|
||||
|
||||
std::string mFileName;
|
||||
FileLogger()
|
||||
:mWorkDirectory(),
|
||||
mFileName("MT_Log.txt"),
|
||||
mFileStream()
|
||||
{
|
||||
|
||||
std::ofstream mFileStream;
|
||||
|
||||
FileLogger()
|
||||
:mWorkDirectory(),
|
||||
mFileName("MT_Log.txt"),
|
||||
mFileStream()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
|
@ -30,22 +28,22 @@ public:
|
|||
return instance;
|
||||
}
|
||||
|
||||
FileLogger(FileLogger const&) = delete;
|
||||
FileLogger(FileLogger const&) = delete;
|
||||
void operator=(FileLogger const&) = delete;
|
||||
|
||||
~FileLogger();
|
||||
~FileLogger();
|
||||
|
||||
void SetWorkDirectory(const std::string& workDir);
|
||||
void SetWorkDirectory(const std::string& workDir);
|
||||
|
||||
void SetFileName(const std::string& fileName);
|
||||
void SetFileName(const std::string& fileName);
|
||||
|
||||
void Open();
|
||||
void Open();
|
||||
|
||||
void Close();
|
||||
void Close();
|
||||
|
||||
void LogLine(const std::string& line);
|
||||
void LogLine(const std::string& line);
|
||||
|
||||
void LogLine(const std::string& logType, const std::string& line, const std::string& fileName = "", const std::string& functionName = "", int lineNumber=-1);
|
||||
void LogLine(const std::string& logType, const std::string& line, const std::string& fileName = "", const std::string& functionName = "", int lineNumber=-1);
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue