Windows1251Encoding.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // Windows1251Encoding.h
  3. //
  4. // $Id: //poco/svn/Foundation/include/Poco/Windows1251Encoding.h#2 $
  5. //
  6. // Library: Foundation
  7. // Package: Text
  8. // Module: Windows1251Encoding
  9. //
  10. // Definition of the Windows1251Encoding class.
  11. //
  12. // Copyright (c) 2005-2007, Applied Informatics Software Engineering GmbH.
  13. // and Contributors.
  14. //
  15. // SPDX-License-Identifier: BSL-1.0
  16. //
  17. #ifndef Foundation_Windows1251Encoding_INCLUDED
  18. #define Foundation_Windows1251Encoding_INCLUDED
  19. #include "Poco/Foundation.h"
  20. #include "Poco/TextEncoding.h"
  21. namespace Poco {
  22. class Foundation_API Windows1251Encoding: public TextEncoding
  23. /// Windows Codepage 1251 text encoding.
  24. /// Based on: http://msdn.microsoft.com/en-us/goglobal/cc305144
  25. {
  26. public:
  27. Windows1251Encoding();
  28. ~Windows1251Encoding();
  29. const char* canonicalName() const;
  30. bool isA(const std::string& encodingName) const;
  31. const CharacterMap& characterMap() const;
  32. int convert(const unsigned char* bytes) const;
  33. int convert(int ch, unsigned char* bytes, int length) const;
  34. int queryConvert(const unsigned char* bytes, int length) const;
  35. int sequenceLength(const unsigned char* bytes, int length) const;
  36. private:
  37. static const char* _names[];
  38. static const CharacterMap _charMap;
  39. };
  40. } // namespace Poco
  41. #endif // Foundation_Windows1251Encoding_INCLUDED