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