本文整理汇总了C++中Arguments::Holder方法的典型用法代码示例。如果您正苦于以下问题:C++ Arguments::Holder方法的具体用法?C++ Arguments::Holder怎么用?C++ Arguments::Holder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Arguments
的用法示例。
在下文中一共展示了Arguments::Holder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ODBCStatement
Handle<Value> ODBCStatement::New(const Arguments& args) {
DEBUG_PRINTF("ODBCStatement::New\n");
HandleScope scope;
REQ_EXT_ARG(0, js_henv);
REQ_EXT_ARG(1, js_hdbc);
REQ_EXT_ARG(2, js_hstmt);
HENV hENV = static_cast<HENV>(js_henv->Value());
HDBC hDBC = static_cast<HDBC>(js_hdbc->Value());
HSTMT hSTMT = static_cast<HSTMT>(js_hstmt->Value());
//create a new OBCResult object
ODBCStatement* stmt = new ODBCStatement(hENV, hDBC, hSTMT);
//specify the buffer length
stmt->bufferLength = MAX_VALUE_SIZE - 1;
//initialze a buffer for this object
stmt->buffer = (uint16_t *) malloc(stmt->bufferLength + 1);
//TODO: make sure the malloc succeeded
//set the initial colCount to 0
stmt->colCount = 0;
//initialize the paramCount
stmt->paramCount = 0;
stmt->Wrap(args.Holder());
return scope.Close(args.Holder());
}
示例2: BatchImpl_freeImpl
void BatchImpl_freeImpl(const Arguments &args) {
BatchImpl * set = unwrapPointer<BatchImpl *>(args.Holder());
delete set;
set = 0;
wrapPointerInObject(set, BatchImplEnvelope, args.Holder());
args.GetReturnValue().SetUndefined();
}
示例3:
v8::Handle<v8::Value> InputSystem_v8::New(const Arguments &args) {
HandleScope scope;
new InputSystem_v8(args.Holder());
return args.Holder();
}
示例4: ODBC
Handle<Value> ODBC::New(const Arguments& args) {
DEBUG_PRINTF("ODBC::New\n");
HandleScope scope;
ODBC* dbo = new ODBC();
dbo->Wrap(args.Holder());
dbo->m_hEnv = NULL;
uv_mutex_lock(&ODBC::g_odbcMutex);
int ret = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &dbo->m_hEnv);
uv_mutex_unlock(&ODBC::g_odbcMutex);
if (!SQL_SUCCEEDED(ret)) {
DEBUG_PRINTF("ODBC::New - ERROR ALLOCATING ENV HANDLE!!\n");
Local<Object> objError = ODBC::GetSQLError(SQL_HANDLE_ENV, dbo->m_hEnv);
ThrowException(objError);
}
SQLSetEnvAttr(dbo->m_hEnv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) SQL_OV_ODBC3, SQL_IS_UINTEGER);
return scope.Close(args.Holder());
}
示例5: assert
Handle<Value> Tail::close(const Arguments& args) {
HandleScope scope;
assert(!args.Holder().IsEmpty());
assert(args.Holder()->InternalFieldCount() > 0);
void* ptr = args.Holder()->GetPointerFromInternalField(0);
Tail* tail_instance = static_cast<Tail*>(ptr);
uv_unref(reinterpret_cast<uv_handle_t*>(&tail_instance->_event_handle));
tail_instance->Emit(end_symbol, 0, NULL);
return scope.Close(Undefined());
}
示例6: ThrowException
v8::Handle<v8::Value> Image_v8::DrawLine(const Arguments &args) {
HandleScope scope;
Image_v8 *image_v8 = ObjectWrap::Unwrap<Image_v8>(args.Holder());
if (NULL == image_v8) {
return ThrowException(v8::Exception::ReferenceError(String::NewSymbol(
"Image::drawLine(): NULL Holder."
)));
}
Handle<Array> dimensions = args[0].As<Array>();
image_v8->image->drawLine(
dimensions->Get(0)->Int32Value(),
dimensions->Get(1)->Int32Value(),
dimensions->Get(2)->Int32Value(),
dimensions->Get(3)->Int32Value(),
args[1]->Uint32Value(),
args[2]->Uint32Value(),
args[3]->Uint32Value(),
args[4]->Uint32Value(),
static_cast<Image::DrawMode>(args[5]->Uint32Value())
);
return v8::Undefined();
}
示例7: if
Handle<Value> ODBCResult::CloseSync(const Arguments& args) {
DEBUG_PRINTF("ODBCResult::CloseSync\n");
HandleScope scope;
OPT_INT_ARG(0, closeOption, SQL_DESTROY);
ODBCResult* result = ObjectWrap::Unwrap<ODBCResult>(args.Holder());
DEBUG_PRINTF("ODBCResult::CloseSync closeOption=%i m_canFreeHandle=%i\n",
closeOption, result->m_canFreeHandle);
if (closeOption == SQL_DESTROY && result->m_canFreeHandle) {
result->Free();
}
else if (closeOption == SQL_DESTROY && !result->m_canFreeHandle) {
//We technically can't free the handle so, we'll SQL_CLOSE
uv_mutex_lock(&ODBC::g_odbcMutex);
SQLFreeStmt(result->m_hSTMT, SQL_CLOSE);
uv_mutex_unlock(&ODBC::g_odbcMutex);
}
else {
uv_mutex_lock(&ODBC::g_odbcMutex);
SQLFreeStmt(result->m_hSTMT, closeOption);
uv_mutex_unlock(&ODBC::g_odbcMutex);
}
return scope.Close(True());
}
示例8: GetJNIEnvironmentError
Handle<Value> Proxy::hasListenersForEventType(const Arguments& args)
{
JNIEnv* env = JNIScope::getEnv();
if (!env) {
return JSException::GetJNIEnvironmentError();
}
Proxy* proxy = NativeObject::Unwrap<Proxy>(args.Holder());
Local<String> eventType = args[0]->ToString();
Local<Boolean> hasListeners = args[1]->ToBoolean();
jobject javaProxy = proxy->getJavaObject();
jobject krollObject = env->GetObjectField(javaProxy, JNIUtil::krollProxyKrollObjectField);
jstring javaEventType = TypeConverter::jsStringToJavaString(eventType);
if (!JavaObject::useGlobalRefs) {
env->DeleteLocalRef(javaProxy);
}
env->CallVoidMethod(krollObject,
JNIUtil::krollObjectSetHasListenersForEventTypeMethod,
javaEventType,
TypeConverter::jsBooleanToJavaBoolean(hasListeners));
env->DeleteLocalRef(krollObject);
env->DeleteLocalRef(javaEventType);
return Undefined();
}
示例9: NodeCallback
Handle<Value> Texture::LoadFile(const Arguments &args)
{
HandleScope scope;
if (args[0]->IsString()) {
Texture *texture = ObjectWrap::Unwrap<Texture>(args.This());
if (args[1]->IsFunction()) {
if (!texture->load_finished_cb) {
texture->load_finished_cb = new NodeCallback();
} else {
texture->load_finished_cb->Holder.Dispose();
texture->load_finished_cb->cb.Dispose();
}
texture->load_finished_cb->Holder = Persistent<Object>::New(args.Holder());
texture->load_finished_cb->cb = Persistent<Function>::New(Handle<Function>::Cast(args[1]));
Texture::_LoadFile(texture, *String::Utf8Value(args[0]->ToString()), TRUE);
} else {
Texture::_LoadFile(texture, *String::Utf8Value(args[0]->ToString()), FALSE);
}
}
return args.This();
}
示例10: SQLExecute
Handle<Value> ODBCStatement::ExecuteSync(const Arguments& args) {
DEBUG_PRINTF("ODBCStatement::ExecuteSync\n");
HandleScope scope;
ODBCStatement* stmt = ObjectWrap::Unwrap<ODBCStatement>(args.Holder());
SQLRETURN ret = SQLExecute(stmt->m_hSTMT);
if(ret == SQL_ERROR) {
ThrowException(ODBC::GetSQLError(
SQL_HANDLE_STMT,
stmt->m_hSTMT,
(char *) "[node-odbc] Error in ODBCStatement::ExecuteSync"
));
return scope.Close(Null());
}
else {
Local<Value> args[3];
bool* canFreeHandle = new bool(false);
args[0] = External::New(stmt->m_hENV);
args[1] = External::New(stmt->m_hDBC);
args[2] = External::New(stmt->m_hSTMT);
args[3] = External::New(canFreeHandle);
Local<Object> js_result(ODBCResult::constructor_template->
GetFunction()->NewInstance(4, args));
return scope.Close(js_result);
}
}
示例11: sizeof
Handle<Value> ODBCStatement::ExecuteNonQuery(const Arguments& args) {
DEBUG_PRINTF("ODBCStatement::ExecuteNonQuery\n");
HandleScope scope;
REQ_FUN_ARG(0, cb);
ODBCStatement* stmt = ObjectWrap::Unwrap<ODBCStatement>(args.Holder());
uv_work_t* work_req = (uv_work_t *) (calloc(1, sizeof(uv_work_t)));
execute_work_data* data =
(execute_work_data *) calloc(1, sizeof(execute_work_data));
data->cb = Persistent<Function>::New(cb);
data->stmt = stmt;
work_req->data = data;
uv_queue_work(
uv_default_loop(),
work_req,
UV_ExecuteNonQuery,
(uv_after_work_cb)UV_AfterExecuteNonQuery);
stmt->Ref();
return scope.Close(Undefined());
}
示例12: TxtRecordRef
Handle<Value>
TxtRecordRef::New(const Arguments & args) {
HandleScope scope;
TxtRecordRef * o = new TxtRecordRef();
o->Wrap(args.Holder());
return args.This();
}
示例13: SQLFreeStmt
Handle<Value> ODBCStatement::CloseSync(const Arguments& args) {
DEBUG_PRINTF("ODBCStatement::CloseSync\n");
HandleScope scope;
OPT_INT_ARG(0, closeOption, SQL_DESTROY);
ODBCStatement* stmt = ObjectWrap::Unwrap<ODBCStatement>(args.Holder());
DEBUG_PRINTF("ODBCStatement::CloseSync closeOption=%i\n",
closeOption);
if (closeOption == SQL_DESTROY) {
stmt->Free();
}
else {
uv_mutex_lock(&ODBC::g_odbcMutex);
SQLFreeStmt(stmt->m_hSTMT, closeOption);
uv_mutex_unlock(&ODBC::g_odbcMutex);
}
return scope.Close(True());
}
示例14: queryGetResult
// getResult(id, objectWrapper): IMMEDIATE
void queryGetResult(const Arguments & args) {
REQUIRE_ARGS_LENGTH(2);
v8::Isolate * isolate = args.GetIsolate();
QueryOperation * op = unwrapPointer<QueryOperation *>(args.Holder());
size_t id = args[0]->Uint32Value();
Handle<Object> wrapper = args[1]->ToObject();
QueryResultHeader * header = op->getResult(id);
if(header) {
if(header->data) {
wrapper->Set(GET_KEY(K_data),
LOCAL_BUFFER(node::Buffer::New(isolate, header->data,
op->getResultRowSize(header->depth),
doNotFreeQueryResultAtGC, 0)));
} else {
wrapper->Set(GET_KEY(K_data), Null(isolate));
}
wrapper->Set(GET_KEY(K_level), v8::Uint32::New(isolate, header->depth));
wrapper->Set(GET_KEY(K_tag), v8::Uint32::New(isolate, header->tag));
args.GetReturnValue().Set(true);
} else {
args.GetReturnValue().Set(false);
}
}
示例15: SQLAllocHandle
Handle<Value> ODBC::CreateConnectionSync(const Arguments& args) {
DEBUG_PRINTF("ODBC::CreateConnectionSync\n");
HandleScope scope;
ODBC* dbo = ObjectWrap::Unwrap<ODBC>(args.Holder());
HDBC hDBC;
uv_mutex_lock(&ODBC::g_odbcMutex);
//allocate a new connection handle
SQLRETURN ret = SQLAllocHandle(SQL_HANDLE_DBC, dbo->m_hEnv, &hDBC);
if (!SQL_SUCCEEDED(ret)) {
//TODO: do something!
}
uv_mutex_unlock(&ODBC::g_odbcMutex);
Local<Value> params[2];
params[0] = External::New(dbo->m_hEnv);
params[1] = External::New(hDBC);
Local<Object> js_result(ODBCConnection::constructor_template->
GetFunction()->NewInstance(2, params));
return scope.Close(js_result);
}