1 |
|
|
#ifndef SRC_STRING_DECODER_INL_H_ |
2 |
|
|
#define SRC_STRING_DECODER_INL_H_ |
3 |
|
|
|
4 |
|
|
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS |
5 |
|
|
|
6 |
|
|
#include "string_decoder.h" |
7 |
|
|
#include "util.h" |
8 |
|
|
|
9 |
|
|
namespace node { |
10 |
|
|
|
11 |
|
|
void StringDecoder::SetEncoding(enum encoding encoding) { |
12 |
|
|
state_[kBufferedBytes] = 0; |
13 |
|
|
state_[kMissingBytes] = 0; |
14 |
|
|
state_[kEncodingField] = encoding; |
15 |
|
|
} |
16 |
|
|
|
17 |
|
202156 |
enum encoding StringDecoder::Encoding() const { |
18 |
|
202156 |
return static_cast<enum encoding>(state_[kEncodingField]); |
19 |
|
|
} |
20 |
|
|
|
21 |
|
58274 |
unsigned StringDecoder::BufferedBytes() const { |
22 |
|
58274 |
return state_[kBufferedBytes]; |
23 |
|
|
} |
24 |
|
|
|
25 |
|
48844 |
unsigned StringDecoder::MissingBytes() const { |
26 |
|
48844 |
return state_[kMissingBytes]; |
27 |
|
|
} |
28 |
|
|
|
29 |
|
10449 |
char* StringDecoder::IncompleteCharacterBuffer() { |
30 |
|
10449 |
return reinterpret_cast<char*>(state_ + kIncompleteCharactersStart); |
31 |
|
|
} |
32 |
|
|
|
33 |
|
|
|
34 |
|
|
} // namespace node |
35 |
|
|
|
36 |
|
|
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS |
37 |
|
|
|
38 |
|
|
#endif // SRC_STRING_DECODER_INL_H_ |