-
Notifications
You must be signed in to change notification settings - Fork 299
/
TextEncoder.cpp
50 lines (41 loc) · 1.07 KB
/
TextEncoder.cpp
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
/*
* TextEncoder.cpp
*
* Created on: Jun 2, 2022
* Author: lion
*/
#include "object.h"
#include <TextEncoder.h>
#include "ifs/iconv.h"
namespace fibjs {
result_t TextEncoder_base::_new(exlib::string codec, v8::Local<v8::Object> opts, obj_ptr<TextEncoder_base>& retVal,
v8::Local<v8::Object> This)
{
retVal = new TextEncoder(codec);
return 0;
}
result_t TextEncoder::encode(exlib::string data, v8::Local<v8::Object> opts, obj_ptr<Buffer_base>& retVal)
{
return iconv_base::encode(m_codec, data, retVal);
}
result_t TextEncoder::get_encoding(exlib::string& retVal)
{
retVal = m_codec;
return 0;
}
result_t TextDecoder_base::_new(exlib::string codec, v8::Local<v8::Object> opts, obj_ptr<TextDecoder_base>& retVal,
v8::Local<v8::Object> This)
{
retVal = new TextDecoder(codec);
return 0;
}
result_t TextDecoder::decode(Buffer_base* data, v8::Local<v8::Object> opts, exlib::string& retVal)
{
return iconv_base::decode(m_codec, data, retVal);
}
result_t TextDecoder::get_encoding(exlib::string& retVal)
{
retVal = m_codec;
return 0;
}
}