00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _QORE_BINARYNODE_H
00025
00026 #define _QORE_BINARYNODE_H
00027
00028 #include <qore/AbstractQoreNode.h>
00029
00031
00033 class BinaryNode : public SimpleValueQoreNode {
00034 private:
00036 void *ptr;
00038 qore_size_t len;
00039
00040
00041 DLLLOCAL BinaryNode(const BinaryNode&);
00042 DLLLOCAL BinaryNode& operator=(const BinaryNode&);
00043
00044 protected:
00046 DLLEXPORT virtual ~BinaryNode();
00047
00048 public:
00050
00053 DLLEXPORT BinaryNode(void *p = 0, qore_size_t size = 0);
00054
00056
00062 DLLEXPORT virtual int getAsString(QoreString &str, int foff, class ExceptionSink *xsink) const;
00063
00065
00072 DLLEXPORT virtual QoreString *getAsString(bool &del, int foff, class ExceptionSink *xsink) const;
00073
00074 DLLEXPORT virtual class AbstractQoreNode *realCopy() const;
00075
00077
00081 DLLEXPORT virtual bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const;
00082
00084
00088 DLLEXPORT virtual bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const;
00089
00091 DLLEXPORT virtual const char *getTypeName() const;
00092
00094 DLLLOCAL virtual AbstractQoreNode *parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo);
00095
00096 DLLLOCAL static const char *getStaticTypeName() {
00097 return "binary";
00098 }
00099
00101 DLLEXPORT int compare(const BinaryNode *obj) const;
00102
00104 DLLEXPORT qore_size_t size() const;
00105
00107
00110 DLLEXPORT class BinaryNode *copy() const;
00111
00113 DLLEXPORT const void *getPtr() const;
00114
00116 DLLEXPORT void append(const void *nptr, qore_size_t size);
00117
00119 DLLEXPORT void append(const BinaryNode *b);
00120
00122 DLLEXPORT void append(const BinaryNode &b);
00123
00125 DLLEXPORT void prepend(const void *nptr, qore_size_t size);
00126
00128
00133 DLLEXPORT void *giveBuffer();
00134
00136
00142 DLLEXPORT int preallocate(qore_size_t size);
00143
00145
00150 DLLEXPORT int setSize(qore_size_t size);
00151
00153 DLLEXPORT void clear();
00154 };
00155
00156 #endif // _QORE_BINARYOBJECT_H