@@ -35,51 +35,10 @@ using namespace std;
35
35
36
36
namespace checktestdata {
37
37
38
- struct none_t {};
39
- ostream& operator <<(ostream& os, const none_t &) {
40
- return os << " <no value>" ;
41
- }
42
-
43
- struct value_t {
44
- boost::variant<none_t , mpz_class, mpf_class, string> val;
45
-
46
- value_t (): val(none_t ()) {}
47
- explicit value_t (mpz_class x): val(x) {}
48
- explicit value_t (mpf_class x): val(x) {}
49
- explicit value_t (string x): val(x) {}
50
-
51
- operator mpz_class () const ;
52
- operator mpf_class () const ;
53
-
54
- // This is a member function instead of a casting operator, since
55
- // otherwise the string could be used in other implicit casts.
56
- string getstr () const ;
57
-
58
- // This converts any value type to a string representation.
59
- string tostr () const ;
60
- };
61
-
62
- const int value_none = 0 ;
63
- const int value_int = 1 ;
64
- const int value_float = 2 ;
65
- const int value_string = 3 ;
66
-
67
38
class doesnt_match_exception {};
68
39
class eof_found_exception {};
69
40
class generate_exception {};
70
41
71
- ostream& operator <<(ostream &os, const value_t &val)
72
- {
73
- return os << val.val ;
74
- }
75
-
76
- string value_t::tostr () const
77
- {
78
- stringstream ss;
79
- ss << *this ;
80
- return ss.str ();
81
- }
82
-
83
42
const int display_before_error = 65 ;
84
43
const int display_after_error = 50 ;
85
44
@@ -232,24 +191,6 @@ long string2int(string s)
232
191
return res;
233
192
}
234
193
235
- value_t ::operator mpz_class () const
236
- {
237
- return boost::get<mpz_class>(val);
238
- }
239
-
240
- value_t ::operator mpf_class () const
241
- {
242
- if (const mpz_class* p = boost::get<mpz_class>(&val))
243
- return *p;
244
- return boost::get<mpf_class>(val);
245
- }
246
-
247
- string value_t::getstr () const
248
- {
249
- if ( val.which ()!=value_string ) error (" value is not a string" );
250
- return boost::get<string>(val);
251
- }
252
-
253
194
value_t eval (const expr&); // forward declaration
254
195
255
196
value_t getvar (const expr& var, int use_preset = 0 )
0 commit comments