1 | /*
|
---|
2 | * Copyright 2002,2004 The Apache Software Foundation.
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | */
|
---|
16 |
|
---|
17 | /*
|
---|
18 | * $Id: Path390.hpp,v 1.2 2004/09/08 13:56:41 peiyongz Exp $
|
---|
19 | */
|
---|
20 |
|
---|
21 | #ifndef PATH390_HPP
|
---|
22 | #define PATH390_HPP
|
---|
23 |
|
---|
24 | #include <xercesc/util/XercesDefs.hpp>
|
---|
25 |
|
---|
26 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
27 |
|
---|
28 | class Path390
|
---|
29 | {
|
---|
30 | public:
|
---|
31 | // Constructors and Destructor
|
---|
32 | Path390();
|
---|
33 | ~Path390();
|
---|
34 | Path390(char *s);
|
---|
35 |
|
---|
36 | // Set a new path in the object. This will overlay any existing path and
|
---|
37 | // re-initialize the object.
|
---|
38 | void setPath(char *s);
|
---|
39 |
|
---|
40 | // This performs a complete parse of the path. It returns the error code or 0
|
---|
41 | // if there was no error.
|
---|
42 | int fullParse();
|
---|
43 |
|
---|
44 | // This returns the path in a format as required by fopen
|
---|
45 | char * getfopenPath();
|
---|
46 |
|
---|
47 | // This returns the parameters in a format as required by fopen
|
---|
48 | char * getfopenParms();
|
---|
49 |
|
---|
50 | // This returns the type of the path. See the constants defined below.
|
---|
51 | int getPathType();
|
---|
52 |
|
---|
53 | // This returns the error code that was found during the parse
|
---|
54 | int getError();
|
---|
55 |
|
---|
56 | // Returns whether the path is relative or absolute
|
---|
57 | bool isRelative();
|
---|
58 |
|
---|
59 | // Returns whether or not type=record shows up in the path.
|
---|
60 | bool isRecordType();
|
---|
61 |
|
---|
62 | private:
|
---|
63 | int _pathtype;
|
---|
64 | char * _orgpath;
|
---|
65 | int _orglen;
|
---|
66 | char * _resultpath;
|
---|
67 | bool _absolute;
|
---|
68 | bool _uriabsolute;
|
---|
69 | bool _dsnabsolute;
|
---|
70 | char * _curpos;
|
---|
71 | int _parsestate;
|
---|
72 | int _numperiods;
|
---|
73 | int _numsemicolons;
|
---|
74 |
|
---|
75 | int _error;
|
---|
76 | char * _orgparms;
|
---|
77 | int _orgparmlen;
|
---|
78 |
|
---|
79 | char * _lastsemi;
|
---|
80 | char * _lastslash;
|
---|
81 | char * _lastparen;
|
---|
82 | char * _parmStart;
|
---|
83 | char * _pathEnd;
|
---|
84 | char * _extStart;
|
---|
85 |
|
---|
86 | int _typerecord;
|
---|
87 | // internal only methods:
|
---|
88 | void _determine_uri_abs();
|
---|
89 | void _determine_type();
|
---|
90 | void _determine_punct();
|
---|
91 | void _determine_parms();
|
---|
92 | void _parse_rest();
|
---|
93 |
|
---|
94 | };
|
---|
95 |
|
---|
96 | // Internal constants for the _parsestate variable:
|
---|
97 | #define PARSE_NONE 0
|
---|
98 | #define PARSE_ABSOLUTE_URI 1
|
---|
99 | #define PARSE_PATHTYPE 2
|
---|
100 | #define PARSE_PUNCT 3
|
---|
101 | #define PARSE_PARMS 4
|
---|
102 | #define PARSE_PARSED 5
|
---|
103 |
|
---|
104 | // These are the possible error return codes:
|
---|
105 | #define NO_ERROR 0
|
---|
106 | #define ERROR_SEMICOLON_NOT_ALLOWED 101
|
---|
107 | #define ERROR_PERIOD_NOT_ALLOWED 102
|
---|
108 | #define ERROR_NO_PAREN_ALLOWED 103
|
---|
109 | #define ERROR_ABS_PATH_REQUIRED 104
|
---|
110 | #define ERROR_NO_EXTRA_PERIODS_ALLOWED 105
|
---|
111 | #define ERROR_MUST_BE_ABSOLUTE 106
|
---|
112 | #define ERROR_BAD_DD 107
|
---|
113 | #define ERROR_BAD_DSN2 108
|
---|
114 | #define ERROR_NO_EXTRA_SEMIS_ALLOWED 109
|
---|
115 |
|
---|
116 | // Constants for the _pathtype variable and the return value from getPathType() method:
|
---|
117 | #define PATH390_HFS 1
|
---|
118 | #define PATH390_DSN1 2 // format is dsn:/chrisl/data/xml/member1.
|
---|
119 | #define PATH390_DSN2 3 // format is dsn://'chrisl.data.xml(member1)'
|
---|
120 | #define PATH390_DD 4
|
---|
121 | #define PATH390_OTHER 5
|
---|
122 |
|
---|
123 | XERCES_CPP_NAMESPACE_END
|
---|
124 |
|
---|
125 | #endif
|
---|