KrisLibrary  1.0.0
PrimitiveValue.h
1 #ifndef PRIMITIVE_VALUE_H
2 #define PRIMITIVE_VALUE_H
3 
4 #include <string>
5 #include <iosfwd>
6 using namespace std;
7 
12 {
13  public:
14  enum { None, Integer, Double, String };
15 
17  PrimitiveValue(int i);
18  PrimitiveValue(double v);
19  PrimitiveValue(const string& str);
20  bool HasType(int _type) const { return type == _type; }
21  bool CanCast(int _type) const;
22  bool IsNumeric() const;
23  operator const int& () const;
24  operator int& ();
25  operator const double& () const;
26  operator double& ();
27  operator const string& () const;
28  operator string& ();
29  int AsInteger() const;
30  double AsDouble() const;
31  string AsString() const;
32  bool operator == (int v) const;
33  bool operator == (double v) const;
34  bool operator == (const string& v) const;
35  bool operator == (const PrimitiveValue& v) const;
36  bool operator < (int v) const;
37  bool operator < (double v) const;
38  bool operator < (const string& v) const;
39  bool operator < (const PrimitiveValue& v) const;
40  bool operator <= (int v) const;
41  bool operator <= (double v) const;
42  bool operator <= (const string& v) const;
43  bool operator <= (const PrimitiveValue& v) const;
44 
45  int type;
46  string sValue;
47  double dValue;
48  int iValue;
49 };
50 
51 ostream& operator << (ostream& out,const PrimitiveValue& val);
52 istream& operator >> (istream& in,PrimitiveValue& val);
53 
54 #endif
A basic primitive value type, including integers, floats, and strings.
Definition: PrimitiveValue.h:11
Definition: rayprimitives.h:132