本文整理汇总了C++中idLexer::ExpectTokenString方法的典型用法代码示例。如果您正苦于以下问题:C++ idLexer::ExpectTokenString方法的具体用法?C++ idLexer::ExpectTokenString怎么用?C++ idLexer::ExpectTokenString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idLexer
的用法示例。
在下文中一共展示了idLexer::ExpectTokenString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseNodes
/*
================
idAASFileLocal::ParseNodes
================
*/
bool idAASFileLocal::ParseNodes(idLexer &src)
{
int numNodes, i;
aasNode_t node;
numNodes = src.ParseInt();
nodes.Resize(numNodes);
if (!src.ExpectTokenString("{")) {
return false;
}
for (i = 0; i < numNodes; i++) {
src.ParseInt();
src.ExpectTokenString("(");
node.planeNum = src.ParseInt();
node.children[0] = src.ParseInt();
node.children[1] = src.ParseInt();
src.ExpectTokenString(")");
nodes.Append(node);
}
if (!src.ExpectTokenString("}")) {
return false;
}
return true;
}
示例2: ParseReachabilities
/*
================
idAASFileLocal::ParseReachabilities
================
*/
bool idAASFileLocal::ParseReachabilities( idLexer &src, int areaNum )
{
int num, j;
aasArea_t *area;
idReachability reach, *newReach;
idReachability_Special *special;
area = &areas[areaNum];
num = src.ParseInt();
src.ExpectTokenString( "{" );
area->reach = NULL;
area->rev_reach = NULL;
area->travelFlags = AreaContentsTravelFlags( areaNum );
for ( j = 0; j < num; j++ )
{
Reachability_Read( src, &reach );
switch( reach.travelType )
{
case TFL_SPECIAL:
newReach = special = new idReachability_Special();
Reachability_Special_Read( src, special );
break;
default:
newReach = new idReachability();
break;
}
newReach->CopyBase( reach );
newReach->fromAreaNum = areaNum;
newReach->next = area->reach;
area->reach = newReach;
}
src.ExpectTokenString( "}" );
return true;
}
示例3: ParseAreas
/*
================
idAASFileLocal::ParseAreas
================
*/
bool idAASFileLocal::ParseAreas( idLexer &src ) {
int numAreas, i;
aasArea_t area;
numAreas = src.ParseInt();
areas.Resize( numAreas );
if ( !src.ExpectTokenString( "{" ) ) {
return false;
}
for ( i = 0; i < numAreas; i++ ) {
src.ParseInt();
src.ExpectTokenString( "(" );
area.flags = src.ParseInt();
area.contents = src.ParseInt();
area.firstFace = src.ParseInt();
area.numFaces = src.ParseInt();
area.cluster = src.ParseInt();
area.clusterAreaNum = src.ParseInt();
src.ExpectTokenString( ")" );
areas.Append( area );
ParseReachabilities( src, i );
}
if ( !src.ExpectTokenString( "}" ) ) {
return false;
}
LinkReversedReachability();
return true;
}
示例4: ParsePortals
/*
================
idAASFileLocal::ParsePortals
================
*/
bool idAASFileLocal::ParsePortals( idLexer &src ) {
int numPortals, i;
aasPortal_t portal;
numPortals = src.ParseInt();
portals.Resize( numPortals );
if ( !src.ExpectTokenString( "{" ) ) {
return false;
}
for ( i = 0; i < numPortals; i++ ) {
src.ParseInt();
src.ExpectTokenString( "(" );
portal.areaNum = src.ParseInt();
portal.clusters[0] = src.ParseInt();
portal.clusters[1] = src.ParseInt();
portal.clusterAreaNum[0] = src.ParseInt();
portal.clusterAreaNum[1] = src.ParseInt();
src.ExpectTokenString( ")" );
portals.Append( portal );
}
if ( !src.ExpectTokenString( "}" ) ) {
return false;
}
return true;
}
示例5: ParsePlanes
/*
================
idAASFileLocal::ParsePlanes
================
*/
bool idAASFileLocal::ParsePlanes(idLexer &src)
{
int numPlanes, i;
idPlane plane;
idVec4 vec;
numPlanes = src.ParseInt();
planeList.Resize(numPlanes);
if (!src.ExpectTokenString("{")) {
return false;
}
for (i = 0; i < numPlanes; i++) {
src.ParseInt();
if (!src.Parse1DMatrix(4, vec.ToFloatPtr())) {
return false;
}
plane.SetNormal(vec.ToVec3());
plane.SetDist(vec[3]);
planeList.Append(plane);
}
if (!src.ExpectTokenString("}")) {
return false;
}
return true;
}
示例6: ParseVertices
/*
================
idAASFileLocal::ParseVertices
================
*/
bool idAASFileLocal::ParseVertices(idLexer &src)
{
int numVertices, i;
idVec3 vec;
numVertices = src.ParseInt();
vertices.Resize(numVertices);
if (!src.ExpectTokenString("{")) {
return false;
}
for (i = 0; i < numVertices; i++) {
src.ParseInt();
if (!src.Parse1DMatrix(3, vec.ToFloatPtr())) {
return false;
}
vertices.Append(vec);
}
if (!src.ExpectTokenString("}")) {
return false;
}
return true;
}
示例7: ParseIndex
/*
================
idAASFileLocal::ParseIndex
================
*/
bool idAASFileLocal::ParseIndex(idLexer &src, idList<aasIndex_t> &indexes)
{
int numIndexes, i;
aasIndex_t index;
numIndexes = src.ParseInt();
indexes.Resize(numIndexes);
if (!src.ExpectTokenString("{")) {
return false;
}
for (i = 0; i < numIndexes; i++) {
src.ParseInt();
src.ExpectTokenString("(");
index = src.ParseInt();
src.ExpectTokenString(")");
indexes.Append(index);
}
if (!src.ExpectTokenString("}")) {
return false;
}
return true;
}
示例8: ParseBBoxes
/*
============
idAASSettings::ParseBBoxes
============
*/
bool idAASSettings::ParseBBoxes(idLexer &src)
{
idToken token;
idBounds bounds;
numBoundingBoxes = 0;
if (!src.ExpectTokenString("{")) {
return false;
}
while (src.ReadToken(&token)) {
if (token == "}") {
return true;
}
src.UnreadToken(&token);
src.Parse1DMatrix(3, bounds[0].ToFloatPtr());
if (!src.ExpectTokenString("-")) {
return false;
}
src.Parse1DMatrix(3, bounds[1].ToFloatPtr());
boundingBoxes[numBoundingBoxes++] = bounds;
}
return false;
}
示例9: ParseClusters
/*
================
idAASFileLocal::ParseClusters
================
*/
bool idAASFileLocal::ParseClusters(idLexer &src)
{
int numClusters, i;
aasCluster_t cluster;
numClusters = src.ParseInt();
clusters.Resize(numClusters);
if (!src.ExpectTokenString("{")) {
return false;
}
for (i = 0; i < numClusters; i++) {
src.ParseInt();
src.ExpectTokenString("(");
cluster.numAreas = src.ParseInt();
cluster.numReachableAreas = src.ParseInt();
cluster.firstPortal = src.ParseInt();
cluster.numPortals = src.ParseInt();
src.ExpectTokenString(")");
clusters.Append(cluster);
}
if (!src.ExpectTokenString("}")) {
return false;
}
return true;
}
示例10: ParseEdges
/*
================
idAASFileLocal::ParseEdges
================
*/
bool idAASFileLocal::ParseEdges( idLexer &src )
{
int numEdges, i;
aasEdge_t edge;
numEdges = src.ParseInt();
edges.Resize( numEdges );
if ( !src.ExpectTokenString( "{" ) )
{
return false;
}
for ( i = 0; i < numEdges; i++ )
{
src.ParseInt();
src.ExpectTokenString( "(" );
edge.vertexNum[0] = src.ParseInt();
edge.vertexNum[1] = src.ParseInt();
src.ExpectTokenString( ")" );
edges.Append( edge );
}
if ( !src.ExpectTokenString( "}" ) )
{
return false;
}
return true;
}
示例11: ParseFaces
/*
================
idAASFileLocal::ParseFaces
================
*/
bool idAASFileLocal::ParseFaces( idLexer &src )
{
int numFaces, i;
aasFace_t face;
numFaces = src.ParseInt();
faces.Resize( numFaces );
if ( !src.ExpectTokenString( "{" ) )
{
return false;
}
for ( i = 0; i < numFaces; i++ )
{
src.ParseInt();
src.ExpectTokenString( "(" );
face.planeNum = src.ParseInt();
face.flags = src.ParseInt();
face.areas[0] = src.ParseInt();
face.areas[1] = src.ParseInt();
face.firstEdge = src.ParseInt();
face.numEdges = src.ParseInt();
src.ExpectTokenString( ")" );
faces.Append( face );
}
if ( !src.ExpectTokenString( "}" ) )
{
return false;
}
return true;
}
示例12: ParseHinge
/*
================
idDeclAF::ParseHinge
================
*/
bool idDeclAF::ParseHinge( idLexer &src ) {
idToken token;
idDeclAF_Constraint *constraint = new idDeclAF_Constraint;
constraint->SetDefault( this );
constraints.Alloc() = constraint;
if ( !src.ExpectTokenType( TT_STRING, 0, &token ) ||
!src.ExpectTokenString( "{" ) ) {
return false;
}
constraint->type = DECLAF_CONSTRAINT_HINGE;
constraint->limit = idDeclAF_Constraint::LIMIT_NONE;
constraint->name = token;
constraint->friction = 0.5f;
constraint->anchor.ToVec3().Zero();
constraint->axis.ToVec3().Zero();
while( src.ReadToken( &token ) ) {
if ( !token.Icmp( "body1" ) ) {
src.ExpectTokenType( TT_STRING, 0, &token );
constraint->body1 = token;
} else if ( !token.Icmp( "body2" ) ) {
src.ExpectTokenType( TT_STRING, 0, &token );
constraint->body2 = token;
} else if ( !token.Icmp( "anchor" ) ) {
if ( !constraint->anchor.Parse( src ) ) {
return false;
}
} else if ( !token.Icmp( "axis" ) ) {
if ( !constraint->axis.Parse( src ) ) {
return false;
}
} else if ( !token.Icmp( "limit" ) ) {
constraint->limitAngles[0] = src.ParseFloat();
if ( !src.ExpectTokenString( "," ) ) {
return false;
}
constraint->limitAngles[1] = src.ParseFloat();
if ( !src.ExpectTokenString( "," ) ) {
return false;
}
constraint->limitAngles[2] = src.ParseFloat();
constraint->limit = idDeclAF_Constraint::LIMIT_CONE;
} else if ( !token.Icmp( "friction" ) ) {
constraint->friction = src.ParseFloat();
} else if ( token == "}" ) {
break;
} else {
src.Error( "unknown token %s in hinge", token.c_str() );
return false;
}
}
return true;
}
示例13: ParseInOutStruct
/*
========================
ParseInOutStruct
========================
*/
void ParseInOutStruct( idLexer & src, int attribType, idList< inOutVariable_t > & inOutVars ) {
src.ExpectTokenString( "{" );
while( !src.CheckTokenString( "}" ) ) {
inOutVariable_t var;
idToken token;
src.ReadToken( &token );
var.type = token;
src.ReadToken( &token );
var.nameCg = token;
if ( !src.CheckTokenString( ":" ) ) {
src.SkipUntilString( ";" );
continue;
}
src.ReadToken( &token );
var.nameGLSL = token;
src.ExpectTokenString( ";" );
// convert the type
for ( int i = 0; typeConversion[i].typeCG != NULL; i++ ) {
if ( var.type.Cmp( typeConversion[i].typeCG ) == 0 ) {
var.type = typeConversion[i].typeGLSL;
break;
}
}
// convert the semantic to a GLSL name
for ( int i = 0; attribsPC[i].semantic != NULL; i++ ) {
if ( ( attribsPC[i].flags & attribType ) != 0 ) {
if ( var.nameGLSL.Cmp( attribsPC[i].semantic ) == 0 ) {
var.nameGLSL = attribsPC[i].glsl;
break;
}
}
}
// check if it was defined previously
var.declareInOut = true;
for ( int i = 0; i < inOutVars.Num(); i++ ) {
if ( var.nameGLSL == inOutVars[i].nameGLSL ) {
var.declareInOut = false;
break;
}
}
inOutVars.Append( var );
}
src.ExpectTokenString( ";" );
}
示例14: MatchAndAppendToken
/*
===================
MatchAndAppendToken
===================
*/
static void MatchAndAppendToken( idLexer &src, const char *match ) {
if ( !src.ExpectTokenString( match ) ) {
return;
}
// a matched token won't need a leading space
idStr::Append( parseBuffer, MAX_IMAGE_NAME, match );
}
示例15: ParseFloat
/*
============
idAASSettings::ParseFloat
============
*/
bool idAASSettings::ParseFloat( idLexer &src, float &f ) {
if ( !src.ExpectTokenString( "=" ) ) {
return false;
}
f = src.ParseFloat();
return true;
}