blob: 217d035ab9d950c39199c79ac564d29c476ac2c0 (
plain)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
/**
* @file
* @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
* @copyright Simplified BSD
*
* @cond
* This program is free software: you can redistribute it and/or modify
* it under the terms of the FreeBSD license as published by the FreeBSD
* project.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the FreeBSD license along with this
* program. If not, see <http://www.opensource.org/licenses/bsd-license>.
* @endcond
*/
#include "V8CharacterData.h"
#include "V8Node.h"
namespace Arabica {
namespace DOM {
v8::Persistent<v8::FunctionTemplate> V8CharacterData::Tmpl;
v8::Handle<v8::Value> V8CharacterData::dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
v8::Local<v8::Object> self = info.Holder();
struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
return v8::String::New(privData->nativeObj->getData().c_str());
}
void V8CharacterData::dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
v8::Local<v8::Object> self = info.Holder();
struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
v8::String::AsciiValue localData(value);
privData->nativeObj->setData(*localData);
}
v8::Handle<v8::Value> V8CharacterData::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
v8::Local<v8::Object> self = info.Holder();
struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
return v8::Integer::New(privData->nativeObj->getLength());
}
v8::Handle<v8::Value> V8CharacterData::substringDataCallback(const v8::Arguments& args) {
v8::Local<v8::Object> self = args.Holder();
struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
if (false) {
} else if (args.Length() == 2 &&
args[0]->IsUint32() &&
args[1]->IsUint32()) {
unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
unsigned long localCount = args[1]->ToNumber()->Uint32Value();
std::string retVal = privData->nativeObj->substringData(localOffset, localCount);
return v8::String::New(retVal.c_str());
}
throw V8Exception("Parameter mismatch while calling substringData");
return v8::Undefined();
}
v8::Handle<v8::Value> V8CharacterData::appendDataCallback(const v8::Arguments& args) {
v8::Local<v8::Object> self = args.Holder();
struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
if (false) {
} else if (args.Length() == 1 &&
args[0]->IsString()) {
v8::String::AsciiValue localArg(args[0]);
privData->nativeObj->appendData(*localArg);
return v8::Undefined();
}
throw V8Exception("Parameter mismatch while calling appendData");
return v8::Undefined();
}
v8::Handle<v8::Value> V8CharacterData::insertDataCallback(const v8::Arguments& args) {
v8::Local<v8::Object> self = args.Holder();
struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
if (false) {
} else if (args.Length() == 2 &&
args[0]->IsUint32() &&
args[1]->IsString()) {
unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
v8::String::AsciiValue localArg(args[1]);
privData->nativeObj->insertData(localOffset, *localArg);
return v8::Undefined();
}
throw V8Exception("Parameter mismatch while calling insertData");
return v8::Undefined();
}
v8::Handle<v8::Value> V8CharacterData::deleteDataCallback(const v8::Arguments& args) {
v8::Local<v8::Object> self = args.Holder();
struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
if (false) {
} else if (args.Length() == 2 &&
args[0]->IsUint32() &&
args[1]->IsUint32()) {
unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
unsigned long localCount = args[1]->ToNumber()->Uint32Value();
privData->nativeObj->deleteData(localOffset, localCount);
return v8::Undefined();
}
throw V8Exception("Parameter mismatch while calling deleteData");
return v8::Undefined();
}
v8::Handle<v8::Value> V8CharacterData::replaceDataCallback(const v8::Arguments& args) {
v8::Local<v8::Object> self = args.Holder();
struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
if (false) {
} else if (args.Length() == 3 &&
args[0]->IsUint32() &&
args[1]->IsUint32() &&
args[2]->IsString()) {
unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
unsigned long localCount = args[1]->ToNumber()->Uint32Value();
v8::String::AsciiValue localArg(args[2]);
privData->nativeObj->replaceData(localOffset, localCount, *localArg);
return v8::Undefined();
}
throw V8Exception("Parameter mismatch while calling replaceData");
return v8::Undefined();
}
bool V8CharacterData::hasInstance(v8::Handle<v8::Value> value) {
return getTmpl()->HasInstance(value);
}
}
}
|