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