summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.cpp
blob: 7c72faf3e08916489495258c77d96b1f8574120b (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
#include "JSCNodeSet.h"

namespace Arabica {
namespace DOM {


JSStaticValue JSCNodeSet::staticValues[] = {
	{ "size", sizeAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
	{ "empty", emptyAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },

	{ 0, 0, 0, 0 }
};

JSStaticFunction JSCNodeSet::staticFunctions[] = {
	{ "toDocumentOrder", toDocumentOrderCallback, kJSPropertyAttributeDontDelete },
	{ 0, 0, 0 }
};

JSValueRef JSCNodeSet::sizeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) {
	struct JSCNodeSetPrivate* privData = static_cast<JSCNodeSet::JSCNodeSetPrivate* >(JSObjectGetPrivate(thisObj));

	return JSValueMakeNumber(ctx, privData->arabicaThis->size());
}

JSValueRef JSCNodeSet::emptyAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) {
	struct JSCNodeSetPrivate* privData = static_cast<JSCNodeSet::JSCNodeSetPrivate* >(JSObjectGetPrivate(thisObj));

	return JSValueMakeBoolean(ctx, privData->arabicaThis->empty());
}

}
}