"Fossies" - the Fresh Open Source Software Archive

Member "OpenSP-1.5.2/include/RewindStorageObject.h" (21 Jul 2005, 964 Bytes) of package /linux/misc/old/OpenSP-1.5.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "RewindStorageObject.h" see the Fossies "Dox" file reference documentation.

    1 #ifndef RewindStorageObject_INCLUDED
    2 #define RewindStorageObject_INCLUDED 1
    3 
    4 #include "StorageManager.h"
    5 #include "Boolean.h"
    6 #include "StringOf.h"
    7 
    8 #ifdef SP_NAMESPACE
    9 namespace SP_NAMESPACE {
   10 #endif
   11 
   12 class Messenger;
   13 
   14 class SP_API RewindStorageObject : public StorageObject {
   15 public:
   16   RewindStorageObject(Boolean mayRewind, Boolean canSeek);
   17 protected:
   18   PackedBoolean mayRewind_;
   19 
   20   void saveBytes(const char *, size_t);
   21   Boolean readSaved(char *, size_t, size_t &);
   22   Boolean rewind(Messenger &);
   23   void willNotRewind();
   24   void unread(const char *s, size_t n);
   25   virtual Boolean seekToStart(Messenger &) = 0;
   26 private:
   27   PackedBoolean savingBytes_;
   28   PackedBoolean readingSaved_;
   29   PackedBoolean canSeek_;
   30   String<char> savedBytes_;
   31   size_t nBytesRead_;
   32 };
   33 
   34 inline
   35 void RewindStorageObject::saveBytes(const char *s, size_t n)
   36 {
   37   if (savingBytes_)
   38     savedBytes_.append(s, n);
   39 }
   40 
   41 #ifdef SP_NAMESPACE
   42 }
   43 #endif
   44 
   45 #endif /* not RewindStorageObject_INCLUDED */