本文整理汇总了C++中Handle::SetInternalFieldCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Handle::SetInternalFieldCount方法的具体用法?C++ Handle::SetInternalFieldCount怎么用?C++ Handle::SetInternalFieldCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Handle
的用法示例。
在下文中一共展示了Handle::SetInternalFieldCount方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scope
Handle<ObjectTemplate> MakeLogTemplate(Isolate *isolate)
{
HandleScope scope(isolate);
Handle<ObjectTemplate> objTemplate = ObjectTemplate::New();
objTemplate->SetInternalFieldCount(1);
objTemplate->Set(v8::String::New("log"), FunctionTemplate::New(LogCallback));
return scope.Close(objTemplate);
}
示例2: PrepareTemplate
static Handle<ObjectTemplate> PrepareTemplate()
{
HandleScope handle_scope;
Handle<ObjectTemplate> result = ObjectTemplate::New();
result->SetInternalFieldCount(2);
result->SetNamedPropertyHandler(ObjectGet, ObjectSet);
return handle_scope.Close(result);
}
示例3: Initialize
void Widget::Initialize(Handle<Object> target)
{
HandleScope scope;
Local<String> name = String::NewSymbol("Widget");
/* Create a new class */
Handle<ObjectTemplate> ObjectTpl = ObjectTemplate::New();
ObjectTpl->SetInternalFieldCount(1);
Local<Object> ClassObject = ObjectTpl->NewInstance();
target->Set(name, ClassObject);
/* Initializing Widget Class */
Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
tpl->InstanceTemplate()->SetInternalFieldCount(1);
/* Widgets */
Style::Initialize(ClassObject);
Bin::Initialize(ClassObject);
BoxLayout::Initialize(ClassObject);
Stack::Initialize(ClassObject);
Grid::Initialize(ClassObject);
Table::Initialize(ClassObject);
Adjustment::Initialize(ClassObject);
Scrollable::Initialize(ClassObject);
//Stylable::Initialize(ClassObject);
Button::Initialize(ClassObject);
Entry::Initialize(ClassObject);
Frame::Initialize(ClassObject);
Label::Initialize(ClassObject);
Dialog::Initialize(ClassObject);
ProgressBar::Initialize(ClassObject);
Slider::Initialize(ClassObject);
Toggle::Initialize(ClassObject);
Spinner::Initialize(ClassObject);
Image::Initialize(ClassObject);
Viewport::Initialize(ClassObject);
ScrollView::Initialize(ClassObject);
KineticScrollView::Initialize(ClassObject);
/* Constants */
JSDX_TOOLKIT_DEFINE_CONSTANT(ClassObject, "ORIENTATION_HORIZONTAL", JSDX_TOOLKIT_WIDGET_ORIENTATION_HORIZONTAL);
JSDX_TOOLKIT_DEFINE_CONSTANT(ClassObject, "ORIENTATION_VERTICAL", JSDX_TOOLKIT_WIDGET_ORIENTATION_VERTICAL);
JSDX_TOOLKIT_DEFINE_CONSTANT(ClassObject, "SCALE_MODE_NONE", MX_IMAGE_SCALE_NONE);
JSDX_TOOLKIT_DEFINE_CONSTANT(ClassObject, "SCALE_MODE_FIT", MX_IMAGE_SCALE_FIT);
JSDX_TOOLKIT_DEFINE_CONSTANT(ClassObject, "SCALE_MODE_CROP", MX_IMAGE_SCALE_CROP);
JSDX_TOOLKIT_DEFINE_CONSTANT(ClassObject, "KINETIC_SCROLL_VIEW_STATE_IDLE", MX_KINETIC_SCROLL_VIEW_STATE_IDLE);
JSDX_TOOLKIT_DEFINE_CONSTANT(ClassObject, "KINETIC_SCROLL_VIEW_STATE_PANNING", MX_KINETIC_SCROLL_VIEW_STATE_PANNING);
JSDX_TOOLKIT_DEFINE_CONSTANT(ClassObject, "KINETIC_SCROLL_VIEW_STATE_SCROLLING", MX_KINETIC_SCROLL_VIEW_STATE_SCROLLING);
JSDX_TOOLKIT_DEFINE_CONSTANT(ClassObject, "KINETIC_SCROLL_VIEW_STATE_CLAMPING", MX_KINETIC_SCROLL_VIEW_STATE_CLAMPING);
ClassObject->Set(name, tpl->GetFunction());
}
示例4:
void lemur::MidiClient::init(Handle<Object> target)
{
HandleScope _;
Local<FunctionTemplate> ft = FunctionTemplate::New();
ft->SetClassName(v8::String::NewSymbol("MidiClient"));
Handle<ObjectTemplate> it = ft->InstanceTemplate();
it->SetInternalFieldCount(1);
NODE_SET_PROTOTYPE_METHOD(ft, "send", Send);
MidiClient::tpl = Persistent<FunctionTemplate>::New(ft);
}
示例5: PrototypeMethodsInit
void Scrollable::PrototypeMethodsInit(Handle<FunctionTemplate> constructor_template)
{
HandleScope scope;
Local<String> name = String::NewSymbol("scroll");
/* Scrollable Object */
Handle<ObjectTemplate> ObjectTpl = ObjectTemplate::New();
ObjectTpl->SetInternalFieldCount(1);
Local<Object> ObjectInstance = ObjectTpl->NewInstance();
/* Methods */
NODE_SET_METHOD(ObjectInstance, "test", Scrollable::Test);
constructor_template->InstanceTemplate()->Set(name, ObjectInstance);
}
示例6:
Handle<ObjectTemplate> V8Templates::getDialogStateTemplate()
{
HandleScope scope;
if (!dialogStateTemplate.IsEmpty())
return dialogStateTemplate;
Handle<ObjectTemplate> templ = ObjectTemplate::New();
templ->SetInternalFieldCount(numOfDialogStateInternalFields());
AddDialogStateAcessors(templ);
addDialogStateTemplateFields(templ);
dialogStateTemplate = Persistent<ObjectTemplate>::New(templ);
return dialogStateTemplate;
}
示例7: PointConstructor
// Defines a Point() JS Object
void PointConstructor( const FunctionCallbackInfo<v8::Value>& args )
{
//Locker lock;
HandleScope scope;
Handle<ObjectTemplate> t = v8::ObjectTemplate::New();
//The JavaScript point object only has 1 C++ object
t->SetInternalFieldCount(1);
// Create x and y members with starting values of 0
//t->Set(String::New("x"), Number::New(0));
t->SetAccessor(String::New("x"),
(AccessorGetterCallback)GetPointX,
(AccessorSetterCallback)SetPointX);
//t->Set(String::New("y"), Number::New(0));
t->SetAccessor(String::New("y"),
(AccessorGetterCallback)GetPointY,
(AccessorSetterCallback)SetPointY);
// Create a mul(number) function that scales the point
t->Set(String::New("mul"), FunctionTemplate::New(MulCallback));
// for use in the if statement
Point *p = NULL;
Local<Object> obj;
// If Point(x, y) ctor was passed in values assign them
if(!args[0].IsEmpty() && args[0]->IsNumber() &&
!args[1].IsEmpty() && args[1]->IsNumber()) {
//t->Set(String::New("x"), args[0]);
//t->Set(String::New("y"), args[1]);
p = new Point(args[0]->Int32Value(), args[1]->Int32Value());
obj = t->NewInstance();
obj->SetInternalField(0, External::New(p));
} else {
/**
* Wrap a point object
*/
p = new Point(0, 0);
obj = t->NewInstance();
obj->SetInternalField(0, External::New(p));
}
// Return this newly created object
args.GetReturnValue().Set(obj);
}
示例8: init
void PSKeyboard::init(Handle<Object> target) {
NODE_SET_METHOD(target, "getKeyboardState", getKeyboardState);
NODE_SET_METHOD(target, "keycodeToName", keycodeToName);
NODE_SET_METHOD(target, "setKeyboardLeds", setKeyboardLeds);
HandleScope _;
Local<FunctionTemplate> ft = FunctionTemplate::New();
ft->SetClassName(String::NewSymbol("PSKeyboardState"));
Handle<ObjectTemplate> it = ft->InstanceTemplate();
it->SetInternalFieldCount(1);
PSKeyboardState::tpl = Persistent<FunctionTemplate>::New(ft);
}
示例9: Image
Image *Image::CreateFromFile(const char *file)
{
ce::Image *baseImage = ce::Image::CreateFromFile(file);
if(!baseImage)
return 0;
Image *image = new Image();
image->m_image = baseImage;
Handle<ObjectTemplate> objectTemplate = ObjectTemplate::New();
objectTemplate->SetInternalFieldCount(1);
HandleScope handleScope;
Persistent<Object> instance = Persistent<Object>::New(objectTemplate->NewInstance());
instance->SetInternalField(0, External::New(image));
image->m_instance = instance;
return image;
}
示例10:
Handle<ObjectTemplate> AlFactory::createAl(int* pargc, char** argv) {
HandleScope handle_scope;
Handle<ObjectTemplate> Al = ObjectTemplate::New();
Al->SetInternalFieldCount(1);
Al->SetAccessor(String::NewSymbol("INVALID"), GetAL_INVALID);
Al->SetAccessor(String::NewSymbol("ILLEGAL_ENUM"), GetAL_ILLEGAL_ENUM);
Al->SetAccessor(String::NewSymbol("ILLEGAL_COMMAND"), GetAL_ILLEGAL_COMMAND);
Al->SetAccessor(String::NewSymbol("NONE"), GetAL_NONE);
Al->SetAccessor(String::NewSymbol("FALSE"), GetAL_FALSE);
Al->SetAccessor(String::NewSymbol("TRUE"), GetAL_TRUE);
Al->SetAccessor(String::NewSymbol("SOURCE_RELATIVE"), GetAL_SOURCE_RELATIVE);
Al->SetAccessor(String::NewSymbol("CONE_INNER_ANGLE"), GetAL_CONE_INNER_ANGLE);
Al->SetAccessor(String::NewSymbol("CONE_OUTER_ANGLE"), GetAL_CONE_OUTER_ANGLE);
Al->SetAccessor(String::NewSymbol("PITCH"), GetAL_PITCH);
Al->SetAccessor(String::NewSymbol("POSITION"), GetAL_POSITION);
Al->SetAccessor(String::NewSymbol("DIRECTION"), GetAL_DIRECTION);
Al->SetAccessor(String::NewSymbol("VELOCITY"), GetAL_VELOCITY);
Al->SetAccessor(String::NewSymbol("LOOPING"), GetAL_LOOPING);
Al->SetAccessor(String::NewSymbol("BUFFER"), GetAL_BUFFER);
Al->SetAccessor(String::NewSymbol("GAIN"), GetAL_GAIN);
Al->SetAccessor(String::NewSymbol("MIN_GAIN"), GetAL_MIN_GAIN);
Al->SetAccessor(String::NewSymbol("MAX_GAIN"), GetAL_MAX_GAIN);
Al->SetAccessor(String::NewSymbol("ORIENTATION"), GetAL_ORIENTATION);
Al->SetAccessor(String::NewSymbol("SOURCE_STATE"), GetAL_SOURCE_STATE);
Al->SetAccessor(String::NewSymbol("INITIAL"), GetAL_INITIAL);
Al->SetAccessor(String::NewSymbol("PLAYING"), GetAL_PLAYING);
Al->SetAccessor(String::NewSymbol("PAUSED"), GetAL_PAUSED);
Al->SetAccessor(String::NewSymbol("STOPPED"), GetAL_STOPPED);
Al->SetAccessor(String::NewSymbol("BUFFERS_QUEUED"), GetAL_BUFFERS_QUEUED);
Al->SetAccessor(String::NewSymbol("BUFFERS_PROCESSED"), GetAL_BUFFERS_PROCESSED);
Al->SetAccessor(String::NewSymbol("SEC_OFFSET"), GetAL_SEC_OFFSET);
Al->SetAccessor(String::NewSymbol("SAMPLE_OFFSET"), GetAL_SAMPLE_OFFSET);
Al->SetAccessor(String::NewSymbol("BYTE_OFFSET"), GetAL_BYTE_OFFSET);
Al->SetAccessor(String::NewSymbol("SOURCE_TYPE"), GetAL_SOURCE_TYPE);
Al->SetAccessor(String::NewSymbol("STATIC"), GetAL_STATIC);
Al->SetAccessor(String::NewSymbol("STREAMING"), GetAL_STREAMING);
Al->SetAccessor(String::NewSymbol("UNDETERMINED"), GetAL_UNDETERMINED);
Al->SetAccessor(String::NewSymbol("FORMAT_MONO8"), GetAL_FORMAT_MONO8);
Al->SetAccessor(String::NewSymbol("FORMAT_MONO16"), GetAL_FORMAT_MONO16);
Al->SetAccessor(String::NewSymbol("FORMAT_STEREO8"), GetAL_FORMAT_STEREO8);
Al->SetAccessor(String::NewSymbol("FORMAT_STEREO16"), GetAL_FORMAT_STEREO16);
Al->SetAccessor(String::NewSymbol("REFERENCE_DISTANCE"), GetAL_REFERENCE_DISTANCE);
Al->SetAccessor(String::NewSymbol("ROLLOFF_FACTOR"), GetAL_ROLLOFF_FACTOR);
Al->SetAccessor(String::NewSymbol("CONE_OUTER_GAIN"), GetAL_CONE_OUTER_GAIN);
Al->SetAccessor(String::NewSymbol("MAX_DISTANCE"), GetAL_MAX_DISTANCE);
Al->SetAccessor(String::NewSymbol("FREQUENCY"), GetAL_FREQUENCY);
Al->SetAccessor(String::NewSymbol("BITS"), GetAL_BITS);
Al->SetAccessor(String::NewSymbol("CHANNELS"), GetAL_CHANNELS);
Al->SetAccessor(String::NewSymbol("SIZE"), GetAL_SIZE);
Al->SetAccessor(String::NewSymbol("UNUSED"), GetAL_UNUSED);
Al->SetAccessor(String::NewSymbol("PENDING"), GetAL_PENDING);
Al->SetAccessor(String::NewSymbol("PROCESSED"), GetAL_PROCESSED);
Al->SetAccessor(String::NewSymbol("NO_ERROR"), GetAL_NO_ERROR);
Al->SetAccessor(String::NewSymbol("INVALID_NAME"), GetAL_INVALID_NAME);
Al->SetAccessor(String::NewSymbol("INVALID_ENUM"), GetAL_INVALID_ENUM);
Al->SetAccessor(String::NewSymbol("INVALID_VALUE"), GetAL_INVALID_VALUE);
Al->SetAccessor(String::NewSymbol("INVALID_OPERATION"), GetAL_INVALID_OPERATION);
Al->SetAccessor(String::NewSymbol("OUT_OF_MEMORY"), GetAL_OUT_OF_MEMORY);
Al->SetAccessor(String::NewSymbol("VENDOR"), GetAL_VENDOR);
Al->SetAccessor(String::NewSymbol("VERSION"), GetAL_VERSION);
Al->SetAccessor(String::NewSymbol("RENDERER"), GetAL_RENDERER);
Al->SetAccessor(String::NewSymbol("EXTENSIONS"), GetAL_EXTENSIONS);
Al->SetAccessor(String::NewSymbol("DOPPLER_FACTOR"), GetAL_DOPPLER_FACTOR);
Al->SetAccessor(String::NewSymbol("DOPPLER_VELOCITY"), GetAL_DOPPLER_VELOCITY);
Al->SetAccessor(String::NewSymbol("SPEED_OF_SOUND"), GetAL_SPEED_OF_SOUND);
Al->SetAccessor(String::NewSymbol("DISTANCE_MODEL"), GetAL_DISTANCE_MODEL);
Al->SetAccessor(String::NewSymbol("INVERSE_DISTANCE"), GetAL_INVERSE_DISTANCE);
Al->SetAccessor(String::NewSymbol("INVERSE_DISTANCE_CLAMPED"), GetAL_INVERSE_DISTANCE_CLAMPED);
Al->SetAccessor(String::NewSymbol("LINEAR_DISTANCE"), GetAL_LINEAR_DISTANCE);
Al->SetAccessor(String::NewSymbol("LINEAR_DISTANCE_CLAMPED"), GetAL_LINEAR_DISTANCE_CLAMPED);
Al->SetAccessor(String::NewSymbol("EXPONENT_DISTANCE"), GetAL_EXPONENT_DISTANCE);
Al->SetAccessor(String::NewSymbol("EXPONENT_DISTANCE_CLAMPED"), GetAL_EXPONENT_DISTANCE_CLAMPED);
Al->Set(String::NewSymbol("enable"), FunctionTemplate::New(ALEnableCallback));
Al->Set(String::NewSymbol("disable"), FunctionTemplate::New(ALDisableCallback));
Al->Set(String::NewSymbol("isEnabled"), FunctionTemplate::New(ALIsEnabledCallback));
Al->Set(String::NewSymbol("getBoolean"), FunctionTemplate::New(ALGetBooleanCallback));
Al->Set(String::NewSymbol("getInteger"), FunctionTemplate::New(ALGetIntegerCallback));
Al->Set(String::NewSymbol("getFloat"), FunctionTemplate::New(ALGetFloatCallback));
Al->Set(String::NewSymbol("getDouble"), FunctionTemplate::New(ALGetDoubleCallback));
Al->Set(String::NewSymbol("getError"), FunctionTemplate::New(ALGetErrorCallback));
Al->Set(String::NewSymbol("isSource"), FunctionTemplate::New(ALIsSourceCallback));
Al->Set(String::NewSymbol("sourcePlay"), FunctionTemplate::New(ALSourcePlayCallback));
Al->Set(String::NewSymbol("sourceStop"), FunctionTemplate::New(ALSourceStopCallback));
Al->Set(String::NewSymbol("sourceRewind"), FunctionTemplate::New(ALSourceRewindCallback));
Al->Set(String::NewSymbol("sourcePause"), FunctionTemplate::New(ALSourcePauseCallback));
Al->Set(String::NewSymbol("isBuffer"), FunctionTemplate::New(ALIsBufferCallback));
Al->Set(String::NewSymbol("dopplerFactor"), FunctionTemplate::New(ALDopplerFactorCallback));
Al->Set(String::NewSymbol("dopplerVelocity"), FunctionTemplate::New(ALDopplerVelocityCallback));
Al->Set(String::NewSymbol("speedOfSound"), FunctionTemplate::New(ALSpeedOfSoundCallback));
Al->Set(String::NewSymbol("distanceModel"), FunctionTemplate::New(ALDistanceModelCallback));
// Again, return the result through the current handle scope.
return handle_scope.Close(Al);
}
示例11: context_scope
void CanvasContextV8Bindings::loadScript(const std::string& _filename, OgreCanvas::CanvasContext* _canvasContext, OgreCanvas::CanvasLogger* _console)
{
CanvasContextV8Bindings::context2D = _canvasContext;
HandleScope handle_scope;
//Console :
//template
Handle<FunctionTemplate> consoleTemplate = FunctionTemplate::New();
consoleTemplate->SetClassName(v8::String::New("Console"));
CanvasContextV8Bindings::consoleTemplate = Persistent<FunctionTemplate>::New(consoleTemplate);
//prototype
Handle<ObjectTemplate> consolePrototype = consoleTemplate->PrototypeTemplate();
//attaching method
consolePrototype->Set("log", FunctionTemplate::New(log));
//creating instance
Handle<ObjectTemplate> consoleInstance = consoleTemplate->InstanceTemplate();
consoleInstance->SetInternalFieldCount(1);
//Image :
//template
Handle<FunctionTemplate> imageTemplate = FunctionTemplate::New();
imageTemplate->SetClassName(v8::String::New("Image"));
CanvasContextV8Bindings::imageTemplate = Persistent<FunctionTemplate>::New(imageTemplate);
//prototype
Handle<ObjectTemplate> imagePrototype = imageTemplate->PrototypeTemplate();
//creating instance
Handle<ObjectTemplate> imageInstance = imageTemplate->InstanceTemplate();
imageInstance->SetInternalFieldCount(1);
//Canvas gradient :
//template
Handle<FunctionTemplate> canvasGradientTemplate = FunctionTemplate::New();
canvasGradientTemplate->SetClassName(v8::String::New("CanvasGradient"));
CanvasContextV8Bindings::canvasGradientTemplate = Persistent<FunctionTemplate>::New(canvasGradientTemplate);
//prototype
Handle<ObjectTemplate> canvasGradientPrototype = canvasGradientTemplate->PrototypeTemplate();
//creating instance
Handle<ObjectTemplate> canvasGradientInstance = canvasGradientTemplate->InstanceTemplate();
canvasGradientInstance->SetInternalFieldCount(1);
//attaching method
canvasGradientPrototype->Set("addColorStop", FunctionTemplate::New(addColorStop));
//Canvas Pattern :
//template
Handle<FunctionTemplate> canvasPatternTemplate = FunctionTemplate::New();
canvasPatternTemplate->SetClassName(v8::String::New("CanvasPattern"));
CanvasContextV8Bindings::canvasPatternTemplate = Persistent<FunctionTemplate>::New(canvasPatternTemplate);
//prototype
Handle<ObjectTemplate> canvasPatternPrototype = canvasPatternTemplate->PrototypeTemplate();
//creating instance
Handle<ObjectTemplate> canvasPatternInstance = canvasPatternTemplate->InstanceTemplate();
canvasPatternInstance->SetInternalFieldCount(1);
//Canvas context :
//template
Handle<FunctionTemplate> canvasContextTemplate = FunctionTemplate::New();
canvasContextTemplate->SetClassName(v8::String::New("CanvasContext"));
//prototype
Handle<ObjectTemplate> canvasContextPrototype = canvasContextTemplate->PrototypeTemplate();
//attaching method
//2D Context
canvasContextPrototype->Set("save", FunctionTemplate::New(save));
canvasContextPrototype->Set("restore", FunctionTemplate::New(restore));
//Transformation
canvasContextPrototype->Set("scale", FunctionTemplate::New(scale));
canvasContextPrototype->Set("rotate", FunctionTemplate::New(rotate));
canvasContextPrototype->Set("translate", FunctionTemplate::New(translate));
canvasContextPrototype->Set("transform", FunctionTemplate::New(transform));
canvasContextPrototype->Set("setTransform", FunctionTemplate::New(setTransform));
//Image drawing
canvasContextPrototype->Set("drawImage", FunctionTemplate::New(drawImage));
//Colors, styles and shadows
canvasContextPrototype->Set("createLinearGradient", FunctionTemplate::New(createLinearGradient));
canvasContextPrototype->Set("createRadialGradient", FunctionTemplate::New(createRadialGradient));
canvasContextPrototype->Set("createPattern", FunctionTemplate::New(createPattern));
//Paths
canvasContextPrototype->Set("beginPath", FunctionTemplate::New(beginPath));
//.........这里部分代码省略.........