1
0

encodedstr.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef _ENCODEDSTR_H
  2. #define _ENCODEDSTR_H
  3. #include <api/service/svcs/svc_stringtypes.h>
  4. class String;
  5. class EncodedStr {
  6. public:
  7. // The EncodedStr object will automatically delete its ram, unless you
  8. // specify 0 in that "delete it" parameter there, partner.
  9. EncodedStr(FOURCC encodingType = 0, void *encodedBuffer = NULL, int bufferSize = 0, int deleteIt = 1);
  10. ~EncodedStr();
  11. // A "reset" will ensure any previously set buffer will be deleted
  12. void resetBuffer(FOURCC encodingType, void *encodedBuffer, int bufferSize, int deleteIt = 1);
  13. // All the calls to the service level functions are through here.
  14. int convertToUTF8(String &output_str);
  15. // This method will reset this object (ie: delete RAM if necessary)
  16. int convertFromUTF8(FOURCC encodingType, const String &inputStr);
  17. // Accessor inlines
  18. inline FOURCC getEncodingType() { return encoding_type; }
  19. inline void *getEncodedBuffer() { return encoded_buffer; }
  20. inline int getBufferSize() { return buffer_size; }
  21. inline int getDeleteIt() { return delete_it; }
  22. // This is for debugging.
  23. int operator ==(const EncodedStr &in_string);
  24. private:
  25. FOURCC encoding_type;
  26. void * encoded_buffer;
  27. int buffer_size;
  28. int delete_it;
  29. };
  30. #endif//_ENCODEDSTR_H