123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- #pragma once
- #include <map>
- #include <string>
- #include <Rpc.h>
- #include <vector>
- #include "ResDataObject.h"
- using namespace std;
- bool AddEnvPath(const char *pPath);
- UINT64 GetDay(UINT64 TheTime);
- __time64_t GetCurrentRealTimeOfStk();
- int CompareTimeByDay(UINT64 Prev, UINT64 Cur);
- bool string_2_guid(const char *pstr, GUID &stGuid);
- bool guid_2_string(GUID &stGuid, string &str);
- bool SplitString(const char *pString, string args, vector<string> &nodes);
- bool SplitTo84422222222String(const char *pString, vector<string> &nodes);
- bool CreateFileDirectory(string &FullFilePath);
- string FormatstdString(const char *pcFormat, ...);
- bool getBusIdFromFilePath(const char *pFilePath,string &BusId);
- bool SplitDevicePath(const char *pDevicePath, vector<string> &nodes);
- bool MergeDevicePath(vector<string> &nodes, string &Devpath);
- string GetProcessDirectory();
- string GetFileTitle(string &fullpath);
- string GetFileName(string &fullpath);
- string & makeLowerStr(string & src);
- string GetFileDirectory(string &fullpath);
- bool FindSubVersionDirs(string rootDir, map<string, vector<string>>& dirlist);
- bool FindSortedSubFiles(string rootFile, vector<string> &filelist);
- void RawToHex(const char *pRaw, DWORD RawLen, string &Hex);
- string ReplaceSubString(string org, string &keystr, string &replacestr);
- string ReplaceFileTitle(string FilePath, string NewTitle);
- bool FindSubFiles(string rootDir, vector<string> &filelist, bool Recursive = true, string strWildcard = "*");
- template <class Type> bool StrToIntT(const char * str, Type *result)
- {
- Type value = 0;
- Type sign = 1;
- Type radix;
- if (str == NULL)
- {
- return false;
- }
- if (strlen(str) == 0)
- {
- return false;
- }
- if (*str == '-')
- {
- sign = -1;
- str++;
- }
- if (*str == '0' && (*(str + 1) == 'x' || *(str + 1) == 'X'))
- {
- radix = 16;
- str += 2;
- }
- //else if(*str == '0')
- //{
- // radix = 8;
- // str++;
- //}
- else
- {
- bool HitF = false;
- size_t Len = strlen(str);
- for (size_t i = 0; i < Len; i++)
- {
- if (str[i] >= '0' && str[i] <= '9')
- {
- continue;
- }
- HitF = true;
- break;
- }
- if (HitF)
- {
- radix = 16;
- }
- else
- {
- radix = 10;
- }
- }
- while (*str)
- {
- if (radix == 16)
- {
- if (*str >= '0' && *str <= '9')
- {
- value = value * radix + *str - '0';
- }
- else
- {
- if ((*str | 0x20) >= 'a' && (*str | 0x20) <= 'f')
- {
- value = value * radix + (*str | 0x20) - 'a' + 10;
- }
- else
- {
- return false;
- }
- }
- }
- else
- {
- value = value * radix + *str - '0';
- }
- str++;
- }
- *result = sign*value;
- return true;
- };
- class common_api
- {
- public:
- common_api(void);
- virtual ~common_api(void);
- HANDLE m_NotifyEvent;
- };
|