bool CommandHolder::IsEqualFirstName(const std::string& cmd_first_name) const { DCHECK(count_space(cmd_first_name) == 0) << "Command (" << cmd_first_name << ") should be without spaces."; if (white_spaces_count_ == 0) { return IsEqualName(cmd_first_name); } for (size_t i = 0; i < name.size(); ++i) { char c = name[i]; if (std::isspace(c)) { return common::FullEqualsASCII(cmd_first_name, name.substr(0, i), false); } } return IsEqualName(cmd_first_name); }
bool CommandHolder::IsCommand(commands_args_t argv, size_t* offset) const { if (argv.empty()) { return false; } const size_t uargc = argv.size(); if (uargc == white_spaces_count_) { return false; } CHECK(uargc > white_spaces_count_); std::vector<command_buffer_t> merged; for (size_t i = 0; i < white_spaces_count_ + 1; ++i) { merged.push_back(argv[i]); } command_buffer_t ws = common::JoinString(merged, " "); if (!IsEqualName(ws)) { return false; } if (offset) { *offset = white_spaces_count_ + 1; } return true; }
Attribute const * Node::FindAttribute (std::string const & name) const { ConstAttribIter it = std::find_if (_attributes.begin (), _attributes.end (), IsEqualName (name)); if (it != _attributes.end ()) { return *it; } return 0; }
Node const * Node::FindFirstChildNamed (std::string const & name) const { ConstChildIter it = std::find_if (_children.begin (), _children.end (), IsEqualName (name)); if (it != _children.end ()) { return *it; } return 0; }