WebKitTextCodec.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (C) 2009, 2010, 2011 Research In Motion Limited. All rights reserved.
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef WebKitTextCodec_h
  19. #define WebKitTextCodec_h
  20. #include "BlackBerryGlobal.h"
  21. #include <vector>
  22. namespace BlackBerry {
  23. namespace Platform {
  24. class String;
  25. }
  26. namespace WebKit {
  27. enum TranscodeResult {
  28. Success,
  29. SourceEncodingUnsupported,
  30. SourceBroken,
  31. TargetEncodingUnsupported,
  32. TargetBufferInsufficient
  33. };
  34. enum Base64DecodePolicy {
  35. Base64FailOnInvalidCharacter,
  36. Base64IgnoreWhitespace,
  37. Base64IgnoreInvalidCharacters
  38. };
  39. enum Base64EncodePolicy {
  40. Base64DoNotInsertCRLF,
  41. Base64InsertCRLF
  42. };
  43. BLACKBERRY_EXPORT bool isSameEncoding(const char* encoding1, const char* encoding2);
  44. BLACKBERRY_EXPORT bool isASCIICompatibleEncoding(const char* encoding);
  45. BLACKBERRY_EXPORT TranscodeResult transcode(const char* sourceEncoding, const char* targetEncoding, const char*& sourceStart, int sourceLength, char*& targetStart, unsigned targetLength);
  46. BLACKBERRY_EXPORT bool base64Decode(const BlackBerry::Platform::String& base64, std::vector<char>& binary, Base64DecodePolicy);
  47. BLACKBERRY_EXPORT bool base64Encode(const std::vector<char>& binary, BlackBerry::Platform::String& base64, Base64EncodePolicy);
  48. BLACKBERRY_EXPORT void unescapeURL(const BlackBerry::Platform::String& escaped, BlackBerry::Platform::String& url);
  49. BLACKBERRY_EXPORT void escapeURL(const BlackBerry::Platform::String& url, BlackBerry::Platform::String& escaped);
  50. } // namespace WebKit
  51. } // namespace BlackBerry
  52. #endif // WebKitTextCodec_h