commit x64 compilation from lulu cause the other branch dont seems to compile properly at home
This commit is contained in:
29
include/platform/reflection/nenum_string.cpp
Normal file
29
include/platform/reflection/nenum_string.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#include "reflection/nenum_string.h"
|
||||
#include "nstring/nstring.h"
|
||||
|
||||
using namespace GS::Reflection;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
const char *Enum::toString(int v, Dict *dict)
|
||||
{
|
||||
for (int n = 0; dict[n].string_v; ++n)
|
||||
if (dict[n].enum_v == v)
|
||||
return dict[n].string_v;
|
||||
return 0;
|
||||
}
|
||||
int Enum::fromString(const char *s, Dict *dict)
|
||||
{
|
||||
GS::String string_v(s);
|
||||
for (int n = 0; dict[n].string_v; ++n)
|
||||
if (string_v == dict[n].string_v)
|
||||
return dict[n].enum_v;
|
||||
return -1;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user