1*0Sstevel@tonic-gate // Copyright (c) 1994, 1995 James Clark
2*0Sstevel@tonic-gate // See the file COPYING for copying permission.
3*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
4*0Sstevel@tonic-gate 
5*0Sstevel@tonic-gate #ifndef ExtendEntityManager_INCLUDED
6*0Sstevel@tonic-gate #define ExtendEntityManager_INCLUDED 1
7*0Sstevel@tonic-gate 
8*0Sstevel@tonic-gate #ifdef __GNUG__
9*0Sstevel@tonic-gate #pragma interface
10*0Sstevel@tonic-gate #endif
11*0Sstevel@tonic-gate 
12*0Sstevel@tonic-gate #include "EntityManager.h"
13*0Sstevel@tonic-gate #include "CharsetInfo.h"
14*0Sstevel@tonic-gate #include "types.h"
15*0Sstevel@tonic-gate #include "Boolean.h"
16*0Sstevel@tonic-gate #include "StringC.h"
17*0Sstevel@tonic-gate #include "types.h"
18*0Sstevel@tonic-gate #include "Vector.h"
19*0Sstevel@tonic-gate #include "Location.h"
20*0Sstevel@tonic-gate #include "CodingSystemKit.h"
21*0Sstevel@tonic-gate 
22*0Sstevel@tonic-gate #ifdef SP_NAMESPACE
23*0Sstevel@tonic-gate namespace SP_NAMESPACE {
24*0Sstevel@tonic-gate #endif
25*0Sstevel@tonic-gate 
26*0Sstevel@tonic-gate class StorageManager;
27*0Sstevel@tonic-gate class InputCodingSystem;
28*0Sstevel@tonic-gate class Messenger;
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate struct SP_API StorageObjectSpec {
31*0Sstevel@tonic-gate   StorageObjectSpec();
32*0Sstevel@tonic-gate   StorageManager *storageManager;
33*0Sstevel@tonic-gate   const char *codingSystemName;
34*0Sstevel@tonic-gate   const InputCodingSystem *codingSystem;
35*0Sstevel@tonic-gate   StringC specId;		// specified id
36*0Sstevel@tonic-gate   StringC baseId;		// id that specified id is relative to
37*0Sstevel@tonic-gate   enum Records {
38*0Sstevel@tonic-gate     find,
39*0Sstevel@tonic-gate     cr,
40*0Sstevel@tonic-gate     lf,
41*0Sstevel@tonic-gate     crlf,
42*0Sstevel@tonic-gate     asis
43*0Sstevel@tonic-gate     };
44*0Sstevel@tonic-gate   Records records;
45*0Sstevel@tonic-gate   PackedBoolean notrack;
46*0Sstevel@tonic-gate   PackedBoolean zapEof;		// zap a final Ctrl-Z
47*0Sstevel@tonic-gate   PackedBoolean search;
48*0Sstevel@tonic-gate   enum {
49*0Sstevel@tonic-gate     encoding,
50*0Sstevel@tonic-gate     bctf,
51*0Sstevel@tonic-gate     special
52*0Sstevel@tonic-gate   };
53*0Sstevel@tonic-gate   char codingSystemType;
54*0Sstevel@tonic-gate };
55*0Sstevel@tonic-gate 
56*0Sstevel@tonic-gate 
57*0Sstevel@tonic-gate struct SP_API ParsedSystemId : public Vector<StorageObjectSpec> {
58*0Sstevel@tonic-gate   ParsedSystemId();
59*0Sstevel@tonic-gate   void unparse(const CharsetInfo &resultCharset, Boolean isNdata, StringC &result) const;
60*0Sstevel@tonic-gate   struct SP_API Map {
61*0Sstevel@tonic-gate     enum Type {
62*0Sstevel@tonic-gate       catalogDocument,
63*0Sstevel@tonic-gate       catalogPublic
64*0Sstevel@tonic-gate     };
65*0Sstevel@tonic-gate     Type type;
66*0Sstevel@tonic-gate     StringC publicId;
67*0Sstevel@tonic-gate   };
68*0Sstevel@tonic-gate   Vector<Map> maps;
69*0Sstevel@tonic-gate };
70*0Sstevel@tonic-gate 
71*0Sstevel@tonic-gate struct SP_API StorageObjectLocation {
72*0Sstevel@tonic-gate   const StorageObjectSpec *storageObjectSpec;
73*0Sstevel@tonic-gate   StringC actualStorageId;
74*0Sstevel@tonic-gate   unsigned long lineNumber;
75*0Sstevel@tonic-gate   unsigned long columnNumber;
76*0Sstevel@tonic-gate   unsigned long byteIndex;
77*0Sstevel@tonic-gate   unsigned long storageObjectOffset;
78*0Sstevel@tonic-gate };
79*0Sstevel@tonic-gate 
80*0Sstevel@tonic-gate class SP_API ExtendEntityManager : public EntityManager {
81*0Sstevel@tonic-gate public:
82*0Sstevel@tonic-gate   class SP_API CatalogManager {
83*0Sstevel@tonic-gate   public:
84*0Sstevel@tonic-gate     virtual ~CatalogManager();
85*0Sstevel@tonic-gate     virtual ConstPtr<EntityCatalog>
86*0Sstevel@tonic-gate       makeCatalog(StringC &systemId,
87*0Sstevel@tonic-gate 		  const CharsetInfo &docCharset,
88*0Sstevel@tonic-gate 		  ExtendEntityManager *,
89*0Sstevel@tonic-gate 		  Messenger &) const = 0;
90*0Sstevel@tonic-gate     virtual Boolean mapCatalog(ParsedSystemId &systemId,
91*0Sstevel@tonic-gate 			       ExtendEntityManager *em,
92*0Sstevel@tonic-gate 			       Messenger &mgr) const = 0;
93*0Sstevel@tonic-gate   };
94*0Sstevel@tonic-gate   // Additional flags for open.
95*0Sstevel@tonic-gate   enum { mayNotExist = 0100, isNdata = 0200 };
96*0Sstevel@tonic-gate   virtual void registerStorageManager(StorageManager *) = 0;
97*0Sstevel@tonic-gate   virtual void setCatalogManager(CatalogManager *) = 0;
98*0Sstevel@tonic-gate   virtual Boolean expandSystemId(const StringC &,
99*0Sstevel@tonic-gate 				 const Location &,
100*0Sstevel@tonic-gate 				 Boolean isNdata,
101*0Sstevel@tonic-gate 				 const CharsetInfo &,
102*0Sstevel@tonic-gate 				 const StringC *mapCatalogPublic,
103*0Sstevel@tonic-gate 				 Messenger &,
104*0Sstevel@tonic-gate 				 StringC &) = 0;
105*0Sstevel@tonic-gate   virtual Boolean mergeSystemIds(const Vector<StringC> &sysids,
106*0Sstevel@tonic-gate 				 Boolean mapCatalogDocument,
107*0Sstevel@tonic-gate 				 const CharsetInfo &,
108*0Sstevel@tonic-gate 				 Messenger &mgr,
109*0Sstevel@tonic-gate 				 StringC &) const = 0;
110*0Sstevel@tonic-gate   virtual Boolean parseSystemId(const StringC &str,
111*0Sstevel@tonic-gate 				const CharsetInfo &docCharset,
112*0Sstevel@tonic-gate 				Boolean isNdata,
113*0Sstevel@tonic-gate 				const StorageObjectLocation *defLoc,
114*0Sstevel@tonic-gate 				Messenger &mgr,
115*0Sstevel@tonic-gate 				ParsedSystemId &parsedSysid) const = 0;
116*0Sstevel@tonic-gate   static const ParsedSystemId *externalInfoParsedSystemId(const ExternalInfo *);
117*0Sstevel@tonic-gate   static Boolean externalize(const ExternalInfo *,
118*0Sstevel@tonic-gate 			     Offset,
119*0Sstevel@tonic-gate 			     StorageObjectLocation &);
120*0Sstevel@tonic-gate   static ExtendEntityManager *make(StorageManager *,
121*0Sstevel@tonic-gate 				   const InputCodingSystem *,
122*0Sstevel@tonic-gate 				   const ConstPtr<InputCodingSystemKit> &,
123*0Sstevel@tonic-gate 				   Boolean internalCharsetIsDocCharset);
124*0Sstevel@tonic-gate };
125*0Sstevel@tonic-gate 
126*0Sstevel@tonic-gate #ifdef SP_NAMESPACE
127*0Sstevel@tonic-gate }
128*0Sstevel@tonic-gate #endif
129*0Sstevel@tonic-gate 
130*0Sstevel@tonic-gate #endif /* not ExtendEntityManager_INCLUDED */
131