1 // Copyright (c) 1994, 1995 James Clark 2 // See the file COPYING for copying permission. 3 #pragma ident "%Z%%M% %I% %E% SMI" 4 5 #ifndef StorageManager_INCLUDED 6 #define StorageManager_INCLUDED 1 7 #ifdef __GNUG__ 8 #pragma interface 9 #endif 10 11 #include "StringC.h" 12 #include "types.h" 13 #include "CharsetInfo.h" 14 #include <stddef.h> 15 16 #ifdef SP_NAMESPACE 17 namespace SP_NAMESPACE { 18 #endif 19 20 class StorageManager; 21 class CharsetInfo; 22 class Messenger; 23 class InputCodingSystem; 24 25 class SP_API StorageObject { 26 public: 27 StorageObject(); 28 virtual ~StorageObject(); 29 virtual Boolean read(char *buf, size_t bufSize, Messenger &, 30 size_t &nread) = 0; 31 virtual Boolean rewind(Messenger &) = 0; 32 virtual void willNotRewind(); 33 virtual size_t getBlockSize() const; 34 private: 35 StorageObject(const StorageObject &); // undefined 36 void operator=(const StorageObject &); // undefined 37 }; 38 39 class SP_API StorageManager { 40 public: 41 StorageManager(); 42 virtual StorageObject *makeStorageObject(const StringC &specId, 43 const StringC &baseId, 44 Boolean search, 45 Boolean mayRewind, 46 Messenger &mgr, 47 StringC &actualId) = 0; 48 virtual const char *type() const = 0; 49 virtual Boolean inheritable() const; 50 virtual Boolean transformNeutral(StringC &, Boolean fold, Messenger &) const; 51 // Resolve a possibly relative ID by examining the base and specified IDs. 52 // Put the resolved ID in specID. 53 // Return 0 if it cannot be resolved yet becase the specified ID is relative 54 // and physical searching is required to resolve it and search is true; 55 // in this case the base will be passed to makeStorageObject. 56 // Otherwise return 1; in this case the base will be discarded, and the 57 // resolved ID will be passed to makeStorageObject. 58 virtual Boolean resolveRelative(const StringC &base, 59 StringC &specId, 60 Boolean search) const; 61 virtual Boolean guessIsId(const StringC &, const CharsetInfo &) const; 62 virtual const InputCodingSystem *requiredCodingSystem() const; 63 virtual Boolean requiresCr() const; 64 virtual ~StorageManager(); 65 virtual const CharsetInfo *idCharset() const; 66 virtual const StringC *reString() const; 67 private: 68 StorageManager(const StorageManager &); // undefined 69 void operator=(const StorageManager &); // undefined 70 }; 71 72 class SP_API IdStorageManager : public StorageManager { 73 public: 74 IdStorageManager(const CharsetInfo *idCharset); 75 const CharsetInfo *idCharset() const; 76 const StringC *reString() const; 77 protected: 78 StringC reString_; 79 private: 80 IdStorageManager(const IdStorageManager &); // undefined 81 void operator=(const IdStorageManager &); // undefined 82 83 const CharsetInfo *idCharset_; 84 }; 85 86 #ifdef SP_NAMESPACE 87 } 88 #endif 89 90 #endif /* not StorageManager_INCLUDED */ 91