Link with C++ linker
[oweals/cde.git] / cde / programs / nsgmls / StorageManager.h
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 librararies 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
27 #ifndef StorageManager_INCLUDED
28 #define StorageManager_INCLUDED 1
29 #ifdef __GNUG__
30 #pragma interface
31 #endif
32
33 #include "StringC.h"
34 #include "types.h"
35 #include "CharsetInfo.h"
36 #include <stddef.h>
37
38 #ifdef SP_NAMESPACE
39 namespace SP_NAMESPACE {
40 #endif
41
42 class StorageManager;
43 class CharsetInfo;
44 class Messenger;
45 class InputCodingSystem;
46
47 class SP_API StorageObject {
48 public:
49   StorageObject();
50   virtual ~StorageObject();
51   virtual Boolean read(char *buf, size_t bufSize, Messenger &,
52                        size_t &nread) = 0;
53   virtual Boolean rewind(Messenger &) = 0;
54   virtual void willNotRewind();
55   virtual size_t getBlockSize() const;
56 private:
57   StorageObject(const StorageObject &); // undefined
58   void operator=(const StorageObject &); // undefined
59 };
60
61 class SP_API StorageManager {
62 public:
63   StorageManager();
64   virtual StorageObject *makeStorageObject(const StringC &specId,
65                                            const StringC &baseId,
66                                            Boolean search,
67                                            Boolean mayRewind,
68                                            Messenger &mgr,
69                                            StringC &actualId) = 0;
70   virtual const char *type() const = 0;
71   virtual Boolean inheritable() const;
72   virtual Boolean transformNeutral(StringC &, Boolean fold, Messenger &) const;
73   // Resolve a possibly relative ID by examining the base and specified IDs.
74   // Put the resolved ID in specID.
75   // Return 0 if it cannot be resolved yet becase the specified ID is relative
76   // and physical searching is required to resolve it and search is true;
77   // in this case the base will be passed to makeStorageObject.
78   // Otherwise return 1; in this case the base will be discarded, and the
79   // resolved ID will be passed to makeStorageObject.
80   virtual Boolean resolveRelative(const StringC &base,
81                                   StringC &specId,
82                                   Boolean search) const;
83   virtual Boolean guessIsId(const StringC &, const CharsetInfo &) const;
84   virtual const InputCodingSystem *requiredCodingSystem() const;
85   virtual Boolean requiresCr() const;
86   virtual ~StorageManager();
87   virtual const CharsetInfo *idCharset() const;
88   virtual const StringC *reString() const;
89 private:
90   StorageManager(const StorageManager &); // undefined
91   void operator=(const StorageManager &); // undefined
92 };
93
94 class SP_API IdStorageManager : public StorageManager {
95 public:
96   IdStorageManager(const UnivCharsetDesc &idCharset);
97   const CharsetInfo *idCharset() const;
98   const StringC *reString() const;
99 protected:
100   StringC reString_;
101 private:
102   IdStorageManager(const IdStorageManager &); // undefined
103   void operator=(const IdStorageManager &); // undefined
104
105   CharsetInfo idCharset_;
106 };
107
108 #ifdef SP_NAMESPACE
109 }
110 #endif
111
112 #endif /* not StorageManager_INCLUDED */