当前位置: 首页>>代码示例>>C++>>正文


C++ ARGS_TYPE::This方法代码示例

本文整理汇总了C++中ARGS_TYPE::This方法的典型用法代码示例。如果您正苦于以下问题:C++ ARGS_TYPE::This方法的具体用法?C++ ARGS_TYPE::This怎么用?C++ ARGS_TYPE::This使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ARGS_TYPE的用法示例。


在下文中一共展示了ARGS_TYPE::This方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: WriteLiteralStringValue

METHOD_RETURN_TYPE DictionaryContextDriver::WriteLiteralStringValue(const ARGS_TYPE& args)
{
	CREATE_ISOLATE_CONTEXT;
	CREATE_ESCAPABLE_SCOPE;

    if(!(args.Length() == 1) ||
       (!args[0]->IsString() && !args[0]->IsArray()))
    {
		THROW_EXCEPTION("wrong arguments, pass 1 argument that is a literal string (string) or an array");
		SET_FUNCTION_RETURN_VALUE(UNDEFINED);
        
    }

    DictionaryContextDriver* driver = ObjectWrap::Unwrap<DictionaryContextDriver>(args.This());
    
    if(!driver->DictionaryContextInstance)
    {
		THROW_EXCEPTION("dictinoarycontext object not initialized, create using objectscontext.startDictionary");
        SET_FUNCTION_RETURN_VALUE(UNDEFINED);
    }

	if(args[0]->IsArray())
	{
		std::string string;
		unsigned long arrayLength = (args[0]->ToObject()->Get(NEW_STRING("length")))->ToObject()->Uint32Value();
		for(unsigned long i=0;i<arrayLength;++i)
			string.push_back((unsigned char)args[0]->ToObject()->Get(i)->ToNumber()->Value());
		driver->DictionaryContextInstance->WriteLiteralStringValue(string);
	}
	else
    {
		driver->DictionaryContextInstance->WriteLiteralStringValue(*String::Utf8Value(args[0]->ToString()));
	}
    SET_FUNCTION_RETURN_VALUE(args.This());
}
开发者ID:adioslabs,项目名称:HummusJS,代码行数:35,代码来源:DictionaryContextDriver.cpp

示例2: WriteNameValue

METHOD_RETURN_TYPE DictionaryContextDriver::WriteNameValue(const ARGS_TYPE& args)
{
	CREATE_ISOLATE_CONTEXT;
	CREATE_ESCAPABLE_SCOPE;

    if(!(args.Length() == 1) ||
       !args[0]->IsString())
    {
		THROW_EXCEPTION("Wrong arguments, provide a string to write");
        SET_FUNCTION_RETURN_VALUE(UNDEFINED);
        
    }
    
    DictionaryContextDriver* driver = ObjectWrap::Unwrap<DictionaryContextDriver>(args.This());
    
    if(!driver->DictionaryContextInstance)
    {
		THROW_EXCEPTION("dictinoarycontext object not initialized, create using objectscontext.startDictionary");
        SET_FUNCTION_RETURN_VALUE(UNDEFINED);
    }
    
    driver->DictionaryContextInstance->WriteNameValue(*String::Utf8Value(args[0]->ToString()));
    
    SET_FUNCTION_RETURN_VALUE(args.This());
}
开发者ID:adioslabs,项目名称:HummusJS,代码行数:25,代码来源:DictionaryContextDriver.cpp

示例3: New

METHOD_RETURN_TYPE ByteWriterWithPositionDriver::New(const ARGS_TYPE& args)
{
	CREATE_ISOLATE_CONTEXT;
	CREATE_ESCAPABLE_SCOPE;

    ByteWriterWithPositionDriver* driver = new ByteWriterWithPositionDriver();
    driver->Wrap(args.This());
	SET_FUNCTION_RETURN_VALUE(args.This());
}
开发者ID:JoshLaseter,项目名称:HummusJS,代码行数:9,代码来源:ByteWriterWithPositionDriver.cpp

示例4: New

METHOD_RETURN_TYPE PDFNullDriver::New(const ARGS_TYPE& args)
{
    CREATE_ISOLATE_CONTEXT;
	CREATE_ESCAPABLE_SCOPE;
    
    PDFNullDriver* driver = new PDFNullDriver();
    driver->Wrap(args.This());
	SET_FUNCTION_RETURN_VALUE(args.This());
}
开发者ID:JoshLaseter,项目名称:HummusJS,代码行数:9,代码来源:PDFNullDriver.cpp

示例5: New

METHOD_RETURN_TYPE DocumentContextDriver::New(const ARGS_TYPE& args)
{
	CREATE_ISOLATE_CONTEXT;
	CREATE_ESCAPABLE_SCOPE;

    DocumentContextDriver* objectsContext = new DocumentContextDriver();
    objectsContext->Wrap(args.This());
    
    SET_FUNCTION_RETURN_VALUE(args.This());
}
开发者ID:JoshLaseter,项目名称:HummusJS,代码行数:10,代码来源:DocumentContextDriver.cpp

示例6: New

METHOD_RETURN_TYPE PDFRealDriver::New(const ARGS_TYPE& args)
{
    CREATE_ISOLATE_CONTEXT;
	CREATE_ESCAPABLE_SCOPE;
    EXPOSE_EXTERNAL_ARGS(ConstructorsHolder, externalHolder)
    PDFRealDriver* driver = new PDFRealDriver();
	driver->holder = externalHolder;
    driver->Wrap(args.This());
	SET_FUNCTION_RETURN_VALUE( args.This())
}
开发者ID:galkahana,项目名称:HummusJS,代码行数:10,代码来源:PDFRealDriver.cpp

示例7: New

METHOD_RETURN_TYPE ResourcesDictionaryDriver::New(const ARGS_TYPE& args)
{
    CREATE_ISOLATE_CONTEXT;
    CREATE_ESCAPABLE_SCOPE;

    ResourcesDictionaryDriver* form = new ResourcesDictionaryDriver();
    form->Wrap(args.This());

    SET_FUNCTION_RETURN_VALUE(args.This());
}
开发者ID:n9niwas,项目名称:HummusJS,代码行数:10,代码来源:ResourcesDictionaryDriver.cpp

示例8: New

METHOD_RETURN_TYPE DictionaryContextDriver::New(const ARGS_TYPE& args)
{
	CREATE_ISOLATE_CONTEXT;
	CREATE_ESCAPABLE_SCOPE;

    DictionaryContextDriver* driver = new DictionaryContextDriver();
    driver->Wrap(args.This());
    
	SET_FUNCTION_RETURN_VALUE(args.This());
}
开发者ID:adioslabs,项目名称:HummusJS,代码行数:10,代码来源:DictionaryContextDriver.cpp

示例9: WriteRectangleValue

METHOD_RETURN_TYPE DictionaryContextDriver::WriteRectangleValue(const ARGS_TYPE& args)
{
	CREATE_ISOLATE_CONTEXT;
	CREATE_ESCAPABLE_SCOPE;

    // can accept array or four numbers
    if( (args.Length() != 1 && args.Length() != 4) ||
       (args.Length() == 1 && !args[0]->IsArray()) ||
       (args.Length() == 4 && (!args[0]->IsNumber() || !args[1]->IsNumber() || !args[2]->IsNumber() || !args[3]->IsNumber())))
    {
		THROW_EXCEPTION("Wrong arguments, provide an array of 4 numbers, or 4 numbers");
        SET_FUNCTION_RETURN_VALUE(UNDEFINED);
        
    }
    
    DictionaryContextDriver* driver = ObjectWrap::Unwrap<DictionaryContextDriver>(args.This());
    
    if(!driver->DictionaryContextInstance)
    {
		THROW_EXCEPTION("dictinoarycontext object not initialized, create using objectscontext.startDictionary");
        SET_FUNCTION_RETURN_VALUE(UNDEFINED);
    }
    
    if(args.Length() == 1)
    {
        // array version. verify that there are 4 numbers
        if(args[0]->ToObject()->Get(NEW_STRING("length"))->ToObject()->Uint32Value() != 4)
        {
            THROW_EXCEPTION("Wrong arguments, provide an array of 4 numbers, or 4 numbers");
            SET_FUNCTION_RETURN_VALUE(UNDEFINED);
        }
        
        driver->DictionaryContextInstance->WriteRectangleValue(PDFRectangle(
                                                      args[0]->ToObject()->Get(0)->ToNumber()->Value(),
                                                      args[0]->ToObject()->Get(1)->ToNumber()->Value(),
                                                      args[0]->ToObject()->Get(2)->ToNumber()->Value(),
                                                      args[0]->ToObject()->Get(3)->ToNumber()->Value()));
        
    }
    else
    {
        // 4 numbers version
        driver->DictionaryContextInstance->WriteRectangleValue(PDFRectangle(
                                                                            args[0]->ToNumber()->Value(),
                                                                            args[1]->ToNumber()->Value(),
                                                                            args[2]->ToNumber()->Value(),
                                                                            args[3]->ToNumber()->Value()));
    }
    
    
    SET_FUNCTION_RETURN_VALUE(args.This());
}
开发者ID:adioslabs,项目名称:HummusJS,代码行数:52,代码来源:DictionaryContextDriver.cpp

示例10: New

METHOD_RETURN_TYPE InputFileDriver::New(const ARGS_TYPE& args)
{
    CREATE_ISOLATE_CONTEXT;
	CREATE_ESCAPABLE_SCOPE;
    
    InputFileDriver* inputFile = new InputFileDriver();
    
    if(args.Length() == 1 && args[0]->IsString())
        inputFile->OpenFile(*String::Utf8Value(args[0]->ToString()));
    
    inputFile->Wrap(args.This());
	SET_FUNCTION_RETURN_VALUE(args.This());
}
开发者ID:JoshLaseter,项目名称:HummusJS,代码行数:13,代码来源:InputFileDriver.cpp

示例11: New

METHOD_RETURN_TYPE InputFileDriver::New(const ARGS_TYPE& args)
{
    CREATE_ISOLATE_CONTEXT;
	CREATE_ESCAPABLE_SCOPE;
    EXPOSE_EXTERNAL_ARGS(ConstructorsHolder, externalHolder)
    
    InputFileDriver* inputFile = new InputFileDriver();

    inputFile->holder = externalHolder;
    
    if(args.Length() == 1 && args[0]->IsString())
        inputFile->OpenFile(*UTF_8_VALUE(args[0]->TO_STRING()));
    
    inputFile->Wrap(args.This());
	SET_FUNCTION_RETURN_VALUE(args.This())
}
开发者ID:galkahana,项目名称:HummusJS,代码行数:16,代码来源:InputFileDriver.cpp

示例12: GetInputStream

METHOD_RETURN_TYPE InputFileDriver::GetInputStream(const ARGS_TYPE& args)
{
    CREATE_ISOLATE_CONTEXT;
	CREATE_ESCAPABLE_SCOPE;
    
    InputFileDriver* driver = ObjectWrap::Unwrap<InputFileDriver>(args.This());
    
    if(!driver)
    {
		THROW_EXCEPTION("no driver created...please create one through Hummus");
        SET_FUNCTION_RETURN_VALUE(UNDEFINED);
        
    }
    
    if(driver->mInputFileInstance && driver->mInputFileInstance->GetInputStream())
    {
        Handle<Value> result = ByteReaderWithPositionDriver::GetNewInstance(args);
        
        ObjectWrap::Unwrap<ByteReaderWithPositionDriver>(result->ToObject())->SetStream(driver->mInputFileInstance->GetInputStream(), false);
        
        SET_FUNCTION_RETURN_VALUE(result);
    }
    else
        SET_FUNCTION_RETURN_VALUE(UNDEFINED);
    
}
开发者ID:JoshLaseter,项目名称:HummusJS,代码行数:26,代码来源:InputFileDriver.cpp

示例13: QueryObject

METHOD_RETURN_TYPE PDFDictionaryDriver::QueryObject(const ARGS_TYPE& args)
{
    CREATE_ISOLATE_CONTEXT;
	CREATE_ESCAPABLE_SCOPE;
    
    if(args.Length() != 1 || !args[0]->IsString())
    {
		THROW_EXCEPTION("wrong arguments, pass 1 argument which is a string key");
		SET_FUNCTION_RETURN_VALUE(UNDEFINED);
        
    }
    
    std::string key = *String::Utf8Value(args[0]->ToString());

    PDFDictionaryDriver* driver = ObjectWrap::Unwrap<PDFDictionaryDriver>(args.This());
    
    if(!driver->TheObject->Exists(key))
    {
		THROW_EXCEPTION("key not found");
		SET_FUNCTION_RETURN_VALUE(UNDEFINED);
    }
    
    RefCountPtr<PDFObject> anObject = driver->TheObject->QueryDirectObject(key);
    Handle<Value> result = PDFObjectDriver::CreateDriver(anObject.GetPtr());
    
    SET_FUNCTION_RETURN_VALUE(result);
}
开发者ID:JoshLaseter,项目名称:HummusJS,代码行数:27,代码来源:PDFDictionaryDriver.cpp

示例14: OpenFile

METHOD_RETURN_TYPE InputFileDriver::OpenFile(const ARGS_TYPE& args)
{
    CREATE_ISOLATE_CONTEXT;
	CREATE_ESCAPABLE_SCOPE;
 
    if(args.Length() != 1 || !args[0]->IsString())
    {
		THROW_EXCEPTION("wrong arguments. please provide a string for the file path");
        SET_FUNCTION_RETURN_VALUE(UNDEFINED);
    }

    InputFileDriver* driver = ObjectWrap::Unwrap<InputFileDriver>(args.This());

    
    if(!driver)
    {
		THROW_EXCEPTION("no driver created...please create one through Hummus");
        SET_FUNCTION_RETURN_VALUE(UNDEFINED);
        
    }
    
    if(driver->OpenFile(*String::Utf8Value(args[0]->ToString())) != PDFHummus::eSuccess)
    {
		THROW_EXCEPTION("can't open file. make sure path exists");
        SET_FUNCTION_RETURN_VALUE(UNDEFINED);
    }
    
    SET_FUNCTION_RETURN_VALUE(UNDEFINED);
}
开发者ID:JoshLaseter,项目名称:HummusJS,代码行数:29,代码来源:InputFileDriver.cpp

示例15: Read

METHOD_RETURN_TYPE ByteReaderDriver::Read(const ARGS_TYPE& args)
{
	CREATE_ISOLATE_CONTEXT;
	CREATE_ESCAPABLE_SCOPE;

    // k. i'll just read the number of bytes and return an array of them
    if(args.Length() != 1 ||
       !args[0]->IsNumber())
    {
		THROW_EXCEPTION("Wrong arguments. pass the number of bytes to read");
        SET_FUNCTION_RETURN_VALUE(UNDEFINED);
    }
    
    ByteReaderDriver* element = ObjectWrap::Unwrap<ByteReaderDriver>(args.This());
    IOBasicTypes::LongBufferSizeType bufferSize = args[0]->ToNumber()->Uint32Value();
    Byte* buffer = new Byte[bufferSize];
    
    bufferSize = element->mInstance->Read(buffer,(int)bufferSize); // reading int cause that's the maximum that can read (use should read till notended anyways)

    Local<Array> outBuffer = NEW_ARRAY((int)bufferSize);
    
    for(LongBufferSizeType i=0;i<bufferSize;++i)
		outBuffer->Set(NEW_NUMBER(i), NEW_NUMBER(buffer[i]));
    
    delete[] buffer;
    
    SET_FUNCTION_RETURN_VALUE(outBuffer);
}
开发者ID:JoshLaseter,项目名称:HummusJS,代码行数:28,代码来源:ByteReaderDriver.cpp


注:本文中的ARGS_TYPE::This方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。