本文整理汇总了C++中TextInput::readSignificant方法的典型用法代码示例。如果您正苦于以下问题:C++ TextInput::readSignificant方法的具体用法?C++ TextInput::readSignificant怎么用?C++ TextInput::readSignificant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextInput
的用法示例。
在下文中一共展示了TextInput::readSignificant方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deserializeName
void Any::deserializeName(TextInput& ti, Token& token, std::string& name) {
debugAssert(token.type() == Token::SYMBOL);
std::string s = token.string();
while (!isOpen(s[0])) {
name += s;
// Skip newlines and comments
token = ti.readSignificant();
if (token.type() != Token::SYMBOL) {
throw ParseError(ti.filename(), token.line(), token.character(),
"Expected symbol while parsing Any");
}
s = token.string();
}
}
示例2: deserializeBody
void Any::deserializeBody(TextInput& ti, Token& token) {
char closeSymbol = '}';
m_type = TABLE;
const char c = token.string()[0];
if (c != '{') {
m_type = ARRAY;
// Chose the appropriate close symbol
closeSymbol = (c == '(') ? ')' : ']';
}
// Allocate the underlying data structure
ensureData();
m_data->source.set(ti, token);
// Consume the open token
token = ti.read();
while (!((token.type() == Token::SYMBOL) && (token.string()[0] == closeSymbol))) {
// Read any leading comment. This must be done here (and not in the recursive deserialize
// call) in case the body contains only a comment.
std::string comment;
deserializeComment(ti, token, comment);
if ((token.type() == Token::SYMBOL) && (token.string()[0] == closeSymbol)) {
// We're done; this catches the case where the array is empty
break;
}
// Pointer the value being read
Any a;
std::string key;
if (m_type == TABLE) {
// Read the key
if (token.type() != Token::SYMBOL && token.type() != Token::STRING) {
throw ParseError(ti.filename(), token.line(), token.character(), "Expected a name");
}
key = token.string();
// Consume everything up to the = sign
token = ti.readSignificant();
if ((token.type() != Token::SYMBOL) || (token.string() != "=")) {
throw ParseError(ti.filename(), token.line(), token.character(), "Expected =");
}
else {
// Consume (don't consume comments--we want the value pointed to by a to get those).
token = ti.read();
}
}
a.deserialize(ti, token);
if (!comment.empty()) {
// Prepend the comment we read earlier
a.ensureData();
a.m_data->comment = trimWhitespace(comment + "\n" + a.m_data->comment);
}
if (m_type == TABLE) {
set(key, a);
}
else {
append(a);
}
// Read until the comma or close paren, discarding trailing comments and newlines
readUntilCommaOrClose(ti, token);
// Consume the comma
if (isSeparator(token.string()[0])) {
token = ti.read();
}
}
// Consume the close paren (to match other deserialize methods)
token = ti.read();
}