本文整理汇总了C++中tokenizer::expect_bool方法的典型用法代码示例。如果您正苦于以下问题:C++ tokenizer::expect_bool方法的具体用法?C++ tokenizer::expect_bool怎么用?C++ tokenizer::expect_bool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tokenizer
的用法示例。
在下文中一共展示了tokenizer::expect_bool方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read_material
void read_material(tokenizer& t,document_type& doc)
{
int count=t.expect_integer(1);
t.expect_literal( "{" );
t.expect_linefeed();
for(int i=0;i<count;i++){
material_type m;
m.name=t.expect_string(31).str();
m.shader = shader_phong;
m.vertex_color = false;
m.color.red = m.color.green = m.color.blue = m.color.alpha =
1.0f;
m.diffuse = m.ambient = m.emissive = m.specular = m.power =
1.0f;
m.projection = projection_uv;
m.proj_pos.x = m.proj_pos.y = m.proj_pos.z = 0;
m.proj_scale.x = m.proj_scale.y = m.proj_scale.z = 0;
m.proj_angle.heading =
m.proj_angle.pitching =
m.proj_angle.banking = 0;
for(;;){
substr token = t();
if( token == "shader" ) {
t.expect_literal( "(" );
m.shader = shader_type(
t.expect_integer( 0, 4 ) );
t.expect_literal( ")" );
} else if( token == "vcol" ) {
t.expect_literal( "(" );
m.vertex_color = t.expect_bool();
t.expect_literal( ")" );
} else if( token == "col" ) {
t.expect_literal( "(" );
m.color.red = t.expect_float( 0, 1.0f );
m.color.green = t.expect_float( 0, 1.0f );
m.color.blue = t.expect_float( 0, 1.0f );
m.color.alpha = t.expect_float( 0, 1.0f );
t.expect_literal( ")" );
} else if( token == "dif" ) {
t.expect_literal( "(" );
m.diffuse = t.expect_float( 0, 1.0f );
t.expect_literal( ")" );
} else if( token == "amb" ) {
t.expect_literal( "(" );
m.ambient = t.expect_float( 0, 1.0f );
t.expect_literal( ")" );
} else if( token == "emi" ) {
t.expect_literal( "(" );
m.emissive = t.expect_float( 0, 1.0f );
t.expect_literal( ")" );
} else if( token == "spc" ) {
t.expect_literal( "(" );
m.specular = t.expect_float( 0, 1.0f );
t.expect_literal( ")" );
} else if( token == "power" ) {
t.expect_literal( "(" );
m.power = t.expect_float( 0, 100.0f );
t.expect_literal( ")" );
} else if( token == "tex" ) {
t.expect_literal( "(" );
m.texture = t.expect_string( 63 ).str();
t.expect_literal( ")" );
} else if( token == "aplane" ) {
t.expect_literal( "(" );
m.aplane = t.expect_string( 63 ).str();
t.expect_literal( ")" );
} else if( token == "bump" ) {
t.expect_literal( "(" );
m.bump = t.expect_string( 63 ).str();
t.expect_literal( ")" );
} else if( token == "proj_type" ) {
t.expect_literal( "(" );
m.projection = projection_type(
t.expect_integer( 0, 3 ) );
t.expect_literal( ")" );
} else if( token == "proj_pos" ) {
t.expect_literal( "(" );
m.proj_pos.x = t.expect_float();
m.proj_pos.y = t.expect_float();
m.proj_pos.z = t.expect_float();
t.expect_literal( ")" );
} else if( token == "proj_scale" ) {
t.expect_literal( "(" );
m.proj_scale.x = t.expect_float();
m.proj_scale.y = t.expect_float();
m.proj_scale.z = t.expect_float();
t.expect_literal( ")" );
} else if( token == "proj_angle" ) {
t.expect_literal( "(" );
m.proj_angle.heading = t.expect_float();
m.proj_angle.pitching = t.expect_float();
m.proj_angle.banking = t.expect_float();
t.expect_literal( ")" );
} else if( token == "\n" ) {
break;
} else {
throw mqo_reader_error(
"unexpected token: "+token.str() );
}
}
//.........这里部分代码省略.........