}
+// virtual Value::blob()
+void * Value ::blob(void) const { assert(0); return NULL; }
+void * Null ::blob(void) const { return NULL; }
+void * Blob ::blob(void) const { return buf; }
+void * Pointer::blob(void) const { assert(value < 0x100000ULL); return (void *)value; }
+
+
// virtual Value::visit()
void Null ::visit(Visitor &visitor) { visitor.visit(this); }
void Bool ::visit(Visitor &visitor) { visitor.visit(this); }
return null;
}
-void * Value::blob(void) const {
- const Blob *blob = dynamic_cast<const Blob *>(unwrap(this));
- if (blob)
- return blob->buf;
- const Null *null = dynamic_cast<const Null *>(unwrap(this));
- if (null)
- return NULL;
- const Pointer *pointer = dynamic_cast<const Pointer *>(unwrap(this));
- if (pointer) {
- assert(pointer->value < 0x100000ULL);
- return (void *)pointer->value;
- }
- assert(0);
- return NULL;
-}
-
const char * Value::string(void) const {
const String *string = dynamic_cast<const String *>(unwrap(this));
if (string)
operator unsigned long long (void) const;
operator double (void) const;
- void *blob(void) const;
+ virtual void *blob(void) const;
const char *string(void) const;
inline operator signed char (void) const {
class Null : public Value
{
public:
+ void *blob(void) const;
void visit(Visitor &visitor);
};
~Blob();
+ void *blob(void) const;
void visit(Visitor &visitor);
size_t size;
public:
Pointer(unsigned long long value) : UInt(value) {}
+ void *blob(void) const;
void visit(Visitor &visitor);
};