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


C++ Bind类代码示例

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


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

示例1: runner

	bool Program::dispatchExecution(const Bind<void (const Callback&)>& dispatcher, uint timeout)
	{
		auto envptr = pEnv;
		if (!envptr)
		{
			envptr = std::make_shared<ProcessSharedInfo>();
			pEnv = envptr;
		}

		Thread::Signal signal;
		if (not signal.valid())
		{
			std::cerr << "impossible to initialize signal\n";
			return false;
		}

		// Dispatch the message
		// The code is within a block to let the variable
		// `runner` destroyed, thus to notify the end of the execution
		// (via signal->notify())
		ExecutionHelper runner(*this, signal);

		// scope to destroy our callback as soon as possible
		{
			Bind<bool ()>  callback;
			callback.bind(&runner, &ExecutionHelper::perform, timeout);
			dispatcher(callback);
		}

		// waiting for the process startup from the main loop
		signal.wait();

		// ok ready
		return runner.result;
	}
开发者ID:libyuni,项目名称:libyuni,代码行数:35,代码来源:program.cpp

示例2: main

int main(int argc,char* argv[])
{
  if (argc == 3)
  {
    Bind bd;
    return bd.BindProc(argv[1], argv[2]);
  }
  else
  {
    printf("usage:%s lm_dict bind_dict.\n", argv[0]);
    return -1;
  }
}
开发者ID:wangjie1991,项目名称:word_bind,代码行数:13,代码来源:main.cpp

示例3: ScopeChain

void ScopeBuilder::initializeScopeChain()
{
    ScopeChain &scopeChain = _context->scopeChain();
    if (scopeChain.qmlComponentScope
            && scopeChain.qmlComponentScope->document == _doc) {
        return;
    }

    scopeChain = ScopeChain(); // reset

    Interpreter::Engine *engine = _context->engine();

    // ### TODO: This object ought to contain the global namespace additions by QML.
    scopeChain.globalScope = engine->globalObject();

    if (! _doc) {
        scopeChain.update();
        return;
    }

    Bind *bind = _doc->bind();
    QHash<Document *, ScopeChain::QmlComponentChain *> componentScopes;

    ScopeChain::QmlComponentChain *chain = new ScopeChain::QmlComponentChain;
    scopeChain.qmlComponentScope = QSharedPointer<const ScopeChain::QmlComponentChain>(chain);
    if (_doc->qmlProgram()) {
        componentScopes.insert(_doc.data(), chain);
        makeComponentChain(_doc, chain, &componentScopes);

        if (const TypeEnvironment *typeEnvironment = _context->typeEnvironment(_doc.data())) {
            scopeChain.qmlTypes = typeEnvironment;
        }
    } else {
        // add scope chains for all components that import this file
        foreach (Document::Ptr otherDoc, _snapshot) {
            foreach (const ImportInfo &import, otherDoc->bind()->imports()) {
                if (import.type() == ImportInfo::FileImport && _doc->fileName() == import.name()) {
                    ScopeChain::QmlComponentChain *component = new ScopeChain::QmlComponentChain;
                    componentScopes.insert(otherDoc.data(), component);
                    chain->instantiatingComponents += component;
                    makeComponentChain(otherDoc, component, &componentScopes);
                }
            }
        }

        // ### TODO: Which type environment do scripts see?

        if (bind->rootObjectValue())
            scopeChain.jsScopes += bind->rootObjectValue();
    }
开发者ID:NoobSaibot,项目名称:qtcreator-minimap,代码行数:50,代码来源:qmljsscopebuilder.cpp

示例4: hasStatePrototype

 bool hasStatePrototype(Node *ast)
 {
     Bind *bind = m_scopeChain.document()->bind();
     const ObjectValue *v = bind->findQmlObject(ast);
     if (!v)
         return false;
     PrototypeIterator it(v, m_scopeChain.context());
     while (it.hasNext()) {
         const ObjectValue *proto = it.next();
         const CppComponentValue *qmlProto = value_cast<CppComponentValue>(proto);
         if (!qmlProto)
             continue;
         if (qmlProto->metaObject() == m_statePrototype->metaObject())
             return true;
     }
     return false;
 }
开发者ID:KeeganRen,项目名称:qt-creator,代码行数:17,代码来源:qmljssemantichighlighter.cpp

示例5: engine

void Link::initializeScopeChain()
{
    ScopeChain &scopeChain = _context->scopeChain();

    // ### TODO: This object ought to contain the global namespace additions by QML.
    scopeChain.globalScope = engine()->globalObject();

    if (! _doc) {
        scopeChain.update();
        return;
    }

    Bind *bind = _doc->bind();
    QHash<Document *, ScopeChain::QmlComponentChain *> componentScopes;

    if (_doc->qmlProgram()) {
        scopeChain.qmlComponentScope.clear();
        componentScopes.insert(_doc.data(), &scopeChain.qmlComponentScope);
        makeComponentChain(_doc, &scopeChain.qmlComponentScope, &componentScopes);

        if (const ObjectValue *typeEnvironment = _context->typeEnvironment(_doc.data()))
            scopeChain.qmlTypes = typeEnvironment;
    } else {
        // add scope chains for all components that import this file
        foreach (Document::Ptr otherDoc, _snapshot) {
            foreach (const QString &fileImport, otherDoc->bind()->fileImports()) {
                if (_doc->fileName() == fileImport) {
                    ScopeChain::QmlComponentChain *component = new ScopeChain::QmlComponentChain;
                    componentScopes.insert(otherDoc.data(), component);
                    scopeChain.qmlComponentScope.instantiatingComponents += component;
                    makeComponentChain(otherDoc, component, &componentScopes);
                }
            }
        }

        // ### TODO: Which type environment do scripts see?

        if (bind->rootObjectValue())
            scopeChain.jsScopes += bind->rootObjectValue();
    }
开发者ID:gidlbn,项目名称:dlbn_02,代码行数:40,代码来源:qmljslink.cpp

示例6: audioSample

 void audioSample(int16_t lsample, int16_t rsample) { return bind->audioSample(lsample, rsample); }
开发者ID:Brunnis,项目名称:bsnes-mercury,代码行数:1,代码来源:interface.hpp

示例7: server

 string server() { return bind->server(); }
开发者ID:Brunnis,项目名称:bsnes-mercury,代码行数:1,代码来源:interface.hpp

示例8: notify

template<typename... Args> void notify(Args&&... args) { return bind->notify({std::forward<Args>(args)...}); }
开发者ID:Brunnis,项目名称:bsnes-mercury,代码行数:1,代码来源:interface.hpp

示例9: dipSettings

 unsigned dipSettings(const Markup::Node& node) { return bind->dipSettings(node); }
开发者ID:Brunnis,项目名称:bsnes-mercury,代码行数:1,代码来源:interface.hpp

示例10: path

 string path(unsigned group) { return bind->path(group); }
开发者ID:Brunnis,项目名称:bsnes-mercury,代码行数:1,代码来源:interface.hpp

示例11: inputPoll

 int16_t inputPoll(unsigned port, unsigned device, unsigned input) { return bind->inputPoll(port, device, input); }
开发者ID:Brunnis,项目名称:bsnes-mercury,代码行数:1,代码来源:interface.hpp

示例12: inputRumble

 void inputRumble(unsigned port, unsigned device, unsigned input, bool enable) { return bind->inputRumble(port, device, input, enable); }
开发者ID:Brunnis,项目名称:bsnes-mercury,代码行数:1,代码来源:interface.hpp

示例13: loadRequest

 //callback bindings (provided by user interface)
 void loadRequest(unsigned id, string name, string type) { return bind->loadRequest(id, name, type); }
开发者ID:Brunnis,项目名称:bsnes-mercury,代码行数:2,代码来源:interface.hpp

示例14: videoRefresh

 void videoRefresh(const uint32_t* palette, const uint32_t* data, unsigned pitch, unsigned width, unsigned height) { return bind->videoRefresh(palette, data, pitch, width, height); }
开发者ID:Brunnis,项目名称:bsnes-mercury,代码行数:1,代码来源:interface.hpp

示例15: videoColor

 uint32_t videoColor(unsigned source, uint16_t alpha, uint16_t red, uint16_t green, uint16_t blue) { return bind->videoColor(source, alpha, red, green, blue); }
开发者ID:Brunnis,项目名称:bsnes-mercury,代码行数:1,代码来源:interface.hpp


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