4 public: exception() throw() {
9 typedef unsigned int size_t;
12 typedef unsigned char UCHAR;
13 typedef unsigned short USHORT;
16 class status_exception : public std::exception {
18 class fatal_exception : public status_exception {
23 _IO_cookie_io_functions_t;
24 void gds__log(const TEXT*, ...);
27 class MemoryPool* mbk_pool;
30 class PermanentStorage {
31 private: MemoryPool& pool;
32 protected: explicit PermanentStorage(MemoryPool& p) : pool(p) {
35 class AutoStorage : public PermanentStorage {
36 public: static MemoryPool& getAutoMemoryPool();
37 protected: AutoStorage() : PermanentStorage(getAutoMemoryPool()) {
40 class AbstractString : private AutoStorage {
41 public: typedef char char_type;
42 typedef const char* const_pointer;
44 INLINE_BUFFER_SIZE = 32, INIT_RESERVE = 16 };
45 protected: typedef USHORT internal_size_type;
46 char_type inlineBuffer[INLINE_BUFFER_SIZE];
47 char_type* stringBuffer;
48 internal_size_type stringLength, bufferSize;
49 inline AbstractString() : stringBuffer(inlineBuffer), stringLength(0), bufferSize(INLINE_BUFFER_SIZE) {
51 public: inline const_pointer c_str() const {
54 class StringComparator {
56 template<typename Comparator> class StringBase : public AbstractString {
57 typedef StringBase<Comparator> StringType;
58 inline StringType& append(const StringType& str) {
63 typedef StringBase<StringComparator> string;
64 class ClumpletReader : protected AutoStorage {
66 Tagged, UnTagged, SpbAttach, SpbStart, Tpb };
67 ClumpletReader(Kind k, const UCHAR* buffer, size_t buffLen);
72 UCHAR getClumpTag() const;
73 size_t getClumpLength() const;
74 const UCHAR* getBytes() const;
75 size_t getBufferLength() const {
76 size_t rc = getBufferEnd() - getBuffer();
77 if (rc == 1 && kind != UnTagged && kind != SpbStart) {
80 size_t getCurOffset() const {
84 virtual const UCHAR* getBuffer() const {
86 virtual const UCHAR* getBufferEnd() const {
89 void ClumpletReader::dump() const {
90 class ClumpletDump : public ClumpletReader {
91 public: ClumpletDump(Kind k, const UCHAR* buffer, size_t buffLen) : ClumpletReader(k, buffer, buffLen) {
93 static string hexString(const UCHAR* b, size_t len) {
101 ClumpletDump d(kind, getBuffer(), getBufferLength());
105 gds__log("Clump %d at offset %d: %s", d.getClumpTag(), d.getCurOffset(), ClumpletDump::hexString(d.getBytes(), d.getClumpLength()).c_str());
108 catch(const fatal_exception& x) {