bool UInt ::toBool(void) const { return value != 0; }
bool Float ::toBool(void) const { return value != 0; }
bool String ::toBool(void) const { return true; }
bool UInt ::toBool(void) const { return value != 0; }
bool Float ::toBool(void) const { return value != 0; }
bool String ::toBool(void) const { return true; }
bool Struct ::toBool(void) const { return true; }
bool Array ::toBool(void) const { return true; }
bool Blob ::toBool(void) const { return true; }
bool Struct ::toBool(void) const { return true; }
bool Array ::toBool(void) const { return true; }
bool Blob ::toBool(void) const { return true; }
signed long long SInt ::toSInt(void) const { return value; }
signed long long UInt ::toSInt(void) const { assert(static_cast<signed long long>(value) >= 0); return static_cast<signed long long>(value); }
signed long long Float ::toSInt(void) const { return static_cast<signed long long>(value); }
signed long long SInt ::toSInt(void) const { return value; }
signed long long UInt ::toSInt(void) const { assert(static_cast<signed long long>(value) >= 0); return static_cast<signed long long>(value); }
signed long long Float ::toSInt(void) const { return static_cast<signed long long>(value); }
unsigned long long SInt ::toUInt(void) const { assert(value >= 0); return static_cast<signed long long>(value); }
unsigned long long UInt ::toUInt(void) const { return value; }
unsigned long long Float ::toUInt(void) const { return static_cast<unsigned long long>(value); }
unsigned long long SInt ::toUInt(void) const { assert(value >= 0); return static_cast<signed long long>(value); }
unsigned long long UInt ::toUInt(void) const { return value; }
unsigned long long Float ::toUInt(void) const { return static_cast<unsigned long long>(value); }
float SInt ::toFloat(void) const { return static_cast<float>(value); }
float UInt ::toFloat(void) const { return static_cast<float>(value); }
float Float ::toFloat(void) const { return value; }
float SInt ::toFloat(void) const { return static_cast<float>(value); }
float UInt ::toFloat(void) const { return static_cast<float>(value); }
float Float ::toFloat(void) const { return value; }
double SInt ::toDouble(void) const { return static_cast<double>(value); }
double UInt ::toDouble(void) const { return static_cast<double>(value); }
double Float ::toDouble(void) const { return value; }
double SInt ::toDouble(void) const { return static_cast<double>(value); }
double UInt ::toDouble(void) const { return static_cast<double>(value); }
double Float ::toDouble(void) const { return value; }
void Visitor::visit(UInt *) { assert(0); }
void Visitor::visit(Float *) { assert(0); }
void Visitor::visit(String *) { assert(0); }
void Visitor::visit(UInt *) { assert(0); }
void Visitor::visit(Float *) { assert(0); }
void Visitor::visit(String *) { assert(0); }
void Visitor::visit(Bitmask *node) { visit(static_cast<UInt *>(node)); }
void Visitor::visit(Struct *) { assert(0); }
void Visitor::visit(Array *) { assert(0); }
void Visitor::visit(Bitmask *node) { visit(static_cast<UInt *>(node)); }
void Visitor::visit(Struct *) { assert(0); }
void Visitor::visit(Array *) { assert(0); }
- Dumper(std::ostream &_os) : os(_os) {
- formatter = Formatter::defaultFormatter();
+ Dumper(std::ostream &_os, bool color) : os(_os) {
+ formatter = Formatter::defaultFormatter(color);
normal = formatter->normal();
bold = formatter->bold();
italic = formatter->italic();
normal = formatter->normal();
bold = formatter->bold();
italic = formatter->italic();
-std::ostream & operator <<(std::ostream &os, Value *value) {
- Dumper d(os);
- if (value) {
- value->visit(d);
- }
- return os;
-}
-
-
-static inline const Value *unwrap(const Value *node) {
- const Enum *c = dynamic_cast<const Enum *>(node);
- if (c)
- return c->sig->second;
- return node;
+void Value::dump(std::ostream &os, bool color) {
+ Dumper d(os, color);
+ visit(d);