15 bool bOwnerReadFlag,
bool bOwnerWriteFlag,
bool bOwnerExecuteFlag,
16 bool bGroupReadFlag,
bool bGroupWriteFlag,
bool bGroupExecuteFlag,
17 bool bOtherReadFlag,
bool bOtherWriteFlag,
bool bOtherExecuteFlag
28 void setOwnerFlags(
bool bOwnerReadFlag,
bool bOwnerWriteFlag,
bool bOwnerExecuteFlag);
37 void setGroupFlags(
bool bGroupReadFlag,
bool bGroupWriteFlag,
bool bGroupExecuteFlag);
46 void setOtherFlags(
bool bOtherReadFlag,
bool bOtherWriteFlag,
bool bOtherExecuteFlag);
66 int argc,
char** argv,
67 const std::string &sApplicationName,
68 const std::string &sApplicationVersion,
69 const std::string &sApplicationAuthor,
70 const std::string &sLibraryNameForExports
73 static std::string doNormalizePath(
const std::string &sPath);
74 static std::string extractFilename(
const std::string &sPath);
75 static std::string getCurrentDirectory();
77 static long getCurrentTimeInMilliseconds();
78 static long getCurrentTimeInSeconds();
79 static std::string getCurrentTimeForFilename();
80 static std::string getCurrentTimeForLogFormat();
81 static std::string getThreadId();
82 static std::string formatTimeForWeb(
long nTimeInSec);
83 static std::string formatTimeForFilename(
long nTimeInSec);
84 static std::string formatTimeUTC(
int nTimeInSec);
86 static bool dirExists(
const std::string &sFilename);
87 static bool fileExists(
const std::string &sFilename);
88 static std::vector<std::string> listOfDirs(
const std::string &sDirname);
89 static std::vector<std::string> getListOfDirs(
const std::string &sDirname);
90 static std::vector<std::string> listOfFiles(
const std::string &sDirname);
91 static std::vector<std::string> getListOfFiles(
const std::string &sDirname);
92 static bool makeDir(
const std::string &sDirname);
93 static bool writeFile(
const std::string &sFilename,
const std::string &sContent);
94 static bool readTextFile(
const std::string &sFilename, std::string &sOutputContent);
95 static bool readFileToBuffer(
const std::string &sFilename,
char *pBuffer[],
int &nBufferSize);
96 static bool writeFile(
const std::string &sFilename,
const char *pBuffer,
const int nBufferSize);
97 static bool removeFile(
const std::string &sFilename);
98 static bool copyFile(
const std::string &sSourceFilename,
const std::string &sTargetFilename);
100 static bool createEmptyFile(
const std::string &sFilename);
102 static std::string&
ltrim(std::string& str,
const std::string& chars =
"\t\n\v\f\r ");
103 static std::string&
rtrim(std::string& str,
const std::string& chars =
"\t\n\v\f\r ");
104 static std::string&
trim(std::string& str,
const std::string& chars =
"\t\n\v\f\r ");
105 static std::string toLower(
const std::string &str);
106 static std::string toUpper(
const std::string& str);
107 static void replaceAll(std::string& str,
const std::string& from,
const std::string& to);
108 static std::vector<std::string> split(
const std::string& sWhat,
const std::string& sDelim);
109 static std::string join(
const std::vector<std::string> &vWhat,
const std::string& sDelim);
111 static void initRandom();
112 static std::string createUuid();
113 static std::string uint2hexString(
unsigned int n);
114 static unsigned long convertVoidToULong(
void *p);
115 static std::string getPointerAsHex(
void *p);
116 static std::string extractURLProtocol(
const std::string& sValue);
117 static bool getEnv(
const std::string& sName, std::string& sValue);
119 static std::string encodeUriComponent(
const std::string& sValue);
120 static std::string decodeUriComponent(
const std::string& sValue);
122 static std::string getHumanSizeBytes(
long nBytes);
124 static bool recoursiveCopyFiles(
const std::string& sSourceDir,
const std::string& sTargetDir);
125 static bool recoursiveRemoveDir(
const std::string& sDir);
127 static bool setFilePermissions(
const std::string& sFilePath,
const WsjcppFilePermissions &filePermissions, std::string& sError);
128 static bool getFilePermissions(
const std::string& sFilePath,
WsjcppFilePermissions &filePermissions, std::string& sError);
130 static std::string doPadLeft(
const std::string& sIn,
char cWhat,
int nLength);
131 static std::string doPadRight(
const std::string& sIn,
char cWhat,
int nLength);
158 return os <<
"\033[" << mod.
code <<
"m";
167 void doLogRotateUpdateFilename(
bool bForce =
false);
182 static void info(
const std::string &sTag,
const std::string &sMessage);
183 static void err(
const std::string &sTag,
const std::string &sMessage);
184 static void throw_err(
const std::string &sTag,
const std::string &sMessage);
185 static void warn(
const std::string &sTag,
const std::string &sMessage);
186 static void ok(
const std::string &sTag,
const std::string &sMessage);
187 static std::vector<std::string> getLastLogMessages();
188 static void setLogDirectory(
const std::string &sDirectoryPath);
189 static void setPrefixLogFile(
const std::string &sPrefixLogFile);
190 static void setEnableLogFile(
bool bEnable);
191 static void setRotationPeriodInSec(
long nRotationPeriodInSec);
194 static void add(
WsjcppColorModifier &clr,
const std::string &sType,
const std::string &sTag,
const std::string &sMessage);
203 virtual const std::string &getFilename()
const = 0;
204 virtual const std::string &getPackAs()
const = 0;
205 virtual int getBufferSize()
const = 0;
206 virtual const char *getBuffer()
const = 0;
217 static void initGlobalVariables();
219 static const std::vector<WsjcppResourceFile*> &list();
220 static bool has(
const std::string &sFilename);
222 static bool make(
const std::string &sWorkspace);
229 #define REGISTRY_WSJCPP_RESOURCE_FILE( classname ) \ 230 static classname * pRegistryWsjcppResourceFile ## classname = new classname(); \ 233 #endif // WSJCPP_CORE_H void setGroupReadFlag(bool bGroupReadFlag)
Definition: wsjcpp_core.cpp:121
WsjcppColorModifier(WsjcppColorCode pCode)
Definition: wsjcpp_core.h:155
void setGroupWriteFlag(bool bGroupWriteFlag)
Definition: wsjcpp_core.cpp:133
bool m_bOtherWriteFlag
Definition: wsjcpp_core.h:59
bool getOtherExecuteFlag() const
Definition: wsjcpp_core.cpp:195
uint16_t toUInt16() const
Definition: wsjcpp_core.cpp:232
void setGroupFlags(bool bGroupReadFlag, bool bGroupWriteFlag, bool bGroupExecuteFlag)
Definition: wsjcpp_core.cpp:157
std::string logDir
Definition: wsjcpp_core.h:169
std::string logPrefixFile
Definition: wsjcpp_core.h:170
bool m_bOwnerWriteFlag
Definition: wsjcpp_core.h:53
Definition: wsjcpp_core.h:178
bool m_bGroupWriteFlag
Definition: wsjcpp_core.h:56
void setOwnerFlags(bool bOwnerReadFlag, bool bOwnerWriteFlag, bool bOwnerExecuteFlag)
Definition: wsjcpp_core.cpp:113
bool getOtherReadFlag() const
Definition: wsjcpp_core.cpp:171
WsjcppColorCode code
Definition: wsjcpp_core.h:153
bool m_bGroupReadFlag
Definition: wsjcpp_core.h:55
bool m_bOwnerExecuteFlag
Definition: wsjcpp_core.h:54
std::string logFile
Definition: wsjcpp_core.h:171
void setOtherWriteFlag(bool bOtherWriteFlag)
Definition: wsjcpp_core.cpp:177
long logStartTime
Definition: wsjcpp_core.h:173
Definition: wsjcpp_core.h:139
bool m_bOtherReadFlag
Definition: wsjcpp_core.h:58
Definition: wsjcpp_core.h:63
std::deque< std::string > logLastMessages
Definition: wsjcpp_core.h:175
bool getGroupReadFlag() const
Definition: wsjcpp_core.cpp:127
std::string toString() const
Definition: wsjcpp_core.cpp:209
Definition: wsjcpp_core.h:140
static WsjcppLogGlobalConf g_WSJCPP_LOG_GLOBAL_CONF
Definition: wsjcpp_core.h:180
bool enableLogFile
Definition: wsjcpp_core.h:172
bool getOwnerReadFlag() const
Definition: wsjcpp_core.cpp:83
Definition: wsjcpp_core.h:141
void setGroupExecuteFlag(bool bGroupExecuteFlag)
Definition: wsjcpp_core.cpp:145
WsjcppColorCode
Definition: wsjcpp_core.h:138
bool getOtherWriteFlag() const
Definition: wsjcpp_core.cpp:183
Definition: wsjcpp_core.h:146
std::ostream & operator<<(std::ostream &out, MD5 md5)
Definition: md5.cpp:350
std::mutex logMutex
Definition: wsjcpp_core.h:168
bool m_bOtherExecuteFlag
Definition: wsjcpp_core.h:60
bool getOwnerExecuteFlag() const
Definition: wsjcpp_core.cpp:107
bool m_bGroupExecuteFlag
Definition: wsjcpp_core.h:57
void setOwnerReadFlag(bool bOwnerReadFlag)
Definition: wsjcpp_core.cpp:77
Definition: wsjcpp_core.h:145
static void trim(std::string &s)
Definition: mail_send_task.cpp:106
bool getGroupWriteFlag() const
Definition: wsjcpp_core.cpp:139
Definition: wsjcpp_core.h:142
Definition: wsjcpp_core.h:215
static void rtrim(std::string &s)
Definition: mail_send_task.cpp:97
void setOtherReadFlag(bool bOtherReadFlag)
Definition: wsjcpp_core.cpp:165
Definition: wsjcpp_core.h:143
std::vector< WsjcppResourceFile * > * g_pWsjcppResourceFiles
Definition: wsjcpp_core.cpp:1229
static void ltrim(std::string &s)
Definition: mail_send_task.cpp:89
Definition: wsjcpp_core.h:200
Definition: wsjcpp_core.h:144
Definition: wsjcpp_core.h:11
WsjcppFilePermissions()
Definition: wsjcpp_core.cpp:28
Definition: wsjcpp_core.h:164
bool m_bOwnerReadFlag
Definition: wsjcpp_core.h:52
void setOtherFlags(bool bOtherReadFlag, bool bOtherWriteFlag, bool bOtherExecuteFlag)
Definition: wsjcpp_core.cpp:201
bool getGroupExecuteFlag() const
Definition: wsjcpp_core.cpp:151
bool getOwnerWriteFlag() const
Definition: wsjcpp_core.cpp:95
long logRotationPeriodInSeconds
Definition: wsjcpp_core.h:174
Definition: wsjcpp_core.h:147
void setOtherExecuteFlag(bool bOtherExecuteFlag)
Definition: wsjcpp_core.cpp:189
void setOwnerWriteFlag(bool bOwnerWriteFlag)
Definition: wsjcpp_core.cpp:89
void setOwnerExecuteFlag(bool bOwnerExecuteFlag)
Definition: wsjcpp_core.cpp:101
Definition: wsjcpp_core.h:152