The CPPValue
Class Reference
A class representing a C-preprocessor value. More...
Declaration
class CPPValue { ... }
Enumerations Index
Public Constructors Index
Public Operators Index
Public Member Functions Index
Public Member Attributes Index
Private Member Attributes Index
Public Static Functions Index
Description
A class representing a C-preprocessor value.
Definition at line 23 of file cppvalue.h.
Enumerations
Type
- Enumeration values
-
Definition at line 26 of file cppvalue.h.
Public Constructors
CPPValue()
CPPValue::CPPValue (char c) |
|
inline
explicit
|
CPPValue()
CPPValue::CPPValue (long val=0) |
|
inline
explicit
|
CPPValue()
CPPValue::CPPValue (double val) |
|
inline
explicit
|
Public Operators
operator double()
CPPValue::operator double () |
|
inline
|
Definition at line 32 of file cppvalue.h.
32 operator double () const { return type==Int ? static_cast<double>(v.l) : v.d; }
References Int, type and v.
operator long()
CPPValue::operator long () |
|
inline
|
Definition at line 33 of file cppvalue.h.
33 operator long () const { return type==Int ? v.l : static_cast<long>(v.d); }
References Int, type and v.
Public Member Functions
isInt()
print()
Definition at line 37 of file cppvalue.h.
38 {
40 printf("(%ld)\n",v.l);
41 else
43 }
References Int, type and v.
Public Member Attributes
Private Member Attributes
type
union CPPValue CPPValue::v |
|
Public Static Functions
parseBinary()
CPPValue CPPValue::parseBinary (const std::string & token) |
|
static
|
Declaration at line 47 of file cppvalue.h, definition at line 54 of file cppvalue.cpp.
55{
56 long val = 0;
57 for (const char *p = token.c_str(); *p != 0; p++)
58 {
59 if (*p >= '0' && *p <= '1') val = val * 2 + *p - '0';
60 }
62}
Reference CPPValue.
parseCharacter()
CPPValue CPPValue::parseCharacter (const std::string & token) |
|
static
|
Declaration at line 48 of file cppvalue.h, definition at line 64 of file cppvalue.cpp.
65{
66 if (token[1]=='\\')
67 {
68 switch(token[2])
69 {
81 case '0':
82 case '1':
83 case '2':
84 case '3':
85 case '4':
86 case '5':
87 case '6':
88 case '7':
90 case 'x':
92 default: printf("Invalid escape sequence %s found!\n",token.c_str());
94 }
95 }
97}
References CPPValue, parseHexadecimal and parseOctal.
parseDecimal()
CPPValue CPPValue::parseDecimal (const std::string & token) |
|
static
|
Declaration at line 45 of file cppvalue.h, definition at line 31 of file cppvalue.cpp.
32{
33 long val = 0;
34 for (const char *p = token.c_str(); *p != 0; p++)
35 {
36 if (*p >= '0' && *p <= '9') val = val * 10 + *p - '0';
37 }
39}
Reference CPPValue.
parseFloat()
CPPValue CPPValue::parseFloat (const std::string & token) |
|
static
|
parseHexadecimal()
CPPValue CPPValue::parseHexadecimal (const std::string & token) |
|
static
|
Declaration at line 46 of file cppvalue.h, definition at line 41 of file cppvalue.cpp.
42{
43 long val = 0;
44 for (const char *p = token.c_str(); *p != 0; p++)
45 {
46 if (*p >= '0' && *p <= '9') val = val * 16 + *p - '0';
47 else if (*p >= 'a' && *p <= 'f') val = val * 16 + *p - 'a' + 10;
48 else if (*p >= 'A' && *p <= 'F') val = val * 16 + *p - 'A' + 10;
49 }
50
52}
Reference CPPValue.
Referenced by parseCharacter.
parseOctal()
CPPValue CPPValue::parseOctal (const std::string & token) |
|
static
|
Declaration at line 44 of file cppvalue.h, definition at line 21 of file cppvalue.cpp.
22{
23 long val = 0;
24 for (const char *p = token.c_str(); *p != 0; p++)
25 {
26 if (*p >= '0' && *p <= '7') val = val * 8 + *p - '0';
27 }
29}
Reference CPPValue.
Referenced by parseCharacter.
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus by Doxygen 1.14.0.