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 |
|
|
|
8 |
|
|
namespace node { |
9 |
|
|
|
10 |
|
|
void StringDecoder::SetEncoding(enum encoding encoding) { |
11 |
|
|
state_[kBufferedBytes] = 0; |
12 |
|
|
state_[kMissingBytes] = 0; |
13 |
|
|
state_[kEncodingField] = encoding; |
14 |
|
|
} |
15 |
|
|
|
16 |
|
159260 |
enum encoding StringDecoder::Encoding() const { |
17 |
|
159260 |
return static_cast<enum encoding>(state_[kEncodingField]); |
18 |
|
|
} |
19 |
|
|
|
20 |
|
51730 |
unsigned StringDecoder::BufferedBytes() const { |
21 |
|
51730 |
return state_[kBufferedBytes]; |
22 |
|
|
} |
23 |
|
|
|
24 |
|
38328 |
unsigned StringDecoder::MissingBytes() const { |
25 |
|
38328 |
return state_[kMissingBytes]; |
26 |
|
|
} |
27 |
|
|
|
28 |
|
12618 |
char* StringDecoder::IncompleteCharacterBuffer() { |
29 |
|
12618 |
return reinterpret_cast<char*>(state_ + kIncompleteCharactersStart); |
30 |
|
|
} |
31 |
|
|
|
32 |
|
|
|
33 |
|
|
} // namespace node |
34 |
|
|
|
35 |
|
|
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS |
36 |
|
|
|
37 |
|
|
#endif // SRC_STRING_DECODER_INL_H_ |