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


C++ Children::begin方法代码示例

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


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

示例1: wait_children

inline status wait_children(Children &cs) 
{ 
    BOOST_ASSERT(cs.size() >= 2); 

    typename Children::iterator it = cs.begin(); 
    while (it != cs.end()) 
    { 
        const status s = it->wait(); 
        ++it; 
        if (it == cs.end()) 
            return s; 
        else if (!s.exited() || s.exit_status() != EXIT_SUCCESS) 
        { 
            while (it != cs.end()) 
            { 
                it->wait(); 
                ++it; 
            } 
            return s; 
        } 
    } 

    BOOST_ASSERT(false); 
    return cs.begin()->wait(); 
} 
开发者ID:allannielsen,项目名称:termhub,代码行数:25,代码来源:operations.hpp

示例2: RemoveAllChildren

void Panel::RemoveAllChildren()
{
    Children aspChildren = m_aspChildren;
    for ( Children::iterator it = aspChildren.begin(); it != aspChildren.end(); ++it )
    {
        GuiObjectPtr spChild = *it;
        DeinitChild( spChild );
    }
    m_aspChildren.clear();
    
    if ( GetSizeModeX() == SIZE_MODE_CONTENT ||
         GetSizeModeY() == SIZE_MODE_CONTENT )
    {
        UpdateSize();
    }
     
    // Dispatch events   
    for ( Children::iterator it = aspChildren.begin(); it != aspChildren.end(); ++it )
    {
        GuiObjectPtr spChild = *it;
        DispatchEvent( EVENT_PANEL_CHILD_REMOVED, GetSharedPtr< Panel >(), spChild );
        DispatchEvent( EVENT_PANEL_CHILDREN_CHANGED, GetSharedPtr< Panel >(), spChild );
    }
}
开发者ID:coeing,项目名称:cframework,代码行数:24,代码来源:Panel.cpp

示例3: findAllUnresolvedSymbols

 void findAllUnresolvedSymbols(std::vector<ParseItem>* pItems) const
 {
    // Get the unresolved symbols at this node
    std::set<ParseItem> unresolved = getUnresolvedSymbols();
    pItems->insert(pItems->end(), unresolved.begin(), unresolved.end());
    
    // Apply this over all children on the node
    Children children = getChildren();
    
    for (Children::iterator it = children.begin();
         it != children.end();
         ++it)
    {
       (**it).findAllUnresolvedSymbols(pItems);
    }
 }
开发者ID:Bangjie,项目名称:rstudio,代码行数:16,代码来源:SessionRParser.hpp

示例4: bindToMasterView

void InstanceArray::bindToMasterView(const ViewSharedPtr& inMaster, bool inMapPortReferences)
	throw (Error) {
	typedef std::vector<InstanceSharedPtr> Children;
	Children children;
	getChildren(children);
	Children::iterator child = children.begin();
	Children::iterator cEnd = children.end();
	for(; child != cEnd; ++child) {
		try {
			(*child)->bindToMasterView(inMaster);
		} catch(Error& e) {
			e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
			throw;
		}
	}
	Instance::bindToMasterView(inMaster, false);
}
开发者ID:torc-isi,项目名称:torc,代码行数:17,代码来源:InstanceArray.cpp

示例5: setActiveFontSize

void FontSizeComboBox::setActiveFontSize(int value)
{
	if (value == 0)
	{
		unset_active();
		return;
	}
	
    typedef Gtk::TreeModel::Children Children;
    Children children = font_size_tree_model_->children();
    for (Children::iterator iter = children.begin(); iter != children.end(); ++iter)
	{
		Gtk::TreeModel::Row row = *iter;
		if (row[columns_.font_size] == value)
		{
			set_active (iter);
			break;
		}
	}
}
开发者ID:vcappello,项目名称:Germod,代码行数:20,代码来源:font_size_combo_box.cpp

示例6: main

int main () {
    Component* composite1 = new Composite();

    composite1->add( GET("LeafA") );
    composite1->add( GET("LeafA") );
    
    Component* composite2 = new Composite();
    composite2->add( GET("LeafB") );
    composite2->add( GET("LeafA") );
    composite2->add( composite1 );
    composite2->draw(10);

    Children* children = composite2->getChildren();

    std::cout << std::endl;
    int i = 11;
    for(typename Children::iterator it = children->begin(); it != children->end(); ++it) {
        (*it)->draw(i);
        i += 11;
    }
    return 0;
}
开发者ID:zzucainiao,项目名称:code-backup,代码行数:22,代码来源:main.cpp

示例7: onObjectLoaded

void Entity::onObjectLoaded()
{
    __super::onObjectLoaded();

    if ( m_parent )
    {
        onAttached( *m_parent );
    }

    // copy the managed children to the runtime children array
    unsigned int count = m_managedChildren.size();
    m_children.resize( count );
    for( unsigned int i = 0; i < count; ++i )
    {
        m_children[i] = m_managedChildren[i];
    }

    // inform that the children have been attached
    Children children = m_children;
    for ( Children::iterator it = children.begin(); it != children.end(); ++it )
    {
        onChildAttached( **it );
    }
}
开发者ID:chenwenbin928,项目名称:tamy,代码行数:24,代码来源:Entity.cpp

示例8: start

void start()
{
    std::ofstream pidfile(SC_PID);
    if (!pidfile.good()) {
        std::cerr << "cannot open PID file " << SC_PID << ": " << strerror(errno) << std::endl;
        exit(errno);
    }
    pidfile << getpid() << std::endl;
    pidfile.close();

    std::ofstream log;

    log.open(SC_LOG, std::ofstream::app);
    log << "\n"
        << logPrefix() << "starting shoutcast daemon" << std::endl;
    log << logPrefix() << "reading shoutcast configuration files from " << SC_CONFIG << std::endl;
    log.close();

    // Enumerate config files in shoutcast config dir.
    DIR *dir;
    struct dirent *ent;
    dir = opendir (SC_CONFIG);
    if (dir == NULL) {
        log.open(SC_LOG, std::ofstream::app);
        log << logPrefix() << "cannot read scd configuration direcoty " << SC_CONFIG << ": " << strerror(errno) << std::endl;
        log.close();
        exit(errno);
    }

    for (; ent = readdir(dir); ent != NULL) {
        std::string cfgfile = ent->d_name;
        if (cfgfile == "." || cfgfile == "..") {
            continue;
        }
        std::string cfgpath = SC_CONFIG;
        cfgpath += "/";
        cfgpath += cfgfile;
        Child c;
        c.pid = 0;
        c.config = cfgpath;
        size_t idx = cfgfile.find(".");
        c.log = SC_LOGDIR"sc_stream_";
        c.log += cfgfile.substr(0, idx);
        c.log += ".log";
        g_children.push_back(c);

        log.open(SC_LOG, std::ofstream::app);
        log << logPrefix() << "found shoutcast configuration: " << cfgpath << std::endl;
        log.close();
    }
    closedir(dir);

    // Start respawn loop.
    while (g_running) {
        // Respawn all children with zero pid.
        for (Children::iterator i = g_children.begin();
                i != g_children.end(); ++i) {
            if (i->pid == 0) {
                i->pid = fork();
                if (i->pid == 0) {
                    // Open log file and redirect stdout, stderr.
                    FILE *f = fopen(i->log.c_str(), "a");
                    int r1 = dup2(fileno(f), 1);
                    int r2 = dup2(fileno(f), 2);
                    fclose(f);

                    // Start child process.
                    std::cout << timeStr()
                              << "[" << getpid() << "] started"
                              << std::endl;
                    if (execl(SC_EXEC, SC_EXEC, i->config.c_str(),
                            (char*)0) < 0) {
                        exit(1);
                    }
                } else {
                    log.open(SC_LOG, std::ofstream::app);
                    log << logPrefix() << "spawned server for config " << i->config << ", server pid is [" << i->pid << "]" << std::endl;
                    log.close();
                }
            }
        }

        // Wait for any failed children.
        int status;
        pid_t pid = wait(&status);
        if (!g_running)
            break;

        // Mark a failed child to restart.
        for (Children::iterator i = g_children.begin(); i != g_children.end(); ++i) {
            if (i->pid == pid) {
                log.open(SC_LOG, std::ofstream::app);
                log << logPrefix() << "server with pid [" << pid << "] (" << i->config << ") failed with status " << status << std::endl;
                log.close();
                i->pid = 0;
                break;
            }
        }
    }

//.........这里部分代码省略.........
开发者ID:kona4kona,项目名称:scd,代码行数:101,代码来源:scd_main.cpp


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