本文整理汇总了C++中In::pointer方法的典型用法代码示例。如果您正苦于以下问题:C++ In::pointer方法的具体用法?C++ In::pointer怎么用?C++ In::pointer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类In
的用法示例。
在下文中一共展示了In::pointer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process_char
/* values not in quotes are literals */
void PJson::process_char(In& source, State& state, bool& out_move)
{
bool is_literal = this->lookup.table[*source.pointer()];
if(is_literal) {
bool likely_fp = false;
In::Notify dec ('.', likely_fp);
auto block = source.read_block_until(error, ',', ' ', '}', ']', dec);
this->process_literal(block, state, likely_fp ? Type::FP64 : Type::Null);
if(*source.pointer() == '}' || *source.pointer() == ']') {
/* The bracket has a double meaning here, first it delimits the literal,
* and second it closes the scope. So make sure it will be processed. */
out_move = false;
}
}
}
示例2: while
pair<Lib::MemBlock, Value> PJson::read(In& source)
{
State state;
while(!state.complete) {
/* literals can be 'un-quoted', values in 'square-brackets' don't have a name */
if(!state.reading_value && this->scope_type != Type::Array) {
source.move_until(error, '\"', ':', '{', '[', '}', ']', '/');
} else {
source.move_while(error, ' ', ',', '\n', '\t', '\r');
}
bool move = true;
char c = *source.pointer();
switch(c) {
case '\"': this->process_quote(source, state);
break;
case ':' : if(state.reading_value) {
this->throw_exception(state, "Redundant semicolon.");
}
state.reading_value = true;
break;
case '{' :
case '}' :
case '[' :
case ']' : this->process_bracket(c, state);
break;
case '/' : skip_comment(source);
break;
default : this->process_char(source, state, move);
}
if(move) {
source.move(1, error);
}
}
return { state.name, state.value };
}