summaryrefslogtreecommitdiff
path: root/Source/Kernel/Library/WChar.class.h
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-09-11 16:22:30 +0200
committerAlexis211 <alexis211@gmail.com>2009-09-11 16:22:30 +0200
commit7b0d6ac9f903296c7537cec9ac606d49cb364049 (patch)
treec9bc6aaf4e7237cf5577f3a78291f1f591fe1563 /Source/Kernel/Library/WChar.class.h
parentd95452c5452b4ca7418505fa5597f000596fcb78 (diff)
downloadMelon-7b0d6ac9f903296c7537cec9ac606d49cb364049.tar.gz
Melon-7b0d6ac9f903296c7537cec9ac606d49cb364049.zip
Nothing, really
Diffstat (limited to 'Source/Kernel/Library/WChar.class.h')
-rw-r--r--Source/Kernel/Library/WChar.class.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/Source/Kernel/Library/WChar.class.h b/Source/Kernel/Library/WChar.class.h
new file mode 100644
index 0000000..c582017
--- /dev/null
+++ b/Source/Kernel/Library/WChar.class.h
@@ -0,0 +1,51 @@
+#ifndef DEF_UCHAR_CLASS_H
+#define DEF_UCHAR_CLASS_H
+
+#include <Core/common.wtf.h>
+
+struct WChar {
+ u32int value;
+ static WChar CP437[];
+
+ WChar(); //Creates a null character
+ WChar(char c); //From ascii character
+ WChar(char* c); //From utf8 string
+
+ static u32int utf8len(char* c); //Returns count of utf8 characters in string
+
+ void affectAscii(char c);
+ u32int affectUtf8(char* c);
+ void affectUtf16(char* c);
+ void affectUtf32(char* c);
+ u8int toAscii();
+
+ inline WChar operator+ (u32int other) {
+ WChar r;
+ r.value = value + other;
+ return r;
+ }
+ inline WChar operator- (u32int other) {
+ WChar r;
+ r.value = value - other;
+ return r;
+ }
+ inline WChar& operator+= (u32int other) {
+ value += other;
+ return *this;
+ }
+ inline WChar& operator-= (u32int other) {
+ value -= other;
+ return *this;
+ }
+ inline bool operator== (u32int other) {
+ return value == other;
+ }
+ inline u32int operator= (u32int v) {
+ value = v;
+ return v;
+ }
+
+ inline operator u32int () { return value; }
+};
+
+#endif