summaryrefslogblamecommitdiff
path: root/Source/Kernel/Library/WChar.class.h
blob: 9ddccd10e720feed4eea869e3b975970de77ab0e (plain) (tree)
1
2
3
4
5
6
7
8
9




                            
              
                     
                             
 

                                                          
                                                  
 
                                                                                            

                                 


                                         

                        

                                               


                                        

                                               


                                        
                                                 


                               
                                                 














                                                   
#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(const char* c);	//From utf8 string

	static u32int utf8len(const char* c);	//Returns count of utf8 characters in string

	void affectAscii(char c);
	u32int affectUtf8(const char* c);
	void affectUtf16(const char* c);
	void affectUtf32(const 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