2023-02-11 18:54:35 +01:00
|
|
|
#ifndef SRC_ENCODING_BINDING_H_
|
|
|
|
|
#define SRC_ENCODING_BINDING_H_
|
|
|
|
|
|
|
|
|
|
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
|
|
|
|
|
|
|
|
#include <cinttypes>
|
|
|
|
|
#include "aliased_buffer.h"
|
|
|
|
|
#include "node_snapshotable.h"
|
|
|
|
|
#include "v8-fast-api-calls.h"
|
|
|
|
|
|
|
|
|
|
namespace node {
|
|
|
|
|
class ExternalReferenceRegistry;
|
|
|
|
|
|
|
|
|
|
namespace encoding_binding {
|
|
|
|
|
class BindingData : public SnapshotableObject {
|
|
|
|
|
public:
|
2023-04-20 05:28:35 +02:00
|
|
|
struct InternalFieldInfo : public node::InternalFieldInfoBase {
|
|
|
|
|
AliasedBufferIndex encode_into_results_buffer;
|
|
|
|
|
};
|
2023-02-11 18:54:35 +01:00
|
|
|
|
2023-04-20 05:28:35 +02:00
|
|
|
BindingData(Realm* realm,
|
|
|
|
|
v8::Local<v8::Object> obj,
|
|
|
|
|
InternalFieldInfo* info = nullptr);
|
2023-02-11 18:54:35 +01:00
|
|
|
SERIALIZABLE_OBJECT_METHODS()
|
|
|
|
|
SET_BINDING_ID(encoding_binding_data)
|
|
|
|
|
|
2023-02-11 19:25:00 +01:00
|
|
|
void MemoryInfo(MemoryTracker* tracker) const override;
|
2023-02-11 18:54:35 +01:00
|
|
|
SET_SELF_SIZE(BindingData)
|
|
|
|
|
SET_MEMORY_INFO_NAME(BindingData)
|
|
|
|
|
|
|
|
|
|
static void EncodeInto(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
|
static void EncodeUtf8String(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
|
static void DecodeUTF8(const v8::FunctionCallbackInfo<v8::Value>& args);
|
2025-12-04 17:23:01 +03:00
|
|
|
static void DecodeWindows1252(
|
|
|
|
|
const v8::FunctionCallbackInfo<v8::Value>& args);
|
2023-02-11 18:54:35 +01:00
|
|
|
|
2023-04-28 14:48:38 -04:00
|
|
|
static void ToASCII(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
|
static void ToUnicode(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
|
|
2023-04-28 18:30:47 +02:00
|
|
|
static void CreatePerIsolateProperties(IsolateData* isolate_data,
|
2023-05-06 18:07:19 +02:00
|
|
|
v8::Local<v8::ObjectTemplate> target);
|
2023-04-28 18:30:47 +02:00
|
|
|
static void CreatePerContextProperties(v8::Local<v8::Object> target,
|
|
|
|
|
v8::Local<v8::Value> unused,
|
|
|
|
|
v8::Local<v8::Context> context,
|
|
|
|
|
void* priv);
|
2023-02-11 18:54:35 +01:00
|
|
|
static void RegisterTimerExternalReferences(
|
|
|
|
|
ExternalReferenceRegistry* registry);
|
2023-02-11 19:25:00 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
static constexpr size_t kEncodeIntoResultsLength = 2;
|
|
|
|
|
AliasedUint32Array encode_into_results_buffer_;
|
2023-04-20 05:28:35 +02:00
|
|
|
InternalFieldInfo* internal_field_info_ = nullptr;
|
2023-02-11 18:54:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace encoding_binding
|
|
|
|
|
|
|
|
|
|
} // namespace node
|
|
|
|
|
|
|
|
|
|
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
|
|
|
|
|
|
|
|
#endif // SRC_ENCODING_BINDING_H_
|