Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.1 KiB

  1. // This is a part of the Active Template Library.
  2. // Copyright (C) 1996-2001 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Active Template Library Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Active Template Library product.
  10. #ifndef __ATLSTR_H__
  11. #define __ATLSTR_H__
  12. #pragma once
  13. #ifndef __cplusplus
  14. #error ATL requires C++ compilation (use a .cpp suffix)
  15. #endif
  16. #include <atlbase.h>
  17. #include <winnls.h>
  18. #include <limits.h>
  19. #include <cstringt.h>
  20. namespace ATL
  21. {
  22. extern CAtlStringMgr g_strmgr;
  23. template< typename _BaseType = char, class StringIterator = ChTraitsOS< _BaseType > >
  24. class StrTraitATL : public StringIterator
  25. {
  26. public:
  27. static HINSTANCE FindStringResourceInstance(UINT /* nID */) throw()
  28. {
  29. return( _AtlBaseModule.GetResourceInstance() );
  30. }
  31. static IAtlStringMgr* GetDefaultManager() throw()
  32. {
  33. return( &g_strmgr );
  34. }
  35. };
  36. #if !defined(_ATL_CSTRING_NO_CRT) && defined(_ATL_MIN_CRT)
  37. #define _ATL_CSTRING_NO_CRT
  38. #endif
  39. #ifndef _ATL_CSTRING_NO_CRT
  40. typedef CStringT< wchar_t, StrTraitATL< wchar_t, ChTraitsCRT< wchar_t > > > CAtlStringW;
  41. typedef CStringT< char, StrTraitATL< char, ChTraitsCRT< char > > > CAtlStringA;
  42. typedef CStringT< TCHAR, StrTraitATL< TCHAR, ChTraitsCRT< TCHAR > > > CAtlString;
  43. #else // _ATL_CSTRING_NO_CRT
  44. typedef CStringT< wchar_t, StrTraitATL< wchar_t > > CAtlStringW;
  45. typedef CStringT< char, StrTraitATL< char > > CAtlStringA;
  46. typedef CStringT< TCHAR, StrTraitATL< TCHAR > > CAtlString;
  47. #endif // _ATL_CSTRING_NO_CRT
  48. #ifndef _AFX
  49. typedef CAtlStringW CStringW;
  50. typedef CAtlStringA CStringA;
  51. typedef CAtlString CString;
  52. #endif
  53. #ifdef __ATLCOLL_H__
  54. template<>
  55. class CElementTraits< ATL::CAtlStringA > :
  56. public CStringElementTraits< ATL::CAtlStringA >
  57. {
  58. };
  59. template<>
  60. class CElementTraits< ATL::CAtlStringW > :
  61. public CStringElementTraits< ATL::CAtlStringW >
  62. {
  63. };
  64. #endif // __ATLCOLL_H__
  65. }; //namespace ATL
  66. #endif // __ATLSTR_H__
  67. /////////////////////////////////////////////////////////////////////////////