1 #ifndef __DIADES__ALTARICA__VALUE__HH
2 #define __DIADES__ALTARICA__VALUE__HH
8 #include<unordered_map>
69 ValueData():_type(),_code(0),_value() { _value._boolean =
false; }
89 static string typeName() {
return "Altarica::Value"; }
94 bool isEqualStructure(
const Value & value)
const;
95 bool isLessStructure(
const Value & value)
const;
96 bool isEqualArray(
const Value & value)
const;
97 bool isLessArray(
const Value & value)
const;
109 Value(
const ArrayValueFields & arrayValueFields);
113 Value(
const StructureValueFields & structureValueFields);
143 require(Exception, valid(),
"integer(): invalid value");
144 require(Exception, type().isInteger(),
"integer(): this value is not an integer");
145 if(valid() && type().isInteger())
157 require(Exception, valid(),
"boolean(): invalid value");
158 require(Exception, type().isBoolean(),
"boolean(): this value is not a boolean");
159 if(valid() && type().isBoolean())
172 require(Exception, valid(),
"identifier(): invalid value");
173 require(Exception, type().isIdentifier(),
"identifier(): this value is not an indentifier");
174 if(valid() && type().isIdentifier())
185 unsigned size()
const;
192 Value getField(
unsigned index)
const;
220 require(Exception,valid(),
"code(): invalid value");
231 string textify()
const;
243 bool operator==(
const Value & value)
const;
252 bool operator<(
const Value & value)
const;
260 bool operator<=(
const Value & value)
const {
return (*
this < value) || (*
this == value); }
264 bool operator>=(
const Value & value)
const {
return (*
this > value) || (*
this == value); }
278 return (*
this) == value;
283 return (*
this) != value;
287 return (*
this) > value;
291 return (*
this) >= value;
295 return (*
this) < value;
299 return (*
this) <= value;
328 static string typeName() {
return "Altarica::ValueFactory"; }
359 Value getValue(
const StructureValueFields & structureValueFields);
441 Value
getValue(
const ArrayValueFields & arrayValueFields);
446 Value
getValue(
const StructureValueFields & structureValueFields);
static ValueFactory * _valueFactory
bool operator<=(const Value &value) const
bool constraint(ConstraintOperator op, const Value &value) const
vector< Value > _structuredValues
vector< Value > _arrayedValues
vector< Value > ArrayValueFields
vector< int >::size_type ValueCode
unordered_map< Identifier, Value > _identifierMapping
Identifier * _identifierPointer
Utils::Exception< ValueFactory > Exception
bool operator>=(const Value &value) const
bool operator>(const Value &value) const
union Diades::Altarica::ValueData::@5 _value
unordered_map< int, Value > _integerMapping
Utils::Exception< Value > Exception
Value & operator=(const Value &value)
Value(const Value &value)
StructureValueFields * _structurePointer
#define require(Exception, expr, message)
Namespace of the Diades project.
Identifier identifier() const
int operator()(const Value &value)
set< Value > ValueSet
set of Value elements
std::ostream & operator<<(std::ostream &os, const Identifier &identifier)
map< Identifier, Value > StructureValueFields
bool operator!=(const Value &value) const
vector< Value > _identifierValues
bool operator()(const Value &value)
Value getValue(const StructureValueFields &structureValueFields)
ArrayValueFields * _arrayPointer
bool isIdentifier() const
Identifier operator()(const Value &value)