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


C++ prototype函数代码示例

本文整理汇总了C++中prototype函数的典型用法代码示例。如果您正苦于以下问题:C++ prototype函数的具体用法?C++ prototype怎么用?C++ prototype使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: isStillLive

bool PropertyCondition::isStillLive() const
{
    if (hasPrototype() && prototype() && !Heap::isMarked(prototype()))
        return false;
    
    if (hasRequiredValue()
        && requiredValue()
        && requiredValue().isCell()
        && !Heap::isMarked(requiredValue().asCell()))
        return false;
    
    return true;
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:13,代码来源:PropertyCondition.cpp

示例2: serverinit

int serverinit(const char *addr, const char *port, const char *proto)
{
    struct sockaddr_in socketaddr;
    int mastersock;
    int trueval = 1;
    struct hostent *hostinfo;
    unsigned long ip;

    socketaddr_init(&socketaddr);

    if (NULL == addr) {
        socketaddr.sin_addr.s_addr = INADDR_ANY;
    } else {
        if (scanaddr(addr, &ip, NULL) != 4) {
            LFATAL("Invalid address : %s provided", addr);
            return -1;
        }
        hostinfo = gethostbyaddr((char *) &ip, 4, AF_INET);
        if (NULL == hostinfo) {
            LFATAL("gethostbyaddr : %s failed", addr);
            return -1;
        }
        socketaddr.sin_addr = *(struct in_addr *) *hostinfo->h_addr_list;
    }
    socketaddr_service(&socketaddr, port, proto);

    mastersock = socket(PF_INET, prototype(proto), resolveproto(proto));
    if (mastersock < 0) {
        LFATAL("couldn't create socket");
        return -1;
    }

    if (bind
        (mastersock, (struct sockaddr *) &socketaddr,
         sizeof(socketaddr)) < 0) {
        return -1;
    }

    setsockopt(mastersock, SOL_SOCKET, SO_REUSEADDR, &trueval,
               sizeof(trueval));

    if (prototype(proto) == SOCK_STREAM) {
        if (listen(mastersock, 5) < 0) {
            LFATAL("listen on port %d failed", socketaddr.sin_port);
            return -1;
        }
    }
    return mastersock;
}
开发者ID:chineseneo,项目名称:lessfs,代码行数:49,代码来源:lib_net.c

示例3: getDisplayModeBufferSize

bool DeckLinkController::startExportWithMode(BMDDisplayMode videoMode) {
    int bufferSize = getDisplayModeBufferSize(videoMode);
    
    if(bufferSize != 0) {
        vector<unsigned char> prototype(bufferSize);
        buffer.setup(prototype);
    } else{
        ofLogError("DeckLinkController") << "DeckLinkController needs to be updated to support that mode.";
        return false;
    }
    
    BMDVideoInputFlags videoOutputFlags;
    
    // Enable input video mode detection if the device supports it
    videoOutputFlags = bmdVideoOutputFlagDefault;
    
//    // Set capture callback
//    deckLinkInput->SetCallback(this);
    
    // Enable the video output mode
    if (deckLinkOutput->EnableVideoOutput(videoMode, videoOutputFlags) != S_OK) {
        ofLogError("DeckLinkController") << "This application was unable to select the chosen video mode. Perhaps, the selected device is currently in-use.";
        return false;
    }
    
//    // Start the output
//    if (deckLinkOutput->Ena() != S_OK) {
//        ofLogError("DeckLinkController") << "This application was unable to start the capture. Perhaps, the selected device is currently in-use.";
//        return false;
//    }
//    
//    currentlyCapturing = true;
    
    return true;
}
开发者ID:genosyde,项目名称:ofxBlackmagic,代码行数:35,代码来源:DeckLinkController.cpp

示例4: ASSERT

void JSGlobalObject::init(JSObject* thisValue)
{
    ASSERT(JSLock::currentThreadIsHoldingLock());

    structure()->disableSpecificFunctionTracking();

    d()->globalData = Heap::heap(this)->globalData();
    d()->globalScopeChain = ScopeChain(this, d()->globalData.get(), this, thisValue);

    JSGlobalObject::globalExec()->init(0, 0, d()->globalScopeChain.node(), CallFrame::noCaller(), 0, 0);

    if (JSGlobalObject*& headObject = head()) {
        d()->prev = headObject;
        d()->next = headObject->d()->next;
        headObject->d()->next->d()->prev = this;
        headObject->d()->next = this;
    } else
        headObject = d()->next = d()->prev = this;

    d()->debugger = 0;

    d()->profileGroup = 0;

    reset(prototype());
}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:25,代码来源:JSGlobalObject.cpp

示例5: ASSERT_GC_OBJECT_INHERITS

bool JSNamedNodeMap::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
    ASSERT_GC_OBJECT_INHERITS(this, &s_info);
    JSValue proto = prototype();
    if (proto.isObject() && static_cast<JSObject*>(asObject(proto))->hasProperty(exec, propertyName))
        return false;

    const HashEntry* entry = JSNamedNodeMapTable.entry(exec, propertyName);
    if (entry) {
        PropertySlot slot;
        slot.setCustom(this, entry->propertyGetter());
        descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
        return true;
    }
    bool ok;
    unsigned index = propertyName.toUInt32(ok);
    if (ok && index < static_cast<NamedNodeMap*>(impl())->length()) {
        PropertySlot slot;
        slot.setCustomIndex(this, index, indexGetter);
        descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly);
        return true;
    }
    if (canGetItemsForName(exec, static_cast<NamedNodeMap*>(impl()), propertyName)) {
        PropertySlot slot;
        slot.setCustom(this, nameGetter);
        descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum);
        return true;
    }
    return getStaticValueDescriptor<JSNamedNodeMap, Base>(exec, &JSNamedNodeMapTable, this, propertyName, descriptor);
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:30,代码来源:JSNamedNodeMap.cpp

示例6: RegisterPerfMeasurement

JSObject*
RegisterPerfMeasurement(JSContext *cx, JSRawObject global)
{
    js::RootedObject prototype(cx);
    prototype = JS_InitClass(cx, global, NULL /* parent */,
                             &pm_class, pm_construct, 1,
                             pm_props, pm_fns, 0, 0);
    if (!prototype)
        return 0;

    js::RootedObject ctor(cx);
    ctor = JS_GetConstructor(cx, prototype);
    if (!ctor)
        return 0;

    for (const pm_const *c = pm_consts; c->name; c++) {
        if (!JS_DefineProperty(cx, ctor, c->name, INT_TO_JSVAL(c->value),
                               JS_PropertyStub, JS_StrictPropertyStub, PM_CATTRS))
            return 0;
    }

    if (!JS_FreezeObject(cx, prototype) ||
        !JS_FreezeObject(cx, ctor)) {
        return 0;
    }

    return prototype;
}
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:28,代码来源:jsperf.cpp

示例7: test_matches

 void test_matches(const std::string& proto_key, const LLSD& possibles,
                   const char** begin, const char** end)
 {
     std::set<std::string> succeed(begin, end);
     LLSD prototype(possibles[proto_key]);
     for (LLSD::map_const_iterator pi(possibles.beginMap()), pend(possibles.endMap());
          pi != pend; ++pi)
     {
         std::string match(llsd_matches(prototype, pi->second));
         std::set<std::string>::const_iterator found = succeed.find(pi->first);
         if (found != succeed.end())
         {
             // This test is supposed to succeed. Comparing to the
             // empty string ensures that if the test fails, it will
             // display the string received so we can tell what failed.
             ensure_equals("match", match, "");
         }
         else
         {
             // This test is supposed to fail. If we get a false match,
             // the string 'match' will be empty, which doesn't tell us
             // much about which case went awry. So construct a more
             // detailed description string.
             ensure(proto_key + " shouldn't match " + pi->first, ! match.empty());
         }
     }
 }
开发者ID:Krazy-Bish-Margie,项目名称:Thunderstorm,代码行数:27,代码来源:llsdutil_tut.cpp

示例8: RegisterPerfMeasurement

JSObject*
RegisterPerfMeasurement(JSContext *cx, HandleObject globalArg)
{
    RootedObject global(cx, globalArg);
    RootedObject prototype(cx);
    prototype = JS_InitClass(cx, global, js::NullPtr() /* parent */,
                             &pm_class, pm_construct, 1,
                             pm_props, pm_fns, 0, 0);
    if (!prototype)
        return 0;

    RootedObject ctor(cx);
    ctor = JS_GetConstructor(cx, prototype);
    if (!ctor)
        return 0;

    for (const pm_const *c = pm_consts; c->name; c++) {
        if (!JS_DefineProperty(cx, ctor, c->name, c->value, PM_CATTRS,
                               JS_PropertyStub, JS_StrictPropertyStub))
            return 0;
    }

    if (!JS_FreezeObject(cx, prototype) ||
        !JS_FreezeObject(cx, ctor)) {
        return 0;
    }

    return prototype;
}
开发者ID:JasonGross,项目名称:mozjs,代码行数:29,代码来源:jsperf.cpp

示例9: RegisterPerfMeasurement

JSObject*
RegisterPerfMeasurement(JSContext* cx, HandleObject globalArg)
{
    static const uint8_t PM_CATTRS = JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT;

    RootedObject global(cx, globalArg);
    RootedObject prototype(cx);
    prototype = JS_InitClass(cx, global, nullptr /* parent */,
                             &pm_class, pm_construct, 1,
                             pm_props, pm_fns, 0, 0);
    if (!prototype)
        return 0;

    RootedObject ctor(cx);
    ctor = JS_GetConstructor(cx, prototype);
    if (!ctor)
        return 0;

    for (const pm_const* c = pm_consts; c->name; c++) {
        if (!JS_DefineProperty(cx, ctor, c->name, c->value, PM_CATTRS,
                               JS_STUBGETTER, JS_STUBSETTER))
            return 0;
    }

    if (!JS_FreezeObject(cx, prototype) ||
        !JS_FreezeObject(cx, ctor)) {
        return 0;
    }

    return prototype;
}
开发者ID:cstipkovic,项目名称:gecko-dev,代码行数:31,代码来源:jsperf.cpp

示例10: assert

inline markOop markOopDesc::prototype_for_object(oop obj) {
#ifdef ASSERT
  markOop prototype_header = obj->klass()->prototype_header();
  assert(prototype_header == prototype() || prototype_header->has_bias_pattern(), "corrupt prototype header");
#endif
  return obj->klass()->prototype_header();
}
开发者ID:campolake,项目名称:openjdk9,代码行数:7,代码来源:markOop.inline.hpp

示例11: prototype

 void BodyManager::_ApiRegister(Luasel::CallHelper& helper)
 {
     Uint32 pluginId = this->_engine.GetCurrentPluginRegistering();
     if (!pluginId)
         throw std::runtime_error("Server.Body.Register: Could not determine currently running plugin, aborting registration.");
     std::string pluginName = this->_engine.GetWorld().GetPluginManager().GetPluginIdentifier(pluginId);
     Luasel::Ref prototype(this->_engine.GetInterpreter().GetState());
     std::string bodyName;
     try
     {
         prototype = helper.PopArg();
         if (!prototype.IsTable())
             throw std::runtime_error("Server.Body.Register[Positional]: Argument \"prototype\" must be of type table (instead of " + prototype.GetTypeName() + ")");
         if (!prototype["bodyName"].IsString())
             throw std::runtime_error("Server.Body.Register[Positional]: Field \"bodyName\" in prototype must exist and be of type string");
         if (!Common::FieldUtils::IsRegistrableType(bodyName = prototype["bodyName"].ToString()))
             throw std::runtime_error("Server.Body.Register[Positional]: Invalid Body name \"" + bodyName + "\"");
     }
     catch (std::exception& e)
     {
         Tools::error << "BodyManager::_ApiRegister: Failed to register new Body type from \"" << pluginName << "\": " << e.what() << " (plugin " << pluginId << ").\n";
         return;
     }
     if (this->_bodyTypes[pluginId].count(bodyName)) // remplacement
     {
         Tools::Delete(this->_bodyTypes[pluginId][bodyName]);
         Tools::log << "BodyManager::_ApiRegister: Replacing Body type \"" << bodyName << "\" with a newer type from \"" << pluginName << "\" (plugin " << pluginId << ").\n";
     }
     this->_bodyTypesVec.push_back(new BodyType(bodyName, pluginId, (Uint32)this->_bodyTypesVec.size() + 1, prototype));
     this->_bodyTypes[pluginId][bodyName] = this->_bodyTypesVec.back();
     Tools::debug << "BodyManager::_ApiRegister: New Body type \"" << bodyName << "\" registered from \"" << pluginName << "\" (plugin " << pluginId << ").\n";
 }
开发者ID:Pocsel,项目名称:pocsel,代码行数:32,代码来源:BodyManager.cpp

示例12: physicsWorld

bool ObjectFatty::createBodyAtPosition( cocos2d::CCPoint position )
{
	// Player physical body
	b2dJson json;

	m_body = json.j2b2Body( physicsWorld(), prototype() );
	if( ! m_body || ! m_body->GetFixtureList() ) {
		std::cout << "Simple inventory item prototype messed up" << std::endl;
		return false;
	}
	m_body->SetUserData( this );
	m_body->SetTransform( b2Vec2(position.x/PTM_RATIO, position.y/PTM_RATIO), m_body->GetAngle() );
	setPosition(position);
	
	b2BodyDef bodyDef;
    bodyDef.type = b2_dynamicBody;
    bodyDef.fixedRotation = true;
	m_contactSensor = physicsWorld()->CreateBody(&bodyDef);
	m_contactSensor->SetTransform( b2Vec2(position.x/PTM_RATIO, position.y/PTM_RATIO), m_body->GetAngle() );
	
	m_bodies.push_back( m_contactSensor );
	m_bodies.push_back( m_body );

	
	b2RevoluteJointDef md;
	md.Initialize(m_body, m_contactSensor, m_body->GetPosition());
	md.maxMotorTorque = 200;
	md.enableMotor = true;
	m_motorJoint = (b2RevoluteJoint *)GameWorld::sharedGameWorld()->physicsWorld->CreateJoint(&md);
	
	saveOriginalProperties();
	return true;
}
开发者ID:Freezzz,项目名称:Constructor,代码行数:33,代码来源:ObjectFatty.cpp

示例13: ASSERT

void JSDOMWindowShell::setWindow(PassRefPtr<DOMWindow> domWindow)
{
    // Replacing JSDOMWindow via telling JSDOMWindowShell to use the same DOMWindow it already uses makes no sense,
    // so we'd better never try to.
    ASSERT(!window() || domWindow.get() != &window()->impl());
    // Explicitly protect the global object's prototype so it isn't collected
    // when we allocate the global object. (Once the global object is fully
    // constructed, it can mark its own prototype.)

    //VMOLAB
    //printf("JSDOMWindowShell::setWindow Called\n");
    
    VM& vm = JSDOMWindow::commonVM();
    Structure* prototypeStructure = JSDOMWindowPrototype::createStructure(vm, 0, jsNull());
    Strong<JSDOMWindowPrototype> prototype(vm, JSDOMWindowPrototype::create(vm, 0, prototypeStructure));

    Structure* structure = JSDOMWindow::createStructure(vm, 0, prototype.get());
    JSDOMWindow* jsDOMWindow = JSDOMWindow::create(vm, structure, domWindow, this);
    prototype->structure()->setGlobalObject(vm, jsDOMWindow);
    setWindow(vm, jsDOMWindow);
    ASSERT(jsDOMWindow->globalObject() == jsDOMWindow);
    ASSERT(prototype->globalObject() == jsDOMWindow);
#if ENABLE(VMOLAB)
    vm.setInParallelParseLoad(true);
#endif
}
开发者ID:highweb-project,项目名称:highweb-parallelwebkit,代码行数:26,代码来源:JSDOMWindowShell.cpp

示例14: make_prototype

Ref<Object>
Function::
make_prototype()
{
  Ref<Object> prototype(new Function_Prototype);
  return prototype;
}
开发者ID:cout,项目名称:px,代码行数:7,代码来源:Function.cpp

示例15: prototype

bool DeckLinkController::startCaptureWithMode(BMDDisplayMode videoMode) {
	if(videoMode == bmdModeHD1080p30) {
		vector<unsigned char> prototype(1920 * 1080 * 2);
		buffer.setup(prototype);
	} else {
		ofLogError("DeckLinkController") << "DeckLinkController needs to be updated to support that mode.";
		return false;
	}
	
	BMDVideoInputFlags videoInputFlags;
	
	// Enable input video mode detection if the device supports it
	videoInputFlags = supportFormatDetection ? bmdVideoInputEnableFormatDetection : bmdVideoInputFlagDefault;
	
	// Set capture callback
	deckLinkInput->SetCallback(this);
	
	// Set the video input mode
	if (deckLinkInput->EnableVideoInput(videoMode, bmdFormat8BitYUV, videoInputFlags) != S_OK) {
		ofLogError("DeckLinkController") << "This application was unable to select the chosen video mode. Perhaps, the selected device is currently in-use.";
		return false;
	}
	
	// Start the capture
	if (deckLinkInput->StartStreams() != S_OK) {
		ofLogError("DeckLinkController") << "This application was unable to start the capture. Perhaps, the selected device is currently in-use.";
		return false;
	}
	
	currentlyCapturing = true;
	
	return true;
}
开发者ID:imclab,项目名称:ofxBlackmagic,代码行数:33,代码来源:DeckLinkController.cpp


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