[188] | 1 | /*
|
---|
| 2 | * The Apache Software License, Version 1.1
|
---|
| 3 | *
|
---|
| 4 | * Copyright (c) 2002 The Apache Software Foundation. All rights
|
---|
| 5 | * reserved.
|
---|
| 6 | *
|
---|
| 7 | * Redistribution and use in source and binary forms, with or without
|
---|
| 8 | * modification, are permitted provided that the following conditions
|
---|
| 9 | * are met:
|
---|
| 10 | *
|
---|
| 11 | * 1. Redistributions of source code must retain the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer.
|
---|
| 13 | *
|
---|
| 14 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
| 15 | * notice, this list of conditions and the following disclaimer in
|
---|
| 16 | * the documentation and/or other materials provided with the
|
---|
| 17 | * distribution.
|
---|
| 18 | *
|
---|
| 19 | * 3. The end-user documentation included with the redistribution,
|
---|
| 20 | * if any, must include the following acknowledgment:
|
---|
| 21 | * "This product includes software developed by the
|
---|
| 22 | * Apache Software Foundation (http://www.apache.org/)."
|
---|
| 23 | * Alternately, this acknowledgment may appear in the software itself,
|
---|
| 24 | * if and wherever such third-party acknowledgments normally appear.
|
---|
| 25 | *
|
---|
| 26 | * 4. The names "Xerces" and "Apache Software Foundation" must
|
---|
| 27 | * not be used to endorse or promote products derived from this
|
---|
| 28 | * software without prior written permission. For written
|
---|
| 29 | * permission, please contact apache\@apache.org.
|
---|
| 30 | *
|
---|
| 31 | * 5. Products derived from this software may not be called "Apache",
|
---|
| 32 | * nor may "Apache" appear in their name, without prior written
|
---|
| 33 | * permission of the Apache Software Foundation.
|
---|
| 34 | *
|
---|
| 35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
---|
| 36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
| 38 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
---|
| 39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
| 40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
| 41 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
---|
| 42 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
| 43 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
| 44 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
---|
| 45 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
| 46 | * SUCH DAMAGE.
|
---|
| 47 | * ====================================================================
|
---|
| 48 | *
|
---|
| 49 | * This software consists of voluntary contributions made by many
|
---|
| 50 | * individuals on behalf of the Apache Software Foundation, and was
|
---|
| 51 | * originally based on software copyright (c) 1999, International
|
---|
| 52 | * Business Machines, Inc., http://www.ibm.com . For more information
|
---|
| 53 | * on the Apache Software Foundation, please see
|
---|
| 54 | * <http://www.apache.org/>.
|
---|
| 55 | */
|
---|
| 56 |
|
---|
| 57 | /*
|
---|
| 58 | * $Id: Path390.hpp,v 1.1 2002/11/22 14:57:32 tng Exp $
|
---|
| 59 | */
|
---|
| 60 |
|
---|
| 61 | #ifndef PATH390_HPP
|
---|
| 62 | #define PATH390_HPP
|
---|
| 63 |
|
---|
| 64 | #include <xercesc/util/XercesDefs.hpp>
|
---|
| 65 |
|
---|
| 66 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 67 |
|
---|
| 68 | class Path390
|
---|
| 69 | {
|
---|
| 70 | public:
|
---|
| 71 | // Constructors and Destructor
|
---|
| 72 | Path390();
|
---|
| 73 | ~Path390();
|
---|
| 74 | Path390(char *s);
|
---|
| 75 |
|
---|
| 76 | // Set a new path in the object. This will overlay any existing path and
|
---|
| 77 | // re-initialize the object.
|
---|
| 78 | void setPath(char *s);
|
---|
| 79 |
|
---|
| 80 | // This performs a complete parse of the path. It returns the error code or 0
|
---|
| 81 | // if there was no error.
|
---|
| 82 | int fullParse();
|
---|
| 83 |
|
---|
| 84 | // This returns the path in a format as required by fopen
|
---|
| 85 | char * getfopenPath();
|
---|
| 86 |
|
---|
| 87 | // This returns the parameters in a format as required by fopen
|
---|
| 88 | char * getfopenParms();
|
---|
| 89 |
|
---|
| 90 | // This returns the type of the path. See the constants defined below.
|
---|
| 91 | int getPathType();
|
---|
| 92 |
|
---|
| 93 | // This returns the error code that was found during the parse
|
---|
| 94 | int getError();
|
---|
| 95 |
|
---|
| 96 | // Returns whether the path is relative or absolute
|
---|
| 97 | bool isRelative();
|
---|
| 98 |
|
---|
| 99 | // Returns whether or not type=record shows up in the path.
|
---|
| 100 | bool isRecordType();
|
---|
| 101 |
|
---|
| 102 | private:
|
---|
| 103 | int _pathtype;
|
---|
| 104 | char * _orgpath;
|
---|
| 105 | int _orglen;
|
---|
| 106 | char * _resultpath;
|
---|
| 107 | bool _absolute;
|
---|
| 108 | bool _uriabsolute;
|
---|
| 109 | bool _dsnabsolute;
|
---|
| 110 | char * _curpos;
|
---|
| 111 | int _parsestate;
|
---|
| 112 | int _numperiods;
|
---|
| 113 | int _numsemicolons;
|
---|
| 114 |
|
---|
| 115 | int _error;
|
---|
| 116 | char * _orgparms;
|
---|
| 117 | int _orgparmlen;
|
---|
| 118 |
|
---|
| 119 | char * _lastsemi;
|
---|
| 120 | char * _lastslash;
|
---|
| 121 | char * _lastparen;
|
---|
| 122 | char * _parmStart;
|
---|
| 123 | char * _pathEnd;
|
---|
| 124 | char * _extStart;
|
---|
| 125 |
|
---|
| 126 | int _typerecord;
|
---|
| 127 | // internal only methods:
|
---|
| 128 | void _determine_uri_abs();
|
---|
| 129 | void _determine_type();
|
---|
| 130 | void _determine_punct();
|
---|
| 131 | void _determine_parms();
|
---|
| 132 | void _parse_rest();
|
---|
| 133 |
|
---|
| 134 | };
|
---|
| 135 |
|
---|
| 136 | // Internal constants for the _parsestate variable:
|
---|
| 137 | #define PARSE_NONE 0
|
---|
| 138 | #define PARSE_ABSOLUTE_URI 1
|
---|
| 139 | #define PARSE_PATHTYPE 2
|
---|
| 140 | #define PARSE_PUNCT 3
|
---|
| 141 | #define PARSE_PARMS 4
|
---|
| 142 | #define PARSE_PARSED 5
|
---|
| 143 |
|
---|
| 144 | // These are the possible error return codes:
|
---|
| 145 | #define NO_ERROR 0
|
---|
| 146 | #define ERROR_SEMICOLON_NOT_ALLOWED 101
|
---|
| 147 | #define ERROR_PERIOD_NOT_ALLOWED 102
|
---|
| 148 | #define ERROR_NO_PAREN_ALLOWED 103
|
---|
| 149 | #define ERROR_ABS_PATH_REQUIRED 104
|
---|
| 150 | #define ERROR_NO_EXTRA_PERIODS_ALLOWED 105
|
---|
| 151 | #define ERROR_MUST_BE_ABSOLUTE 106
|
---|
| 152 | #define ERROR_BAD_DD 107
|
---|
| 153 | #define ERROR_BAD_DSN2 108
|
---|
| 154 | #define ERROR_NO_EXTRA_SEMIS_ALLOWED 109
|
---|
| 155 |
|
---|
| 156 | // Constants for the _pathtype variable and the return value from getPathType() method:
|
---|
| 157 | #define PATH390_HFS 1
|
---|
| 158 | #define PATH390_DSN1 2 // format is dsn:/chrisl/data/xml/member1.
|
---|
| 159 | #define PATH390_DSN2 3 // format is dsn://'chrisl.data.xml(member1)'
|
---|
| 160 | #define PATH390_DD 4
|
---|
| 161 | #define PATH390_OTHER 5
|
---|
| 162 |
|
---|
| 163 | XERCES_CPP_NAMESPACE_END
|
---|
| 164 |
|
---|
| 165 | #endif
|
---|