00001
00002
00003
00004
00009 #ifndef __STORE_H__
00010 #define __STORE_H__
00011
00013
00014 class c4_Dependencies
00015 {
00016 c4_PtrArray _refs;
00017
00018 public:
00019 c4_Dependencies ();
00020 ~c4_Dependencies ();
00021
00022 void Add(c4_Sequence* seq_);
00023 bool Remove(c4_Sequence* seq_);
00024
00025 friend class c4_Notifier;
00026 };
00027
00029
00030 class c4_Notifier
00031 {
00032 c4_Sequence* _origin;
00033 c4_Notifier* _chain;
00034 c4_Notifier* _next;
00035
00036 public:
00037 enum { kNone, kSetAt, kInsertAt, kRemoveAt, kMove, kSet, kLimit };
00038
00039 c4_Notifier (c4_Sequence* origin_);
00040 ~c4_Notifier ();
00041
00042 bool HasDependents() const;
00043
00044 void StartSetAt(int index_, c4_Cursor& cursor_);
00045 void StartInsertAt(int index_, c4_Cursor& cursor_, int count_);
00046 void StartRemoveAt(int index_, int count_);
00047 void StartMove(int from_, int to_);
00048 void StartSet(int index_, int propId_, const c4_Bytes& buf_);
00049
00050 int _type;
00051 int _index;
00052 int _propId;
00053 int _count;
00054 c4_Cursor* _cursor;
00055 const c4_Bytes* _bytes;
00056
00057 private:
00058 void Notify();
00059 };
00060
00062
00063 class c4_DerivedSeq : public c4_Sequence
00064 {
00065 protected:
00066 c4_Sequence& _seq;
00067
00068 protected:
00069 c4_DerivedSeq (c4_Sequence& seq_);
00070 virtual ~c4_DerivedSeq ();
00071
00072 public:
00073 virtual int RemapIndex(int, const c4_Sequence*) const;
00074
00075 virtual int NumRows() const;
00076 virtual void SetNumRows(int size_);
00077
00078 virtual int NumHandlers() const;
00079 virtual c4_Handler& NthHandler(int) const;
00080 virtual const c4_Sequence* HandlerContext(int) const;
00081 virtual int AddHandler(c4_Handler*);
00082 virtual c4_Handler* CreateHandler(const c4_Property&);
00083
00084 virtual c4_Notifier* PreChange(c4_Notifier& nf_);
00085 };
00086
00088
00089 class c4_StreamStrategy : public c4_Strategy
00090 {
00091 c4_Stream* _stream;
00092 t4_byte* _buffer;
00093 t4_i32 _buflen;
00094 t4_i32 _position;
00095 public:
00096 c4_StreamStrategy (t4_i32 buflen_);
00097 c4_StreamStrategy (c4_Stream* stream_);
00098 virtual ~c4_StreamStrategy ();
00099
00100 virtual bool IsValid() const;
00101 virtual int DataRead(t4_i32 pos_, void* buffer_, int length_);
00102 virtual void DataWrite(t4_i32 pos_, const void* buffer_, int length_);
00103 virtual t4_i32 FileSize();
00104 };
00105
00107
00108 #if q4_INLINE
00109 #include "store.inl"
00110 #endif
00111
00113
00114 #endif