![]() |
libbasehangul
0.1.0
|
00001 // 00002 // basehangul.h 00003 // libbasehangul 00004 // 00005 // Created by Gyusun Yeom on 2014. 11. 6.. 00006 // 00007 // \defgroup encoding 00008 // \defgroup decoding 00009 00010 #ifndef __BASE_HANGUL_H_ 00011 #define __BASE_HANGUL_H_ 00012 00013 #ifdef __cplusplus 00014 extern "C" { 00015 #endif 00016 00017 #include "type.h" 00018 #include <string.h> 00019 00021 typedef enum 00022 { 00024 UCS2, 00026 UTF8 00027 } Encoding; 00028 00031 00039 size_t BaseHangulEncodeLength(size_t inputSize, Encoding encoding); 00040 00050 size_t BaseHangulEncode(unsigned char *encoded, const unsigned char *input, size_t len, Encoding encoding); 00051 00055 00065 size_t BaseHangulDecode(unsigned char *decoded, const unsigned char *encoded, size_t len, Encoding encoding); 00066 00070 00079 const uint16_t *BaseHangulDecodeBlock(unsigned char *decoded, const uint16_t *encoded, size_t len); 00080 00084 00093 const unsigned char *BaseHangulEncodeBlock(uint16_t *encoded, const unsigned char *input, size_t len); 00094 00096 00097 #ifdef __cplusplus 00098 } 00099 00100 template<Encoding encoding> 00101 class BaseHangul { 00102 public: 00103 static size_t Encode(unsigned char *encoded, const unsigned char *input, size_t len); 00104 static size_t Decode(unsigned char *decoded, const unsigned char *encoded, size_t len); 00105 }; 00106 #endif 00107 00108 #endif //__BASE_HANGUL_H_ 00109