iOpenGEX: use std::string for grammar::token.

pull/614/head
Kim Kulling 2015-07-17 20:03:23 +02:00
parent f1a95d008b
commit 5c00aef7cd
1 changed files with 33 additions and 45 deletions

View File

@ -63,23 +63,23 @@ static const aiImporterDesc desc = {
};
namespace Grammar {
static const char *MetricType = "Metric";
static const char *Metric_DistanceType = "distance";
static const char *Metric_AngleType = "angle";
static const char *Metric_TimeType = "time";
static const char *Metric_UpType = "up";
static const char *NameType = "Name";
static const char *ObjectRefType = "ObjectRef";
static const char *MaterialRefType = "MaterialRef";
static const char *MetricKeyType = "key";
static const char *GeometryNodeType = "GeometryNode";
static const char *GeometryObjectType = "GeometryObject";
static const char *TransformType = "Transform";
static const char *MeshType = "Mesh";
static const char *VertexArrayType = "VertexArray";
static const char *IndexArrayType = "IndexArray";
static const char *MaterialType = "Material";
static const char *ColorType = "Color";
static const std::string MetricType = "Metric";
static const std::string Metric_DistanceType = "distance";
static const std::string Metric_AngleType = "angle";
static const std::string Metric_TimeType = "time";
static const std::string Metric_UpType = "up";
static const std::string NameType = "Name";
static const std::string ObjectRefType = "ObjectRef";
static const std::string MaterialRefType = "MaterialRef";
static const std::string MetricKeyType = "key";
static const std::string GeometryNodeType = "GeometryNode";
static const std::string GeometryObjectType = "GeometryObject";
static const std::string TransformType = "Transform";
static const std::string MeshType = "Mesh";
static const std::string VertexArrayType = "VertexArray";
static const std::string IndexArrayType = "IndexArray";
static const std::string MaterialType = "Material";
static const std::string ColorType = "Color";
static const std::string DiffuseColorToken = "diffuse";
static const std::string SpecularColorToken = "specular";
static const std::string EmissionColorToken = "emission";
@ -112,7 +112,7 @@ namespace Grammar {
TextureToken
};
static const char *ValidMetricToken[ 4 ] = {
static const std::string ValidMetricToken[ 4 ] = {
Metric_DistanceType,
Metric_AngleType,
Metric_TimeType,
@ -126,7 +126,7 @@ namespace Grammar {
int idx( -1 );
for( size_t i = 0; i < 4; i++ ) {
if( 0 == strncmp( ValidMetricToken[ i ], token, strlen( token ) ) ) {
if( ValidMetricToken[ i ] == token ) {
idx = (int) i;
break;
}
@ -136,45 +136,33 @@ namespace Grammar {
}
static TokenType matchTokenType( const char *tokenType ) {
if( 0 == strncmp( MetricType, tokenType, strlen( MetricType ) ) ) {
if( MetricType == tokenType ) {
return MetricToken;
} else if( 0 == strncmp( NameType, tokenType, strlen( NameType ) ) ) {
} else if( NameType == tokenType ) {
return NameToken;
}
else if( 0 == strncmp( ObjectRefType, tokenType, strlen( ObjectRefType ) ) ) {
} else if( ObjectRefType == tokenType ) {
return ObjectRefToken;
}
else if( 0 == strncmp( MaterialRefType, tokenType, strlen( MaterialRefType ) ) ) {
} else if( MaterialRefType == tokenType ) {
return MaterialRefToken;
}
else if( 0 == strncmp( MetricKeyType, tokenType, strlen( MetricKeyType ) ) ) {
} else if( MetricKeyType == tokenType ) {
return MetricKeyToken;
}
else if( 0 == strncmp( GeometryNodeType, tokenType, strlen( GeometryNodeType ) ) ) {
} else if( GeometryNodeType == tokenType ) {
return GeometryNodeToken;
}
else if( 0 == strncmp( GeometryObjectType, tokenType, strlen( GeometryObjectType ) ) ) {
} else if( GeometryObjectType == tokenType ) {
return GeometryObjectToken;
}
else if( 0 == strncmp( TransformType, tokenType, strlen( TransformType ) ) ) {
} else if( TransformType == tokenType ) {
return TransformToken;
}
else if( 0 == strncmp( MeshType, tokenType, strlen( MeshType ) ) ) {
} else if( MeshType == tokenType ) {
return MeshToken;
}
else if( 0 == strncmp( VertexArrayType, tokenType, strlen( VertexArrayType ) ) ) {
} else if( VertexArrayType == tokenType ) {
return VertexArrayToken;
}
else if( 0 == strncmp( IndexArrayType, tokenType, strlen( IndexArrayType ) ) ) {
} else if( IndexArrayType == tokenType ) {
return IndexArrayToken;
}
else if( 0 == strncmp( MaterialType, tokenType, strlen( MaterialType ) ) ) {
} else if( MaterialType == tokenType ) {
return MaterialToken;
}
else if( 0 == strncmp( ColorType, tokenType, strlen( ColorType ) ) ) {
} else if( ColorType == tokenType ) {
return ColorToken;
}
else if( 0 == strncmp( TextureType, tokenType, strlen( TextureType ) ) ) {
} else if( TextureType == tokenType ) {
return TextureToken;
}