String.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // "$Id$"
  3. //
  4. // Copyright (c)1992-2007, ZheJiang Dahua Technology Stock CO.LTD.
  5. // All Rights Reserved.
  6. //
  7. // Description:
  8. // Revisions: Year-Month-Day SVN-Author Modification
  9. //
  10. #ifndef __DAHUA_INFRA_STRING_H__
  11. #define __DAHUA_INFRA_STRING_H__
  12. #include "Defs.h"
  13. #include "CString.h"
  14. #include "Detail/flex_string.h"
  15. ////////////////////////////////////////////////////////////////////////////////
  16. // 与 std::basic_string 接口完全兼容的字符串处理类
  17. namespace Dahua {
  18. namespace Infra {
  19. // 兼容CStirng和std::string的字符串,新函数应该直接使用CString来定义
  20. #ifdef _WIN32
  21. typedef CString CString2;
  22. #else
  23. typedef std::string CString2;
  24. #endif // WIN32
  25. typedef flex_string<
  26. wchar_t,
  27. std::char_traits<wchar_t>,
  28. std::allocator<wchar_t>,
  29. SmallStringOpt<AllocatorStringStorage<wchar_t, std::allocator<wchar_t> >, 31>
  30. > CWString;
  31. /// 最小字符串类,sizeof(CMiniString)固定为sizeof(void *)
  32. typedef flex_string<
  33. char,
  34. std::char_traits<char>,
  35. std::allocator<char>,
  36. MiniStringStorage<char, std::allocator<char> >
  37. > CMiniString;
  38. } // namespace Infra
  39. } // namespace Dahua
  40. #endif// __DAHUA_INFRA_STRING_H__