MoudleConfig.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef MOUDLECONFIG_H
  2. #define MOUDLECONFIG_H
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include <stdint.h>
  6. #include <string>
  7. #if defined(WIN32)
  8. #define PRINT_INT64_FORMAT "%I64d"
  9. #else
  10. #include <sys/time.h>
  11. #include <stdio.h>
  12. #include <unistd.h>
  13. void Sleep(long mSeconds);
  14. #define PRINT_INT64_FORMAT "%lld"
  15. #endif
  16. typedef unsigned char uchar;
  17. class MoudleConfig
  18. {
  19. public:
  20. MoudleConfig();
  21. static int VERSION;
  22. static char VERSION_NAME[32];
  23. static void mkdir(char *dirName); //创建文件夹
  24. static void mkpath(char *path); //创建多级文件夹
  25. static void removeDir(char *dirName);
  26. static void removeFile(const char *filePath);
  27. static void copyFile(const char *srcFile, const char *destFile);
  28. ///字符串处理
  29. static std::string stringFormat(const char *fmt, ...);//字符串格式化函数
  30. static std::string stringReplaceAll(std::string &str, const std::string &old_value, const std::string &new_value); //字符串替换函数
  31. static void replaceChar(char *string, char oldChar, char newChar); //字符串替换字符
  32. static std::string removeFirstAndLastSpace(std::string &s); //移除开始和结束的空格
  33. static std::string getIpFromRtspUrl(std::string rtspUrl); //从rtsp地址中获取ip地址
  34. static void mSleep(int mSecond);
  35. static int64_t getTimeStamp_MilliSecond(); //获取时间戳(毫秒)
  36. };
  37. #endif // MOUDLECONFIG_H