diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2007-05-06 12:30:18 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2007-05-06 12:30:18 (GMT) |
commit | 23c13fc17365dca77acbe9a992e03ae4a40f6eca (patch) | |
tree | cfc812b095178411db5aae564fc43cac8b714078 /src/marshal.h | |
parent | 124b4621e793d9ffa3eca3ee91cdb6ded37c553e (diff) | |
download | Doxygen-23c13fc17365dca77acbe9a992e03ae4a40f6eca.zip Doxygen-23c13fc17365dca77acbe9a992e03ae4a40f6eca.tar.gz Doxygen-23c13fc17365dca77acbe9a992e03ae4a40f6eca.tar.bz2 |
Release-1.5.2-20070506
Diffstat (limited to 'src/marshal.h')
-rw-r--r-- | src/marshal.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/marshal.h b/src/marshal.h index 26c7571..a30c431 100644 --- a/src/marshal.h +++ b/src/marshal.h @@ -21,6 +21,7 @@ struct DocInfo; struct BriefInfo; class MemberList; class ExampleSDict; +class Entry; #define NULL_LIST 0xffffffff @@ -33,6 +34,49 @@ class FileStorage : public QFile, public StorageIntf int write(const char *buf,uint size) { return QFile::writeBlock(buf,size); } }; +class StreamStorage : public StorageIntf +{ + public: + StreamStorage() + { + m_data=0; + m_offset=0; + m_len=0; + } + ~StreamStorage() + { + delete m_data; + } + StreamStorage(char *data,uint len) + { + m_data=data; + m_offset=0; + m_len=len; + } + int read(char *buf,uint size) + { + int bytesLeft = QMIN((int)size,m_len-m_offset); + if (bytesLeft>0) memcpy(buf,m_data,bytesLeft); + m_offset+=bytesLeft; + return bytesLeft; + } + int write(const char *buf,uint size) + { + m_data=(char *)realloc(m_data,m_offset+size); + memcpy(m_data+m_offset,buf,size); + m_offset+=size; + m_len+=size; + return size; + } + void rewind() { m_offset=0; } + char *data() const { return m_data; } + int size() { return m_len; } + private: + char *m_data; + int m_offset; + int m_len; +}; + //----- marshaling function: datatype -> byte stream -------------------- void marshalInt(StorageIntf *s,int v); @@ -56,6 +100,8 @@ void marshalGroupList(StorageIntf *s,GroupList *groupList); void marshalMemberList(StorageIntf *s,MemberList *ml); void marshalExampleSDict(StorageIntf *s,ExampleSDict *ed); void marshalMemberLists(StorageIntf *s,SDict<MemberList> *mls); +void marshalEntry(StorageIntf *s,Entry *e); +void marshalEntryTree(StorageIntf *s,Entry *e); //----- unmarshaling function: byte stream -> datatype ------------------ @@ -80,5 +126,7 @@ GroupList * unmarshalGroupList(StorageIntf *s); MemberList * unmarshalMemberList(StorageIntf *s); ExampleSDict * unmarshalExampleSDict(StorageIntf *s); SDict<MemberList> * unmarshalMemberLists(StorageIntf *s); +Entry * unmarshalEntry(StorageIntf *s); +Entry * unmarshalEntryTree(StorageIntf *s); #endif |