-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathencode.cpp
More file actions
48 lines (41 loc) · 1.25 KB
/
encode.cpp
File metadata and controls
48 lines (41 loc) · 1.25 KB
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
// encode.cpp
#include "encoding.h"
#include "jis2unicode.h"
namespace {
// UTF-16 LE/BE encoder
unsigned int encode_utf16(unsigned char *dest, unsigned int dest_size, const int *src, unsigned int src_size)
{
// not implemented yet.
return 0;
}
// UTF-8 encoder
unsigned int encode_utf8(unsigned char *dest, unsigned int dest_size, const int *src, unsigned int src_size)
{
// not implemented yet.
return 0;
}
// Shift_JIS encoder
unsigned int encode_shiftjis(unsigned char *dest, unsigned int dest_size, const int *src, unsigned int src_size)
{
// not implemented yet.
return 0;
}
// EUC-JP encoder
unsigned int encode_eucjp(unsigned char *dest, unsigned int dest_size, const int *src, unsigned int src_size)
{
// not implemented yet.
return 0;
}
}
unsigned int Encoding::encode(unsigned char *dest, unsigned int dest_size, const int *src, unsigned int src_size, EncodingType encoding)
{
// dispatching
switch (encoding) {
case UTF16: return ::encode_utf16(dest, dest_size, src, src_size);
case UTF8: return ::encode_utf8(dest, dest_size, src, src_size);
case SHIFTJIS: return ::encode_shiftjis(dest, dest_size, src, src_size);
case EUCJP: return ::encode_eucjp(dest, dest_size, src, src_size);
}
// unknown encoding.
return 0;
}