Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
doxygen-1.8.11
src
cppvalue.h
Go to the documentation of this file.
1
/******************************************************************************
2
*
3
*
4
*
5
*
6
* Copyright (C) 1997-2015 by Dimitri van Heesch.
7
*
8
* Permission to use, copy, modify, and distribute this software and its
9
* documentation under the terms of the GNU General Public License is hereby
10
* granted. No representations are made about the suitability of this software
11
* for any purpose. It is provided "as is" without express or implied warranty.
12
* See the GNU General Public License for more details.
13
*
14
* Documents produced by Doxygen are derivative works derived from the
15
* input used in their production; they are not affected by this license.
16
*
17
*/
18
19
#ifndef _CPPVALUE_H
20
#define _CPPVALUE_H
21
22
#include <stdio.h>
23
#include <
qglobal.h
>
24
25
/** A class representing a C-preprocessor value. */
26
class
CPPValue
27
{
28
public
:
29
enum
Type
{
Int
,
Float
};
30
31
CPPValue
(
long
val
=0) :
type
(
Int
) {
v
.l =
val
; }
32
CPPValue
(
double
val
) :
type
(Float) {
v
.d =
val
; }
33
34
operator
double ()
const
{
return
type
==
Int
? (double)
v
.l :
v
.d; }
35
operator
long ()
const
{
return
type
==
Int
?
v
.l : (long)
v
.d; }
36
37
bool
isInt
()
const
{
return
type
==
Int
; }
38
39
void
print
()
const
40
{
41
if
(
type
==
Int
)
42
printf(
"(%ld)\n"
,
v
.l);
43
else
44
printf(
"(%f)\n"
,
v
.d);
45
}
46
47
private
:
48
Type
type
;
49
union
{
50
double
d
;
51
long
l
;
52
}
v
;
53
};
54
55
extern
CPPValue
parseOctal
();
56
extern
CPPValue
parseDecimal
();
57
extern
CPPValue
parseHexadecimal
();
58
extern
CPPValue
parseCharacter
();
59
extern
CPPValue
parseFloat
();
60
61
#endif
val
Definition:
registry_via_id_test_2.cc:15
CPPValue
Definition:
cppvalue.h:26
parseCharacter
CPPValue parseCharacter()
Definition:
cppvalue.cpp:57
Int
Definition:
registry_via_id_test.cc:23
CPPValue::print
void print() const
Definition:
cppvalue.h:39
CPPValue::Int
Definition:
cppvalue.h:29
CPPValue::CPPValue
CPPValue(long val=0)
Definition:
cppvalue.h:31
qglobal.h
type
Definition:
ShowerProducedPtrsHolder.hh:36
CPPValue::d
double d
Definition:
cppvalue.h:50
testsqlite3.val
list val
Definition:
testsqlite3.py:13
parseDecimal
CPPValue parseDecimal()
Definition:
cppvalue.cpp:34
CPPValue::Type
Type
Definition:
cppvalue.h:29
CPPValue::CPPValue
CPPValue(double val)
Definition:
cppvalue.h:32
CPPValue::isInt
bool isInt() const
Definition:
cppvalue.h:37
CPPValue::v
union CPPValue::@7 v
parseOctal
CPPValue parseOctal()
Definition:
cppvalue.cpp:24
Float
DftData::Float Float
Definition:
test_FftwReal2dDftData.cxx:29
CPPValue::l
long l
Definition:
cppvalue.h:51
parseFloat
CPPValue parseFloat()
Definition:
cppvalue.cpp:92
CPPValue::type
Type type
Definition:
cppvalue.h:48
parseHexadecimal
CPPValue parseHexadecimal()
Definition:
cppvalue.cpp:44
Generated by
1.8.11