summaryrefslogtreecommitdiff
path: root/Source/Kernel/Library/wchar.class.h
blob: cadabd0ec32ea1d9c284a3644e59354d7eff8c39 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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