utils.h 749 B

12345678910111213141516171819202122232425
  1. #pragma once
  2. #ifdef _UNICODE
  3. typedef std::wstring TString;
  4. #else
  5. typedef std::string TString;
  6. #endif
  7. namespace utils
  8. {
  9. std::string& trim(std::string& str);
  10. TString _dprintf(TCHAR* pszStr, ...);
  11. std::string ByteToChars(byte b);
  12. BOOL IsValidString(LPCTSTR lpszString);
  13. unsigned char TwoHexCharToInteger(char high, char low);
  14. std::string BytesToHexString(const unsigned char* pbuffer, int nLen);
  15. std::string BytesToHexString(const unsigned char* pbuffer, int nLen, char chSpace);
  16. std::string HexStringToBytes(std::string strHex, const int& len /* = 3 */);
  17. unsigned short CRC16Calculate(byte* pBuffer, unsigned int wordLength);
  18. bool GetResourceData(DWORD dwResourceID, LPCTSTR lpExt, std::string &rtnData);
  19. };