예제 #1
0
 NodeSP parse()
 {
   for (;;) {
     TokenSP token = scanner.next();
     std::cout << "<br/>" << *token << "@" << token->at << std::endl;
     if (token->type == Token::END_OF_FILE) break;
   }
   return NodeSP(0);
 }
예제 #2
0
Node::NodeSP Node::findChildNode(const QString name, bool recursive) {
    if(mChildren.find(name) != mChildren.end())
        return mChildren.find(name)->second;

    if(recursive){
        for(std::map<QString, NodeSP>::iterator itr = mChildren.begin(); itr != mChildren.end(); itr++) {
            if(itr->first == name)
                return itr->second;
            else {
                const NodeSP& childNode = itr->second->findChildNode(name, recursive);
                if(childNode)
                    return childNode;
            }
        }
    }
    return NodeSP();
}