-
Notifications
You must be signed in to change notification settings - Fork 299
/
TextEncoder.h
47 lines (37 loc) · 919 Bytes
/
TextEncoder.h
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
/*
* TextEncoder.h
*
* Created on: Jun 2, 2022
* Author: lion
*/
#pragma once
#include "ifs/TextEncoder.h"
#include "ifs/TextDecoder.h"
namespace fibjs {
class TextEncoder : public TextEncoder_base {
public:
TextEncoder(exlib::string codec)
: m_codec(codec)
{
}
public:
// TextEncoder_base
virtual result_t encode(exlib::string data, v8::Local<v8::Object> opts, obj_ptr<Buffer_base>& retVal);
virtual result_t get_encoding(exlib::string& retVal);
private:
exlib::string m_codec;
};
class TextDecoder : public TextDecoder_base {
public:
TextDecoder(exlib::string codec)
: m_codec(codec)
{
}
public:
// TextDecoder_base
virtual result_t decode(Buffer_base* data, v8::Local<v8::Object> opts, exlib::string& retVal);
virtual result_t get_encoding(exlib::string& retVal);
private:
exlib::string m_codec;
};
} /* namespace fibjs */