StorageManager.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: StorageManager.h /main/1 1996/07/29 17:05:01 cde-hp $ */
  24. // Copyright (c) 1994, 1995 James Clark
  25. // See the file COPYING for copying permission.
  26. #ifndef StorageManager_INCLUDED
  27. #define StorageManager_INCLUDED 1
  28. #ifdef __GNUG__
  29. #pragma interface
  30. #endif
  31. #include "StringC.h"
  32. #include "types.h"
  33. #include "CharsetInfo.h"
  34. #include <stddef.h>
  35. #ifdef SP_NAMESPACE
  36. namespace SP_NAMESPACE {
  37. #endif
  38. class StorageManager;
  39. class CharsetInfo;
  40. class Messenger;
  41. class InputCodingSystem;
  42. class SP_API StorageObject {
  43. public:
  44. StorageObject();
  45. virtual ~StorageObject();
  46. virtual Boolean read(char *buf, size_t bufSize, Messenger &,
  47. size_t &nread) = 0;
  48. virtual Boolean rewind(Messenger &) = 0;
  49. virtual void willNotRewind();
  50. virtual size_t getBlockSize() const;
  51. private:
  52. StorageObject(const StorageObject &); // undefined
  53. void operator=(const StorageObject &); // undefined
  54. };
  55. class SP_API StorageManager {
  56. public:
  57. StorageManager();
  58. virtual StorageObject *makeStorageObject(const StringC &specId,
  59. const StringC &baseId,
  60. Boolean search,
  61. Boolean mayRewind,
  62. Messenger &mgr,
  63. StringC &actualId) = 0;
  64. virtual const char *type() const = 0;
  65. virtual Boolean inheritable() const;
  66. virtual Boolean transformNeutral(StringC &, Boolean fold, Messenger &) const;
  67. // Resolve a possibly relative ID by examining the base and specified IDs.
  68. // Put the resolved ID in specID.
  69. // Return 0 if it cannot be resolved yet becase the specified ID is relative
  70. // and physical searching is required to resolve it and search is true;
  71. // in this case the base will be passed to makeStorageObject.
  72. // Otherwise return 1; in this case the base will be discarded, and the
  73. // resolved ID will be passed to makeStorageObject.
  74. virtual Boolean resolveRelative(const StringC &base,
  75. StringC &specId,
  76. Boolean search) const;
  77. virtual Boolean guessIsId(const StringC &, const CharsetInfo &) const;
  78. virtual const InputCodingSystem *requiredCodingSystem() const;
  79. virtual Boolean requiresCr() const;
  80. virtual ~StorageManager();
  81. virtual const CharsetInfo *idCharset() const;
  82. virtual const StringC *reString() const;
  83. private:
  84. StorageManager(const StorageManager &); // undefined
  85. void operator=(const StorageManager &); // undefined
  86. };
  87. class SP_API IdStorageManager : public StorageManager {
  88. public:
  89. IdStorageManager(const UnivCharsetDesc &idCharset);
  90. const CharsetInfo *idCharset() const;
  91. const StringC *reString() const;
  92. protected:
  93. StringC reString_;
  94. private:
  95. IdStorageManager(const IdStorageManager &); // undefined
  96. void operator=(const IdStorageManager &); // undefined
  97. CharsetInfo idCharset_;
  98. };
  99. #ifdef SP_NAMESPACE
  100. }
  101. #endif
  102. #endif /* not StorageManager_INCLUDED */