|
inlib
1.2.0
|

Public Types | |
| enum | e_type { NONE = 0, UNSIGNED_SHORT = 12, SHORT = 13, UNSIGNED_INT = 14, INT = 15, UNSIGNED_INT64 = 16, INT64 = 17, FLOAT = 30, DOUBLE = 31, BOOL = 50, STRING = 51, VOID_STAR = 100, DOUBLE_STAR = 101, FLOAT_STAR = 102, INT_STAR = 103, ARRAY_UNSIGNED_SHORT = 1012, ARRAY_SHORT = 1013, ARRAY_UNSIGNED_INT = 1014, ARRAY_INT = 1015, ARRAY_UNSIGNED_INT64 = 1016, ARRAY_INT64 = 1017, ARRAY_FLOAT = 1030, ARRAY_DOUBLE = 1031, ARRAY_BOOL = 1050, ARRAY_STRING = 1051 } |
Public Member Functions | |
| value () | |
| value (bool a_value) | |
| value (short a_value) | |
| value (int a_value) | |
| value (int64 a_value) | |
| value (uint64 a_value) | |
| value (float a_value) | |
| value (double a_value) | |
| value (unsigned short a_value) | |
| value (unsigned int a_value) | |
| value (void *a_value) | |
| value (double *a_value) | |
| value (float *a_value) | |
| value (int *a_value) | |
| value (const char *a_value) | |
| value (const std::string &a_value) | |
| virtual | ~value () |
| value (const value &a_from) | |
| value & | operator= (const value &a_from) |
| void | set_label (const std::string &a_s) |
| std::string | label () const |
| e_type | type () const |
| void | set_type (e_type a_type) |
| void | set (void *a_value) |
| unsigned char | get_unsigned_char () const |
| char | get_char () const |
| unsigned int | get_unsigned_int () const |
| int | get_int () const |
| int64 | get_int64 () const |
| uint64 | get_unsigned_int64 () const |
| unsigned short | get_unsigned_short () const |
| short | get_short () const |
| float | get_float () const |
| double | get_double () const |
| void * | get_void_star () const |
| double * | get_double_star () const |
| float * | get_float_star () const |
| int * | get_int_star () const |
| bool | get_bool () const |
| std::string | get_string () const |
| bool | s_type (std::string &a_s) const |
| bool | tos (std::string &a_s) const |
Static Public Member Functions | |
| static bool | s_type (inlib::value::e_type a_type, std::string &a_s) |
| static bool | tos (const value &a_v, std::string &a_s) |
Protected Member Functions | |
| void | reset () |
Protected Attributes | |
| std::string * | m_label |
| e_type | m_type |
| union { | |
| bool m_bool | |
| char m_char | |
| int m_int | |
| short m_short | |
| int64 m_int64 | |
| float m_float | |
| double m_double | |
| unsigned char m_unsigned_char | |
| unsigned short m_unsigned_short | |
| unsigned int m_unsigned_int | |
| uint64 m_unsigned_int64 | |
| void * m_void_star | |
| double * m_double_star | |
| float * m_float_star | |
| int * m_int_star | |
| std::string * m_string | |
| inlib::array< unsigned char > * m_array_unsigned_char | |
| inlib::array< char > * m_array_char | |
| inlib::array< unsigned short > * m_array_unsigned_short | |
| inlib::array< short > * m_array_short | |
| inlib::array< uint64 > * m_array_unsigned_int64 | |
| inlib::array< int64 > * m_array_int64 | |
| inlib::array< unsigned int > * m_array_unsigned_int | |
| inlib::array< int > * m_array_int | |
| inlib::array< float > * m_array_float | |
| inlib::array< double > * m_array_double | |
| inlib::array< bool > * m_array_bool | |
| inlib::array< std::string > * m_array_string | |
| } | u |
| enum inlib::value::e_type |
Definition at line 25 of file value.
{
NONE = 0,
// integers :
//UNSIGNED_CHAR = 10,
//CHAR = 11,
UNSIGNED_SHORT = 12,
SHORT = 13,
UNSIGNED_INT = 14,
INT = 15,
UNSIGNED_INT64 = 16,
INT64 = 17,
// reals :
FLOAT = 30,
DOUBLE = 31,
// else :
BOOL = 50,
STRING = 51,
// pointers :
VOID_STAR = 100,
DOUBLE_STAR = 101,
FLOAT_STAR = 102,
INT_STAR = 103,
// multidimensional vectors (1000+base type) :
//ARRAY_UNSIGNED_CHAR = 1010,
//ARRAY_CHAR = 1011,
ARRAY_UNSIGNED_SHORT = 1012,
ARRAY_SHORT = 1013,
ARRAY_UNSIGNED_INT = 1014,
ARRAY_INT = 1015,
ARRAY_UNSIGNED_INT64 = 1016,
ARRAY_INT64 = 1017,
ARRAY_FLOAT = 1030,
ARRAY_DOUBLE = 1031,
ARRAY_BOOL = 1050,
ARRAY_STRING = 1051
};
| inlib::value::value | ( | ) | [inline] |
| inlib::value::value | ( | bool | a_value | ) | [inline] |
| inlib::value::value | ( | short | a_value | ) | [inline] |
| inlib::value::value | ( | int | a_value | ) | [inline] |
| inlib::value::value | ( | int64 | a_value | ) | [inline] |
| inlib::value::value | ( | uint64 | a_value | ) | [inline] |
| inlib::value::value | ( | float | a_value | ) | [inline] |
| inlib::value::value | ( | double | a_value | ) | [inline] |
| inlib::value::value | ( | unsigned short | a_value | ) | [inline] |
| inlib::value::value | ( | unsigned int | a_value | ) | [inline] |
| inlib::value::value | ( | void * | a_value | ) | [inline] |
| inlib::value::value | ( | double * | a_value | ) | [inline] |
| inlib::value::value | ( | float * | a_value | ) | [inline] |
| inlib::value::value | ( | int * | a_value | ) | [inline] |
| inlib::value::value | ( | const char * | a_value | ) | [inline] |
| inlib::value::value | ( | const std::string & | a_value | ) | [inline] |
| virtual inlib::value::~value | ( | ) | [inline, virtual] |
| inlib::value::value | ( | const value & | a_from | ) | [inline] |
Definition at line 236 of file value.
:m_label(0){ #ifdef INLIB_MEM mem::increment(s_class().c_str()); #endif if(a_from.m_label) m_label = new std::string(*a_from.m_label); m_type = a_from.m_type; if(a_from.m_type==STRING) { u.m_string = new std::string(*a_from.u.m_string); //} else if(a_from.m_type==ARRAY_UNSIGNED_CHAR) { // u.m_array_unsigned_char = // new array<unsigned char>(*a_from.u.m_array_unsigned_char); //} else if(a_from.m_type==ARRAY_CHAR) { // u.m_array_char = new array<char>(*a_from.u.m_array_char); } else if(a_from.m_type==ARRAY_UNSIGNED_SHORT) { u.m_array_unsigned_short = new array<unsigned short>(*a_from.u.m_array_unsigned_short); } else if(a_from.m_type==ARRAY_SHORT) { u.m_array_short = new array<short>(*a_from.u.m_array_short); } else if(a_from.m_type==ARRAY_UNSIGNED_INT) { u.m_array_unsigned_int = new array<unsigned int>(*a_from.u.m_array_unsigned_int); } else if(a_from.m_type==ARRAY_INT) { u.m_array_int = new array<int>(*a_from.u.m_array_int); } else if(a_from.m_type==ARRAY_UNSIGNED_INT64) { u.m_array_unsigned_int64 = new array<uint64>(*a_from.u.m_array_unsigned_int64); } else if(a_from.m_type==ARRAY_INT64) { u.m_array_int64 = new array<int64>(*a_from.u.m_array_int64); } else if(a_from.m_type==ARRAY_FLOAT) { u.m_array_float = new array<float>(*a_from.u.m_array_float); } else if(a_from.m_type==ARRAY_DOUBLE) { u.m_array_double = new array<double>(*a_from.u.m_array_double); } else if(a_from.m_type==ARRAY_BOOL) { u.m_array_bool = new array<bool>(*a_from.u.m_array_bool); } else if(a_from.m_type==ARRAY_STRING) { u.m_array_string = new array<std::string>(*a_from.u.m_array_string); } else { u = a_from.u; } }
| bool inlib::value::get_bool | ( | ) | const [inline] |
| char inlib::value::get_char | ( | ) | const [inline] |
| double inlib::value::get_double | ( | ) | const [inline] |
| double* inlib::value::get_double_star | ( | ) | const [inline] |
| float inlib::value::get_float | ( | ) | const [inline] |
| float* inlib::value::get_float_star | ( | ) | const [inline] |
| int inlib::value::get_int | ( | ) | const [inline] |
| int64 inlib::value::get_int64 | ( | ) | const [inline] |
| int* inlib::value::get_int_star | ( | ) | const [inline] |
| short inlib::value::get_short | ( | ) | const [inline] |
| std::string inlib::value::get_string | ( | ) | const [inline] |
| unsigned char inlib::value::get_unsigned_char | ( | ) | const [inline] |
| unsigned int inlib::value::get_unsigned_int | ( | ) | const [inline] |
| uint64 inlib::value::get_unsigned_int64 | ( | ) | const [inline] |
| unsigned short inlib::value::get_unsigned_short | ( | ) | const [inline] |
| void* inlib::value::get_void_star | ( | ) | const [inline] |
| std::string inlib::value::label | ( | ) | const [inline] |
Definition at line 292 of file value.
{
delete m_label;
m_label = 0;
if(a_from.m_label) m_label = new std::string(*a_from.m_label);
reset();
m_type = a_from.m_type;
if(a_from.m_type==STRING) {
u.m_string = new std::string(*a_from.u.m_string);
//} else if(a_from.m_type==ARRAY_UNSIGNED_CHAR) {
// u.m_array_unsigned_char =
// new array<unsigned char>(*a_from.u.m_array_unsigned_char);
//} else if(a_from.m_type==ARRAY_CHAR) {
// u.m_array_char = new array<char>(*a_from.u.m_array_char);
} else if(a_from.m_type==ARRAY_UNSIGNED_SHORT) {
u.m_array_unsigned_short =
new array<unsigned short>(*a_from.u.m_array_unsigned_short);
} else if(a_from.m_type==ARRAY_SHORT) {
u.m_array_short = new array<short>(*a_from.u.m_array_short);
} else if(a_from.m_type==ARRAY_UNSIGNED_INT) {
u.m_array_unsigned_int =
new array<unsigned int>(*a_from.u.m_array_unsigned_int);
} else if(a_from.m_type==ARRAY_INT) {
u.m_array_int = new array<int>(*a_from.u.m_array_int);
} else if(a_from.m_type==ARRAY_UNSIGNED_INT64) {
u.m_array_unsigned_int64 =
new array<uint64>(*a_from.u.m_array_unsigned_int64);
} else if(a_from.m_type==ARRAY_INT64) {
u.m_array_int64 = new array<int64>(*a_from.u.m_array_int64);
} else if(a_from.m_type==ARRAY_FLOAT) {
u.m_array_float = new array<float>(*a_from.u.m_array_float);
} else if(a_from.m_type==ARRAY_DOUBLE) {
u.m_array_double = new array<double>(*a_from.u.m_array_double);
} else if(a_from.m_type==ARRAY_BOOL) {
u.m_array_bool = new array<bool>(*a_from.u.m_array_bool);
} else if(a_from.m_type==ARRAY_STRING) {
u.m_array_string = new array<std::string>(*a_from.u.m_array_string);
} else {
u = a_from.u;
}
return *this;
}
| void inlib::value::reset | ( | ) | [inline, protected] |
Definition at line 566 of file value.
{
if(m_type==STRING) {
delete u.m_string;
u.m_string = 0;
//} else if(m_type==ARRAY_UNSIGNED_CHAR) {
// delete u.m_array_unsigned_char;u.m_array_unsigned_char = 0;
//} else if(m_type==ARRAY_CHAR) {
// delete u.m_array_char;u.m_array_char = 0;
} else if(m_type==ARRAY_UNSIGNED_SHORT) {
delete u.m_array_unsigned_short;u.m_array_unsigned_short = 0;
} else if(m_type==ARRAY_SHORT) {
delete u.m_array_short;u.m_array_short = 0;
} else if(m_type==ARRAY_UNSIGNED_INT) {
delete u.m_array_unsigned_int;u.m_array_unsigned_int = 0;
} else if(m_type==ARRAY_INT) {
delete u.m_array_int;u.m_array_int = 0;
} else if(m_type==ARRAY_UNSIGNED_INT64) {
delete u.m_array_unsigned_int64;u.m_array_unsigned_int64 = 0;
} else if(m_type==ARRAY_INT64) {
delete u.m_array_int64;u.m_array_int64 = 0;
} else if(m_type==ARRAY_FLOAT) {
delete u.m_array_float;u.m_array_float = 0;
} else if(m_type==ARRAY_DOUBLE) {
delete u.m_array_double;u.m_array_double = 0;
} else if(m_type==ARRAY_BOOL) {
delete u.m_array_bool;u.m_array_bool = 0;
} else if(m_type==ARRAY_STRING) {
delete u.m_array_string;u.m_array_string = 0;
} else {
u.m_unsigned_int64 = 0;
}
}
| bool inlib::value::s_type | ( | std::string & | a_s | ) | const [inline] |
| static bool inlib::value::s_type | ( | inlib::value::e_type | a_type, |
| std::string & | a_s | ||
| ) | [inline, static] |
Definition at line 427 of file value.
{
switch(a_type) {
case NONE:a_s = "NONE";return true;
case INT:a_s = "INT";return true;
case INT64:a_s = "INT64";return true;
case DOUBLE:a_s = "DOUBLE";return true;
case STRING:a_s = "STRING";return true;
case VOID_STAR:a_s = "VOID_STAR";return true;
case DOUBLE_STAR:a_s = "DOUBLE_STAR";return true;
case FLOAT_STAR:a_s = "FLOAT_STAR";return true;
case INT_STAR:a_s = "INT_STAR";return true;
case BOOL:a_s = "BOOL";return true;
case SHORT:a_s = "SHORT";return true;
case FLOAT:a_s = "FLOAT";return true;
//case CHAR:a_s = "CHAR";return true;
//case UNSIGNED_CHAR:a_s = "UNSIGNED_CHAR";return true;
case UNSIGNED_SHORT:a_s = "UNSIGNED_SHORT";return true;
case UNSIGNED_INT:a_s = "UNSIGNED_INT";return true;
case UNSIGNED_INT64:a_s = "UNSIGNED_INT64";return true;
//case ARRAY_UNSIGNED_CHAR:a_s = "ARRAY_UNSIGNED_CHAR";return true;
//case ARRAY_CHAR:a_s = "ARRAY_CHAR";return true;
case ARRAY_UNSIGNED_SHORT:a_s = "ARRAY_UNSIGNED_SHORT";return true;
case ARRAY_SHORT:a_s = "ARRAY_SHORT";return true;
case ARRAY_UNSIGNED_INT:a_s = "ARRAY_UNSIGNED_INT";return true;
case ARRAY_INT:a_s = "ARRAY_INT";return true;
case ARRAY_UNSIGNED_INT64:a_s = "ARRAY_UNSIGNED_INT64";return true;
case ARRAY_INT64:a_s = "ARRAY_INT64";return true;
case ARRAY_FLOAT:a_s = "ARRAY_FLOAT";return true;
case ARRAY_DOUBLE:a_s = "ARRAY_DOUBLE";return true;
case ARRAY_BOOL:a_s = "ARRAY_BOOL";return true;
case ARRAY_STRING:a_s = "ARRAY_STRING";return true;
default:a_s.clear();return false;
}
}
| void inlib::value::set | ( | void * | a_value | ) | [inline] |
| void inlib::value::set_label | ( | const std::string & | a_s | ) | [inline] |
| void inlib::value::set_type | ( | e_type | a_type | ) | [inline] |
Definition at line 357 of file value.
{
reset();
m_type = a_type;
switch(a_type) {
case NONE: u.m_unsigned_int64 = 0;break;
//case UNSIGNED_CHAR: u.m_unsigned_char = 0;break;
//case CHAR: u.m_char = 0;break;
case UNSIGNED_SHORT: u.m_unsigned_short = 0;break;
case SHORT: u.m_short = 0;break;
case UNSIGNED_INT: u.m_unsigned_int = 0;break;
case INT: u.m_int = 0;break;
case UNSIGNED_INT64: u.m_unsigned_int64 =0;break;
case INT64: u.m_int64 = 0;break;
case FLOAT: u.m_float = 0;break;
case DOUBLE: u.m_double = 0;break;
case BOOL: u.m_bool = false;break;
case VOID_STAR: u.m_void_star = 0;break;
case DOUBLE_STAR: u.m_double_star = 0;break;
case FLOAT_STAR: u.m_float_star = 0;break;
case INT_STAR: u.m_int_star = 0;break;
case STRING: u.m_string = new std::string("");break;
//case ARRAY_UNSIGNED_CHAR:
// u.m_array_unsigned_char = new inlib::array<unsigned char>();break;
//case ARRAY_CHAR:u.m_array_char = new inlib::array<char>();break;
case ARRAY_UNSIGNED_SHORT:
u.m_array_unsigned_short = new inlib::array<unsigned short>();break;
case ARRAY_SHORT:u.m_array_short = new inlib::array<short>();break;
case ARRAY_UNSIGNED_INT:
u.m_array_unsigned_int = new inlib::array<unsigned int>();break;
case ARRAY_INT:u.m_array_int = new inlib::array<int>();break;
case ARRAY_UNSIGNED_INT64:
u.m_array_unsigned_int64 = new inlib::array<uint64>();break;
case ARRAY_INT64:u.m_array_int64 = new inlib::array<int64>();break;
case ARRAY_FLOAT:u.m_array_float = new inlib::array<float>();break;
case ARRAY_DOUBLE:u.m_array_double = new inlib::array<double>();break;
case ARRAY_BOOL:u.m_array_bool = new inlib::array<bool>();break;
case ARRAY_STRING:u.m_array_string = new inlib::array<std::string>();break;
}
}
| bool inlib::value::tos | ( | std::string & | a_s | ) | const [inline] |
| static bool inlib::value::tos | ( | const value & | a_v, |
| std::string & | a_s | ||
| ) | [inline, static] |
Definition at line 464 of file value.
{
switch(a_v.m_type) {
case NONE:
inlib::sprintf(a_s,5,"(nil)");
return true;
case INT:
inlib::sprintf(a_s,16,"%d",a_v.u.m_int);
return true;
case DOUBLE:
inlib::sprintf(a_s,16,"%g",a_v.u.m_double);
return true;
case VOID_STAR:
inlib::sprintf(a_s,16,"0x%lx",(unsigned long)a_v.u.m_void_star);
return true;
case UNSIGNED_SHORT:
inlib::sprintf(a_s,16,"%u",a_v.u.m_unsigned_short);
return true;
case UNSIGNED_INT:
inlib::sprintf(a_s,16,"%u",a_v.u.m_unsigned_int);
return true;
case BOOL:
inlib::sprintf(a_s,5,"%s",a_v.u.m_bool?"true":"false");
return true;
case SHORT:
inlib::sprintf(a_s,16,"%d",a_v.u.m_short);
return true;
case INT64:
inlib::sprintf(a_s,16,inlib::int64_format(),a_v.u.m_int64);
return true;
case UNSIGNED_INT64:
inlib::sprintf(a_s,16,inlib::int64_format(),a_v.u.m_unsigned_int64);
return true;
case FLOAT:
inlib::sprintf(a_s,16,"%g",a_v.u.m_float);
return true;
//case UNSIGNED_CHAR:
// inlib::sprintf(a_s,16,"%c",a_v.u.m_unsigned_char);
// return true;
//case CHAR:
// inlib::sprintf(a_s,16,"%c",a_v.u.m_char);
// return true;
case DOUBLE_STAR:
inlib::sprintf(a_s,16,"0x%lx",(unsigned long)a_v.u.m_double_star);
return true;
case FLOAT_STAR:
inlib::sprintf(a_s,16,"0x%lx",(unsigned long)a_v.u.m_float_star);
return true;
case INT_STAR:
inlib::sprintf(a_s,16,"0x%lx",(unsigned long)a_v.u.m_int_star);
return true;
case STRING:
a_s = *a_v.u.m_string;
return true;
//case ARRAY_UNSIGNED_CHAR:
// a_s = inlib::tos<unsigned char>(a_v.u.m_array_unsigned_char->vector());
// return true;
//case ARRAY_CHAR:
// a_s = inlib::tos<char>(a_v.u.m_array_char->vector());
// return true;
case ARRAY_UNSIGNED_SHORT:
a_s = inlib::tos<unsigned short>(a_v.u.m_array_unsigned_short->vector());
return true;
case ARRAY_SHORT:
a_s = inlib::tos<short>(a_v.u.m_array_short->vector());
return true;
case ARRAY_UNSIGNED_INT:
a_s = inlib::tos<unsigned int>(a_v.u.m_array_unsigned_int->vector());
return true;
case ARRAY_INT:
a_s = inlib::tos<int>(a_v.u.m_array_int->vector());
return true;
case ARRAY_UNSIGNED_INT64:
a_s = inlib::tos<uint64>(a_v.u.m_array_unsigned_int64->vector());
return true;
case ARRAY_INT64:
a_s = inlib::tos<int64>(a_v.u.m_array_int64->vector());
return true;
case ARRAY_FLOAT:
a_s = inlib::tos<float>(a_v.u.m_array_float->vector());
return true;
case ARRAY_DOUBLE:
a_s = inlib::tos<double>(a_v.u.m_array_double->vector());
return true;
case ARRAY_BOOL:
a_s = inlib::tos<bool>(a_v.u.m_array_bool->vector());
return true;
case ARRAY_STRING:
a_s = inlib::tos<std::string>(a_v.u.m_array_string->vector());
return true;
default:
a_s.clear();
return false;
}
}
| inlib::array<double>* inlib::value::m_array_double |
| inlib::array<std::string>* inlib::value::m_array_string |
| inlib::array<unsigned char>* inlib::value::m_array_unsigned_char |
| inlib::array<unsigned int>* inlib::value::m_array_unsigned_int |
| inlib::array<unsigned short>* inlib::value::m_array_unsigned_short |
| bool inlib::value::m_bool |
| char inlib::value::m_char |
| double inlib::value::m_double |
| double* inlib::value::m_double_star |
| float inlib::value::m_float |
| float* inlib::value::m_float_star |
std::string* inlib::value::m_label [protected] |
| short inlib::value::m_short |
| std::string* inlib::value::m_string |
e_type inlib::value::m_type [protected] |
| unsigned char inlib::value::m_unsigned_char |
| unsigned int inlib::value::m_unsigned_int |
| unsigned short inlib::value::m_unsigned_short |
union { ... } inlib::value::u [protected] |
1.7.5.1