aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/bfc/string/encodedstr.h
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/bfc/string/encodedstr.h
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/Wasabi/bfc/string/encodedstr.h')
-rw-r--r--Src/Wasabi/bfc/string/encodedstr.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/Src/Wasabi/bfc/string/encodedstr.h b/Src/Wasabi/bfc/string/encodedstr.h
new file mode 100644
index 00000000..ee5e49c0
--- /dev/null
+++ b/Src/Wasabi/bfc/string/encodedstr.h
@@ -0,0 +1,42 @@
+#ifndef _ENCODEDSTR_H
+#define _ENCODEDSTR_H
+
+#include <api/service/svcs/svc_stringtypes.h>
+
+class String;
+
+class EncodedStr {
+public:
+ // The EncodedStr object will automatically delete its ram, unless you
+ // specify 0 in that "delete it" parameter there, partner.
+ EncodedStr(FOURCC encodingType = 0, void *encodedBuffer = NULL, int bufferSize = 0, int deleteIt = 1);
+ ~EncodedStr();
+
+ // A "reset" will ensure any previously set buffer will be deleted
+ void resetBuffer(FOURCC encodingType, void *encodedBuffer, int bufferSize, int deleteIt = 1);
+
+ // All the calls to the service level functions are through here.
+ int convertToUTF8(String &output_str);
+ // This method will reset this object (ie: delete RAM if necessary)
+ int convertFromUTF8(FOURCC encodingType, const String &inputStr);
+
+ // Accessor inlines
+ inline FOURCC getEncodingType() { return encoding_type; }
+ inline void *getEncodedBuffer() { return encoded_buffer; }
+ inline int getBufferSize() { return buffer_size; }
+ inline int getDeleteIt() { return delete_it; }
+
+// This is for debugging.
+ int operator ==(const EncodedStr &in_string);
+
+private:
+ FOURCC encoding_type;
+ void * encoded_buffer;
+ int buffer_size;
+ int delete_it;
+};
+
+
+#endif//_ENCODEDSTR_H
+
+