Last change
on this file since 6:3a44a2bb6da8 was
1:67188bd752db,
checked in by Peter Hegyi <hegyi@…>, 16 years ago
|
SVN revision 3500 made compilable with Lemon 1.0.
|
File size:
870 bytes
|
Rev | Line | |
---|
[1] | 1 | #ifndef MAP_VALUE_H |
---|
| 2 | #define MAP_VALUE_H |
---|
| 3 | |
---|
| 4 | #include <exception> |
---|
| 5 | #include <functional> |
---|
| 6 | #include <iosfwd> |
---|
| 7 | |
---|
| 8 | class MapValue |
---|
| 9 | { |
---|
| 10 | public: |
---|
| 11 | friend std::ostream& operator<<(std::ostream &os, const MapValue& v); |
---|
| 12 | class IllegalOperation : public std::exception |
---|
| 13 | { |
---|
| 14 | virtual const char* what() const throw() |
---|
| 15 | { |
---|
| 16 | return "Illegal operation."; |
---|
| 17 | } |
---|
| 18 | }; |
---|
| 19 | typedef enum |
---|
| 20 | { |
---|
| 21 | NUMERIC = 1 << 0, |
---|
| 22 | STRING = 1 << 1 |
---|
| 23 | } Type; |
---|
| 24 | private: |
---|
| 25 | bool has_value; |
---|
| 26 | void* p_value; |
---|
| 27 | MapValue::Type type; |
---|
| 28 | void clear(); |
---|
| 29 | public: |
---|
| 30 | MapValue(); |
---|
| 31 | MapValue(double); |
---|
| 32 | MapValue(std::string); |
---|
| 33 | MapValue(const char* str); |
---|
| 34 | MapValue(const MapValue& v); |
---|
| 35 | MapValue& operator=(const MapValue& v); |
---|
| 36 | ~MapValue(); |
---|
| 37 | operator std::string() const; |
---|
| 38 | operator double() const; |
---|
| 39 | Type getType() const; |
---|
| 40 | bool hasValue() const; |
---|
| 41 | }; |
---|
| 42 | |
---|
| 43 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.