EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
str2conv.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename T >
str2 (const char *str)
 Generic string conversion template. More...
 
template<typename T >
str2 (const std::string &str)
 Generic string conversion template. More...
 
template<>
bool str2< bool > (const char *str)
 Converts string to boolean. More...
 
template<>
int8 str2< int8 > (const char *str)
 Converts string to integer. More...
 
template<>
int16 str2< int16 > (const char *str)
 Converts string to integer. More...
 
template<>
int32 str2< int32 > (const char *str)
 Converts string to integer. More...
 
template<>
int64 str2< int64 > (const char *str)
 Converts string to integer. More...
 
template<>
uint8 str2< uint8 > (const char *str)
 Converts string to unsigned integer. More...
 
template<>
uint16 str2< uint16 > (const char *str)
 Converts string to unsigned integer. More...
 
template<>
uint32 str2< uint32 > (const char *str)
 Converts string to unsigned integer. More...
 
template<>
float str2< float > (const char *str)
 Converts string to unsigned integer. More...
 
template<>
double str2< double > (const char *str)
 Converts string to real number. More...
 
template<>
long double str2< long double > (const char *str)
 Converts string to real number. More...
 

Function Documentation

template<typename T >
T str2 ( const char *  str)

Generic string conversion template.

Try to use T( const char* ) directly.

Parameters
[in]strString to be converted.
Avalue corresponding to content of str.

Definition at line 39 of file str2conv.h.

Referenced by EntityList::GetAnomalyID().

39 { return T( str ); }

Here is the caller graph for this function:

template<typename T >
T str2 ( const std::string &  str)

Generic string conversion template.

Redirect to str2( const char* ).

Parameters
[in]strString to be converted.
Avalue corresponding to content of str.

Definition at line 50 of file str2conv.h.

50 { return str2< T >( str.c_str() ); }
template<>
bool str2< bool > ( const char *  str)

Converts string to boolean.

Parameters
[in]strString to be converted.
Aboolean corresponding to content of str.

Definition at line 31 of file str2conv.cpp.

References strcasecmp.

Referenced by ClassDecodeGenerator::ProcessDict(), ClassEncodeGenerator::ProcessDict(), ClassDecodeGenerator::ProcessDictInline(), ClassDecodeGenerator::ProcessList(), ClassEncodeGenerator::ProcessList(), ClassDecodeGenerator::ProcessObject(), ClassEncodeGenerator::ProcessObject(), ClassDecodeGenerator::ProcessObjectEx(), ClassEncodeGenerator::ProcessObjectEx(), ClassDecodeGenerator::ProcessToken(), ClassEncodeGenerator::ProcessToken(), ClassDecodeGenerator::ProcessTuple(), and ClassEncodeGenerator::ProcessTuple().

32 {
33  if( !::strcasecmp( str, "true" ) )
34  return true;
35  else if( !::strcasecmp( str, "false" ) )
36  return false;
37  else if( !::strcasecmp( str, "yes" ) )
38  return true;
39  else if( !::strcasecmp( str, "no" ) )
40  return false;
41  else if( !::strcasecmp( str, "y" ) )
42  return true;
43  else if( !::strcasecmp( str, "n" ) )
44  return false;
45  else if( !::strcasecmp( str, "on" ) )
46  return true;
47  else if( !::strcasecmp( str, "off" ) )
48  return false;
49  else if( !::strcasecmp( str, "enable" ) )
50  return true;
51  else if( !::strcasecmp( str, "disable" ) )
52  return false;
53  else if( !::strcasecmp( str, "enabled" ) )
54  return true;
55  else if( !::strcasecmp( str, "disabled" ) )
56  return false;
57  else if( str2< int >( str ) )
58  return true;
59  else
60  return false;
61 }
#define strcasecmp
Definition: eve-compat.h:262

Here is the caller graph for this function:

template<>
double str2< double > ( const char *  str)

Converts string to real number.

Parameters
[in]strString to be converted.
Returns
A real number corresponding to content of str.
template<>
float str2< float > ( const char *  str)

Converts string to unsigned integer.

Parameters
[in]strString to be converted.
Returns
An unsigned integer corresponding to content of str. Converts string to real number.
Parameters
[in]strString to be converted.
Returns
A real number corresponding to content of str.
template<>
int16 str2< int16 > ( const char *  str)

Converts string to integer.

Parameters
[in]strString to be converted.
Returns
An integer corresponding to content of str.
template<>
int32 str2< int32 > ( const char *  str)

Converts string to integer.

Parameters
[in]strString to be converted.
Returns
An integer corresponding to content of str.
template<>
int64 str2< int64 > ( const char *  str)

Converts string to integer.

Parameters
[in]strString to be converted.
Returns
An integer corresponding to content of str.
template<>
int8 str2< int8 > ( const char *  str)

Converts string to integer.

Parameters
[in]strString to be converted.
Returns
An integer corresponding to content of str.
template<>
long double str2< long double > ( const char *  str)

Converts string to real number.

Parameters
[in]strString to be converted.
Returns
A real number corresponding to content of str.
template<>
uint16 str2< uint16 > ( const char *  str)

Converts string to unsigned integer.

Parameters
[in]strString to be converted.
Returns
An unsigned integer corresponding to content of str.
template<>
uint32 str2< uint32 > ( const char *  str)

Converts string to unsigned integer.

Parameters
[in]strString to be converted.
Returns
An unsigned integer corresponding to content of str.
template<>
uint8 str2< uint8 > ( const char *  str)

Converts string to unsigned integer.

Parameters
[in]strString to be converted.
Returns
An unsigned integer corresponding to content of str.