本文整理汇总了C++中TextInput::hasMore方法的典型用法代码示例。如果您正苦于以下问题:C++ TextInput::hasMore方法的具体用法?C++ TextInput::hasMore怎么用?C++ TextInput::hasMore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextInput
的用法示例。
在下文中一共展示了TextInput::hasMore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deserialize
void XML::deserialize(TextInput& t) {
begin:
Token n = t.read();
m_attribute.clear();
m_child.clear();
m_name = "";
m_value = "";
if ((n.type() == Token::SYMBOL) && (n.string() == "<")) {
// Beginning a tag
// Read name
n = t.read();
debugAssert(n.type() == Token::SYMBOL);
bool isComment =
(n.string() == "!") &&
(t.peek().type() == Token::SYMBOL) &&
(t.peek().string() == "--");
// ignored tag: <?xml> or <!xml>
// comment tag: <!-- ... -->
if ((n.string() == "?") || ((n.string() == "!") && ! isComment)) {
// Ignore this tag
while (t.hasMore() && ! ((n.type() == Token::SYMBOL) && (n.string() == ">"))) {
n = t.read();
}
goto begin;
} else if (isComment) {
// Ignore until "-->"
bool prevWasDash = false;
while (t.hasMore() && ! ((n.type() == Token::SYMBOL) && (n.string() == ">") && prevWasDash)) {
prevWasDash = (n.type() == Token::SYMBOL) && (n.string() == "--");
n = t.read();
}
goto begin;
}
// Keep reading until no colon
m_name += n.string();
n = t.read();
while ((n.type() == Token::SYMBOL) && (n.string() == ":")) {
// tag with namespace: <x:y>
m_name += ":" + t.readSymbol();
n = t.read();
}
// Read end of tag/close
bool done = false;
while (! done) {
debugAssert(n.type() == Token::SYMBOL);
if (n.string() == "/") {
// empty-element tag: <foo/>
// Consume the close tag
t.readSymbol(">");
done = true;
} else if (n.string() == ">") {
// End of open tag: read children until close tag
while (! atClose(t, m_name)) {
m_child.next().deserialize(t);
}
// Read close tag (we wouldn't be here unless it parses correctly)
while (t.hasMore() && ! (t.readSymbol() == ">")) {}
done = true;
} else {
// Attribute pair
std::string k = n.string();
t.readSymbol("=");
std::string v = t.read().string();
m_attribute.set(k, v);
// Advance to next
n = t.read();
}
}
} else {
// Beginning embedded content. Read until the end of file or the next tag.
m_type = VALUE;
m_value += n.string();
n = t.peek();
while (t.hasMore() && ! ((n.type() == Token::SYMBOL) && (n.string() == "<"))) {
m_value += " " + t.read().string();
n = t.peek();
}
}
}