Public Types | Public Member Functions | Private Attributes | List of all members
CPPValue Class Reference

#include <cppvalue.h>

Public Types

enum  Type { Int, Float }
 

Public Member Functions

 CPPValue (long val=0)
 
 CPPValue (double val)
 
 operator double () const
 
 operator long () const
 
bool isInt () const
 
void print () const
 

Private Attributes

Type type
 
union {
   double   d
 
   long   l
 
v
 

Detailed Description

A class representing a C-preprocessor value.

Definition at line 26 of file cppvalue.h.

Member Enumeration Documentation

Enumerator
Int 
Float 

Definition at line 29 of file cppvalue.h.

29 { Int, Float };
DftData::Float Float

Constructor & Destructor Documentation

CPPValue::CPPValue ( long  val = 0)
inline

Definition at line 31 of file cppvalue.h.

31 : type(Int) { v.l = val; }
union CPPValue::@7 v
Type type
Definition: cppvalue.h:48
CPPValue::CPPValue ( double  val)
inline

Definition at line 32 of file cppvalue.h.

32 : type(Float) { v.d = val; }
union CPPValue::@7 v
DftData::Float Float
Type type
Definition: cppvalue.h:48

Member Function Documentation

bool CPPValue::isInt ( ) const
inline

Definition at line 37 of file cppvalue.h.

37 { return type == Int; }
CPPValue::operator double ( ) const
inline

Definition at line 34 of file cppvalue.h.

34 { return type==Int ? (double)v.l : v.d; }
union CPPValue::@7 v
CPPValue::operator long ( ) const
inline

Definition at line 35 of file cppvalue.h.

35 { return type==Int ? v.l : (long)v.d; }
union CPPValue::@7 v
void CPPValue::print ( ) const
inline

Definition at line 39 of file cppvalue.h.

40  {
41  if (type==Int)
42  printf("(%ld)\n",v.l);
43  else
44  printf("(%f)\n",v.d);
45  }
union CPPValue::@7 v

Member Data Documentation

double CPPValue::d

Definition at line 50 of file cppvalue.h.

long CPPValue::l

Definition at line 51 of file cppvalue.h.

Type CPPValue::type
private

Definition at line 48 of file cppvalue.h.

union { ... } CPPValue::v

The documentation for this class was generated from the following file: