X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=trace_model.cpp;h=760093c780a4d1279ffd36bb88b1f04e891ee029;hb=99771fcc2dade2764e765eff9822533326ec8128;hp=098656fc05c37dee68c3b8591de13f5252abf4ca;hpb=dce84c4cbc8176d627c5e7801c2acbd0e2027b86;p=apitrace diff --git a/trace_model.cpp b/trace_model.cpp index 098656f..760093c 100644 --- a/trace_model.cpp +++ b/trace_model.cpp @@ -101,7 +101,7 @@ public: delete formatter; } - void visit(Null *node) { + void visit(Null *) { os << "NULL"; } @@ -185,6 +185,14 @@ static inline const Value *unwrap(const Value *node) { } +Value::operator bool(void) const { + const Bool *b = dynamic_cast(unwrap(this)); + if (b) + return b->value; + assert(0); + return false; +} + Value::operator signed long long(void) const { const SInt *sint = dynamic_cast(unwrap(this)); if (sint) @@ -228,7 +236,7 @@ void * Value::blob(void) const { if (blob) return blob->buf; const Null *null = dynamic_cast(unwrap(this)); - if (null); + if (null) return NULL; assert(0); return NULL; @@ -239,7 +247,7 @@ const char * Value::string(void) const { if (string) return string->value.c_str(); const Null *null = dynamic_cast(unwrap(this)); - if (null); + if (null) return NULL; assert(0); return NULL;