EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
str2conv.cpp File Reference
#include "eve-core.h"
#include "utils/str2conv.h"
Include dependency graph for str2conv.cpp:

Go to the source code of this file.

Macros

#define STR2(type, fmt)
 

Functions

template<>
bool str2< bool > (const char *str)
 Converts string to boolean. More...
 

Macro Definition Documentation

#define STR2 (   type,
  fmt 
)
Value:
template<> \
type str2< type >( const char* str ) \
{ \
type v = 0; \
::sscanf( str, "%" fmt, &v ); \
return v; \
}

Definition at line 63 of file str2conv.cpp.

Function Documentation

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: