You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ja...@apache.org on 2001/10/06 08:12:13 UTC

cvs commit: xml-xerces/perl/Xerces_headers/util XMLUri.hpp PlatformUtils.hpp XMLURL.hpp

jasons      01/10/05 23:12:13

  Modified:    perl/Xerces_headers/util PlatformUtils.hpp XMLURL.hpp
  Added:       perl/Xerces_headers/util XMLUri.hpp
  Log:
  new
  
  Revision  Changes    Path
  1.3       +69 -80    xml-xerces/perl/Xerces_headers/util/PlatformUtils.hpp
  
  Index: PlatformUtils.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/perl/Xerces_headers/util/PlatformUtils.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PlatformUtils.hpp	2001/04/16 18:00:25	1.2
  +++ PlatformUtils.hpp	2001/10/06 06:12:12	1.3
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -55,19 +55,19 @@
    */
   
   /*
  - * $Id: PlatformUtils.hpp,v 1.2 2001/04/16 18:00:25 jasons Exp $
  + * $Id: PlatformUtils.hpp,v 1.3 2001/10/06 06:12:12 jasons Exp $
    */
   
   
  -//#if !defined(PLATFORMUTILS_HPP)
  -//#define PLATFORMUTILS_HPP
  +#if !defined(PLATFORMUTILS_HPP)
  +#define PLATFORMUTILS_HPP
   
  -//#include <util/XercesDefs.hpp>
  -//#include <util/XMLException.hpp>
  +#include <util/XercesDefs.hpp>
  +#include <util/XMLException.hpp>
   
  -//class XMLMsgLoader;
  -//class XMLNetAccessor;
  -//class XMLTransService;
  +class XMLMsgLoader;
  +class XMLNetAccessor;
  +class XMLTransService;
   
   
   //
  @@ -76,30 +76,19 @@
   //  This class provides a simple abstract API via which lazily evaluated
   //  data can be cleaned up.
   //
  -class /*XMLUTIL_EXPORT*/ XMLDeleter
  +class XMLUTIL_EXPORT XMLDeleter
   {
   public :
       virtual ~XMLDeleter();
   
  -//protected :
  -//    XMLDeleter();
  +protected :
  +    XMLDeleter();
   
  -//private :
  -//    XMLDeleter(const XMLDeleter&);
  -//    void operator=(const XMLDeleter&);
  -//    void assignment(const  XMLDeleter&);
  +private :
  +    XMLDeleter(const XMLDeleter&);
  +    void operator=(const XMLDeleter&);
   };
  -
  -
  -/**
  -  * Utilities that must be implemented in a platform-specific way.
  -  *
  -  * This class contains methods that must be implemented in a platform
  -  * specific manner. The actual implementations of these methods are
  -  * available in the per-platform files indide <code>src/util/Platforms
  -  * </code>.
  -  */
  -class /*XMLUTIL_EXPORT*/ XMLPlatformUtils
  +class XMLUTIL_EXPORT XMLPlatformUtils
   {
   public :
       /** @name Public Types */
  @@ -133,7 +122,7 @@
         * not required during initialization, and only comes into play during
         * actual XML parsing.</i>
         */
  -//    static XMLNetAccessor*      fgNetAccessor;
  +    static XMLNetAccessor*      fgNetAccessor;
   
       /** The transcoding service.
         *
  @@ -145,7 +134,7 @@
         * object is reqeusted per-process, so it is shared and synchronized
         * among parser instances within that process.
         */
  -//    static XMLTransService*     fgTransService;
  +    static XMLTransService*     fgTransService;
   
       //@}
   
  @@ -201,7 +190,7 @@
         *
         * @param theFile The file handle
         */
  -//    static unsigned int curFilePos(FileHandle theFile);
  +    static unsigned int curFilePos(FileHandle theFile);
   
       /** Closes the file handle
         *
  @@ -212,7 +201,7 @@
         *
         * @param theFile The file handle to close
         */
  -//    static void closeFile(FileHandle theFile);
  +    static void closeFile(FileHandle theFile);
   
       /** Returns the file size
         *
  @@ -224,7 +213,7 @@
         *
         * @return Returns the size of the file in bytes
         */
  -//    static unsigned int fileSize(FileHandle theFile);
  +    static unsigned int fileSize(FileHandle theFile);
   
       /** Opens the file
         *
  @@ -236,7 +225,7 @@
         *
         * @return The file handle of the opened file
         */
  -//    static FileHandle openFile(const char* const fileName);
  +    static FileHandle openFile(const char* const fileName);
   
       /** Opens a named file
         *
  @@ -248,7 +237,7 @@
         *
         * @return The file handle of the opened file
         */
  -//    static FileHandle openFile(const XMLCh* const fileName);
  +    static FileHandle openFile(const XMLCh* const fileName);
   
       /** Opens the standard input as a file
         *
  @@ -259,7 +248,7 @@
         *
         * @return The file handle of the standard input stream
         */
  -//    static FileHandle openStdInHandle();
  +    static FileHandle openStdInHandle();
   
       /** Reads the file buffer
         *
  @@ -276,12 +265,12 @@
         *
         * @return Returns the number of bytes read from the stream or file
         */
  -//    static unsigned int readFileBuffer
  -//    (
  -//                FileHandle      theFile
  -//        , const unsigned int    toRead
  -//        ,       XMLByte* const  toFill
  -//    );
  +    static unsigned int readFileBuffer
  +    (
  +                FileHandle      theFile
  +        , const unsigned int    toRead
  +        ,       XMLByte* const  toFill
  +    );
   
       /** Resets the file handle
         *
  @@ -291,7 +280,7 @@
         *
         * @param theFile The file handle that you want to reset
         */
  -//    static void resetFile(FileHandle theFile);
  +    static void resetFile(FileHandle theFile);
   
       //@}
   
  @@ -312,7 +301,7 @@
         * the file name. This is dyanmically allocated and must be deleted
         * by the caller when its no longer needed!
         */
  -    static XMLCh* getFullPath(const XMLCh* /*const*/ srcPath);
  +    static XMLCh* getFullPath(const XMLCh* const srcPath);
   
       /** Determines if a path is relative or absolute
         *
  @@ -327,7 +316,7 @@
         *
         * @return Returns true if the filename appears to be relative
         */
  -    static bool isRelative(const XMLCh* /*const*/ toCheck);
  +    static bool isRelative(const XMLCh* const toCheck);
   
       /** Utility to join two paths
         *
  @@ -344,14 +333,14 @@
         * @param basePath The string containing the base path
         * @param relativePath The string containing the relative path
         *
  -      * @return Returns a string containing the 'woven' path. It should 
  +      * @return Returns a string containing the 'woven' path. It should
         * be dynamically allocated and becomes the responsibility of the
         * caller to delete.
         */
       static XMLCh* weavePaths
       (
  -        const   XMLCh* /*const*/    basePath
  -        , const XMLCh* /*const*/    relativePath
  +        const   XMLCh* const    basePath
  +        , const XMLCh* const    relativePath
       );
       //@}
   
  @@ -380,7 +369,7 @@
         *
         * @param mtxHandle The mutex handle that you want to close
         */
  -    static void closeMutex(void* /*const*/ mtxHandle);
  +    static void closeMutex(void* const mtxHandle);
   
       /** Locks a mutex handle
         *
  @@ -389,7 +378,7 @@
         *
         * @param mtxHandle The mutex handle that you want to lock
         */
  -    static void lockMutex(void* /*const*/ mtxHandle);
  +    static void lockMutex(void* const mtxHandle);
   
       /** Make a new mutex
         *
  @@ -412,7 +401,7 @@
         *
         * @param mtxGandle The mutex handle that you want to unlock
         */
  -    static void unlockMutex(void* /*const*/ mtxHandle);
  +    static void unlockMutex(void* const mtxHandle);
   
       //@}
   
  @@ -427,7 +416,7 @@
         *
         * @param msgDomain The message domain which you want to load
         */
  -    static XMLMsgLoader* loadMsgSet(const XMLCh* /*const*/ msgDomain);
  +    static XMLMsgLoader* loadMsgSet(const XMLCh* const msgDomain);
   
       //@}
   
  @@ -462,8 +451,8 @@
       static void* compareAndSwap
       (
                   void**      toFill
  -        , const void* /*const*/ newValue
  -        , const void* /*const*/ toCompare
  +        , const void* const newValue
  +        , const void* const toCompare
       );
   
       //@}
  @@ -516,6 +505,23 @@
   
       //@}
   
  +    /** @name NEL Character Handling  */
  +    //@{
  +	/**
  +      * This function enables the recognition of NEL char as whitespace chars
  +      * which is disabled by default.
  +      * It is only called once per process. Once it is set, any subsequent calls
  +      * will result in exception being thrown.
  +      *
  +      * Note: Turning this option on will make the parser non complicant.
  +      */
  +    static void recognizeNEL(bool state);
  +
  +    /**
  +      * Return the value of fgNEL flag.
  +      */
  +    static bool isNELRecognized();
  +    //@}
   
       //
       //  For internal use only.
  @@ -524,11 +530,11 @@
       //  avoid order of creation issues. Those objects can be registered
       //  here to be cleaned up during the Terminate() call.
       ///
  -    static void registerLazyData(XMLDeleter* /*const*/ deleter);
  +    static void registerLazyData(XMLDeleter* const deleter);
       static void cleanupLazyData();
   
   
  -//private :
  +private :
       /** @name Private static methods */
       //@{
   
  @@ -537,7 +543,7 @@
         * @param msgDomain The message domain containing the message to be
         * loaded
         */
  -//    static XMLMsgLoader* loadAMsgSet(const XMLCh* /*const*/ msgDomain);
  +    static XMLMsgLoader* loadAMsgSet(const XMLCh* const msgDomain);
   
       /** Creates a net accessor object.
         *
  @@ -548,7 +554,7 @@
         * @return An object derived from XMLNetAccessor. It must be dynamically
         *         allocated, since it will be deleted later.
         */
  -//    static XMLNetAccessor* makeNetAccessor();
  +    static XMLNetAccessor* makeNetAccessor();
   
       /** Creates a Transoding service
         *
  @@ -560,7 +566,7 @@
         * @return A dynamically allocated object of some class derived from
         *         the XMLTransService class.
         */
  -//    static XMLTransService* makeTransService();
  +    static XMLTransService* makeTransService();
   
       /** Does initialization for a particular platform
         *
  @@ -568,7 +574,7 @@
         * system initialization required. It <b>cannot</b> use any XML
         * parser or utilities services!
         */
  -//    static void platformInit();
  +    static void platformInit();
   
       /** Does termination for a particular platform
         *
  @@ -576,26 +582,9 @@
         * system resource cleanup required. It <b>cannot</b> use any XML
         * parser or utilities services!
         */
  -//    static void platformTerm();
  -};
  -
  -
  -//MakeXMLException(XMLPlatformUtilsException, XMLUTIL_EXPORT)
  -
  +    static void platformTerm();
   
  -
  -// ---------------------------------------------------------------------------
  -//  XMLDeleter: Public Destructor
  -// ---------------------------------------------------------------------------
  -//inline XMLDeleter::~XMLDeleter()
  -//{
  -//}
  -
  -// ---------------------------------------------------------------------------
  -//  XMLDeleter: Hidden constructors and operators
  -// ---------------------------------------------------------------------------
  -//inline XMLDeleter::XMLDeleter()
  -//{
  -//}
  +    //@}
  +};
   
  -//#endif
  +#endif
  \ No newline at end of file
  
  
  
  1.3       +71 -135   xml-xerces/perl/Xerces_headers/util/XMLURL.hpp
  
  Index: XMLURL.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/perl/Xerces_headers/util/XMLURL.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XMLURL.hpp	2001/05/05 23:07:46	1.2
  +++ XMLURL.hpp	2001/10/06 06:12:12	1.3
  @@ -55,25 +55,25 @@
    */
   
   /*
  - * $Id: XMLURL.hpp,v 1.2 2001/05/05 23:07:46 jasons Exp $
  + * $Id: XMLURL.hpp,v 1.3 2001/10/06 06:12:12 jasons Exp $
    */
   
  -//#if !defined(XMLURL_HPP)
  -//#define XMLURL_HPP
  +#if !defined(XMLURL_HPP)
  +#define XMLURL_HPP
   
  -//#include <util/XercesDefs.hpp>
  -//#include <util/XMLException.hpp>
  +#include <util/XercesDefs.hpp>
  +#include <util/XMLException.hpp>
   
  -//class BinInputStream;
  +class BinInputStream;
   
  -//MakeXMLException(MalformedURLException, XMLUTIL_EXPORT)
  +MakeXMLException(MalformedURLException, XMLUTIL_EXPORT)
   
   
   //
   //  This class supports file, http, and ftp style URLs. All others are
   //  rejected
   //
  -class /*XMLUTIL_EXPORT*/ XMLURL
  +class XMLUTIL_EXPORT XMLURL
   {
   public:
       // -----------------------------------------------------------------------
  @@ -96,54 +96,51 @@
       // -----------------------------------------------------------------------
       //  Public static methods
       // -----------------------------------------------------------------------
  -    Protocols lookupByName(const XMLCh* /*const*/ protoName);
  +    Protocols lookupByName(const XMLCh* const protoName);
   
   
       // -----------------------------------------------------------------------
       //  Constructors and Destructor
       // -----------------------------------------------------------------------
  -//    XMLURL();
  -//    XMLURL
  -//    (
  -//        const   XMLCh* const    baseURL
  -//        , const XMLCh* const    relativeURL
  -//    );
  -//    XMLURL
  -//    (
  -//        const   XMLCh* const    baseURL
  -//        , const char* const     relativeURL
  -//    );
  -//    XMLURL
  -//    (
  -//        const   XMLURL&         baseURL
  -//        , const XMLCh* const    relativeURL
  -//    );
  -//    XMLURL
  -//    (
  -//        const   XMLURL&         baseURL
  -//        , const char* const     relativeURL
  -//    );
  -//    XMLURL
  -//    (
  -//        const   XMLCh* const    urlText
  -//    );
  +    XMLURL();
       XMLURL
       (
  -        const   char* /*const*/     urlText
  +        const   XMLCh* const    baseURL
  +        , const XMLCh* const    relativeURL
       );
  -//    XMLURL(const XMLURL& toCopy);
  +    XMLURL
  +    (
  +        const   XMLCh* const    baseURL
  +        , const char* const     relativeURL
  +    );
  +    XMLURL
  +    (
  +        const   XMLURL&         baseURL
  +        , const XMLCh* const    relativeURL
  +    );
  +    XMLURL
  +    (
  +        const   XMLURL&         baseURL
  +        , const char* const     relativeURL
  +    );
  +    XMLURL
  +    (
  +        const   XMLCh* const    urlText
  +    );
  +    XMLURL
  +    (
  +        const   char* const     urlText
  +    );
  +    XMLURL(const XMLURL& toCopy);
       virtual ~XMLURL();
   
   
       // -----------------------------------------------------------------------
       //  Operators
       // -----------------------------------------------------------------------
  -//    XMLURL& operator=(const XMLURL& toAssign);
  -    XMLURL& assignment(const XMLURL& toAssign);
  -//    bool operator==(const XMLURL& toCompare) const;
  -    bool equal_to(const XMLURL& toCompare) const;
  -//    bool operator!=(const XMLURL& toCompare) const;
  -    bool not_equal_to(const XMLURL& toCompare) const;
  +    XMLURL& operator=(const XMLURL& toAssign);
  +    bool operator==(const XMLURL& toCompare) const;
  +    bool operator!=(const XMLURL& toCompare) const;
   
   
       // -----------------------------------------------------------------------
  @@ -164,40 +161,40 @@
       // -----------------------------------------------------------------------
       //  Setter methods
       // -----------------------------------------------------------------------
  -    void setURL(const XMLCh* /*const*/ urlText);
  -//    void setURL
  -//    (
  -//        const   XMLCh* const    baseURL
  -//        , const XMLCh* const    relativeURL
  -//    );
  -//    void setURL
  -//    (
  -//        const   XMLURL&         baseURL
  -//        , const XMLCh* const    relativeURL
  -//    );
  +    void setURL(const XMLCh* const urlText);
  +    void setURL
  +    (
  +        const   XMLCh* const    baseURL
  +        , const XMLCh* const    relativeURL
  +    );
  +    void setURL
  +    (
  +        const   XMLURL&         baseURL
  +        , const XMLCh* const    relativeURL
  +    );
   
   
       // -----------------------------------------------------------------------
       //  Miscellaneous methods
       // -----------------------------------------------------------------------
       bool isRelative() const;
  -//    BinInputStream* makeNewStream() const;
  -//    void makeRelativeTo(const XMLCh* const baseURLText);
  +    BinInputStream* makeNewStream() const;
  +    void makeRelativeTo(const XMLCh* const baseURLText);
       void makeRelativeTo(const XMLURL& baseURL);
   
   
  -//private:
  +private:
       // -----------------------------------------------------------------------
       //  Private helper methods
       // -----------------------------------------------------------------------
  -//    void buildFullText();
  -//    void cleanup();
  -//    bool conglomerateWithBase(const XMLURL& baseURL, bool useExceptions=true);
  -//    void parse
  -//    (
  -//        const   XMLCh* const    urlText
  -//    );
  -//    void weavePaths(const XMLCh* const basePart);
  +    void buildFullText();
  +    void cleanup();
  +    bool conglomerateWithBase(const XMLURL& baseURL, bool useExceptions=true);
  +    void parse
  +    (
  +        const   XMLCh* const    urlText
  +    );
  +    void weavePaths(const XMLCh* const basePart);
   
   
       // -----------------------------------------------------------------------
  @@ -236,76 +233,15 @@
       //      made relative if needed, canonicalized, and then put back
       //      together. Its only created upon demand.
       // -----------------------------------------------------------------------
  -//    XMLCh*          fFragment;
  -//    XMLCh*          fHost;
  -//    XMLCh*          fPassword;
  -//    XMLCh*          fPath;
  -//    unsigned int    fPortNum;
  -//    Protocols       fProtocol;
  -//    XMLCh*          fQuery;
  -//    XMLCh*          fUser;
  -//    XMLCh*          fURLText;
  +    XMLCh*          fFragment;
  +    XMLCh*          fHost;
  +    XMLCh*          fPassword;
  +    XMLCh*          fPath;
  +    unsigned int    fPortNum;
  +    Protocols       fProtocol;
  +    XMLCh*          fQuery;
  +    XMLCh*          fUser;
  +    XMLCh*          fURLText;
   };
  -
  -
  -// ---------------------------------------------------------------------------
  -//  XMLURL: Public operators
  -// ---------------------------------------------------------------------------
  -//inline bool XMLURL::operator!=(const XMLURL& toCompare) const
  -//{
  -//    return !operator==(toCompare);
  -//}
  -
  -
  -// ---------------------------------------------------------------------------
  -//  XMLURL: Getter methods
  -// ---------------------------------------------------------------------------
  -//inline const XMLCh* XMLURL::getFragment() const
  -//{
  -//    return fFragment;
  -//}
  -
  -//inline const XMLCh* XMLURL::getHost() const
  -//{
  -//    return fHost;
  -//}
  -
  -//inline const XMLCh* XMLURL::getPassword() const
  -//{
  -//    return fPassword;
  -//}
  -
  -//inline const XMLCh* XMLURL::getPath() const
  -//{
  -//    return fPath;
  -//}
  -
  -//inline XMLURL::Protocols XMLURL::getProtocol() const
  -//{
  -//    return fProtocol;
  -//}
  -
  -//inline const XMLCh* XMLURL::getQuery() const
  -//{
  -//    return fQuery;
  -//}
  -
  -//inline const XMLCh* XMLURL::getUser() const
  -//{
  -//    return fUser;
  -//}
  -
  -//inline const XMLCh* XMLURL::getURLText() const
  -//{
  -    //
  -    //  Fault it in if not already. Since this is a const method and we
  -    //  can't use mutable members due the compilers we have to support,
  -    //  we have to cast off the constness.
  -    //
  -//    if (!fURLText)
  -//        ((XMLURL*)this)->buildFullText();
  -
  -//    return fURLText;
  -//}
   
  -//#endif
  +#endif
  \ No newline at end of file
  
  
  
  1.1                  xml-xerces/perl/Xerces_headers/util/XMLUri.hpp
  
  Index: XMLUri.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   * 
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   * 
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   * 
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   * 
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   * 
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   * 
   * 4. The names "Xerces" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache\@apache.org.
   * 
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   * 
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation, and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com .  For more information
   * on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  /*
   * $Id: XMLUri.hpp,v 1.1 2001/10/06 06:12:12 jasons Exp $
   * $Log: XMLUri.hpp,v $
   * Revision 1.1  2001/10/06 06:12:12  jasons
   * new
   *
   * Revision 1.3  2001/08/29 19:03:03  peiyongz
   * Bugzilla# 2816:on AIX 4.2, xlC 3 r ev.1, Compilation error on inline method
   *
   * Revision 1.2  2001/08/16 14:09:44  peiyongz
   * Removed unused ctors and methods
   *
   * Revision 1.1  2001/08/10 16:23:41  peiyongz
   * XMLUri: creation
   *
   *
   */
  
  #if !defined(XMLURI_HPP)
  #define XMLURI_HPP
  
  #include <util/XercesDefs.hpp>
  #include <util/XMLException.hpp>
  #include <util/XMLUniDefs.hpp>
  #include <util/XMLString.hpp>
  
  /*
   * This class is a direct port of Java's URI class, to distinguish 
   * itself from the XMLURL, we use the name XMLUri instead of 
   * XMLURI.
   * 
   * TODO: how to relate XMLUri and XMLURL since URL is part of URI.
   *
   */
  
  class XMLUTIL_EXPORT XMLUri
  {
  public:
  
      // -----------------------------------------------------------------------
      //  Constructors and Destructor
      // -----------------------------------------------------------------------
  
      /**
       * Construct a new URI from a URI specification string. 
       *  
       * If the specification follows the "generic URI" syntax, (two slashes
       * following the first colon), the specification will be parsed
       * accordingly - setting the 
       *                           scheme, 
       *                           userinfo, 
       *                           host,
       *                           port, 
       *                           path, 
       *                           querystring and 
       *                           fragment 
       * fields as necessary. 
       * 
       * If the specification does not follow the "generic URI" syntax, 
       * the specification is parsed into a 
       *                           scheme and 
       *                           scheme-specific part (stored as the path) only.
       *
       * @param uriSpec the URI specification string (cannot be null or empty)
       *
       * ctor# 2
       *
       */
      XMLUri(const XMLCh* const    uriSpec);
  
      /**
       * Construct a new URI from a base URI and a URI specification string.
       * The URI specification string may be a relative URI.
       *
       * @param base the base URI (cannot be null if uriSpec is null or
       *               empty)
       * @param uriSpec the URI specification string (cannot be null or
       *                  empty if base is null)
       *
       * ctor# 7 relative ctor
       *
       */
      XMLUri(const XMLUri* const     baseURI
           , const XMLCh* const      uriSpec);
  
      virtual ~XMLUri();
  
      // -----------------------------------------------------------------------
      //  Operators
      // -----------------------------------------------------------------------
  
  
      // -----------------------------------------------------------------------
      //  Getter methods
      // -----------------------------------------------------------------------
  
      /**
       * Get the scheme for this URI.
       *
       * @return the scheme for this URI
       */
       const XMLCh* getScheme() const;
   
      /**
       * Get the userinfo for this URI.
       *
       * @return the userinfo for this URI (null if not specified).
       */
       const XMLCh* getUserInfo() const;
  
  
      /**
       * Get the host for this URI.
       *
       * @return the host for this URI (null if not specified).
       */
       const XMLCh* getHost() const;
  
      /**
       * Get the port for this URI.
       *
       * @return the port for this URI (-1 if not specified).
       */
       int getPort() const;
  
      /**
       * Get the path for this URI. Note that the value returned is the path
       * only and does not include the query string or fragment.
       *
       * @return the path for this URI.
       */
       const XMLCh* getPath() const;
  
      /**
       * Get the query string for this URI.
       *
       * @return the query string for this URI. Null is returned if there
       *         was no "?" in the URI spec, empty string if there was a
       *         "?" but no query string following it.
       */
       const XMLCh* getQueryString() const;
  
      /**
       * Get the fragment for this URI.
       *
       * @return the fragment for this URI. Null is returned if there
       *         was no "#" in the URI spec, empty string if there was a
       *         "#" but no fragment following it.
       */
       const XMLCh* getFragment() const;
  
      // -----------------------------------------------------------------------
      //  Setter methods
      // -----------------------------------------------------------------------
   
      /**
       * Set the scheme for this URI. The scheme is converted to lowercase
       * before it is set.
       *
       * @param newScheme the scheme for this URI (cannot be null)
       *
       */
       void setScheme(const XMLCh* const newScheme);
  
      /**
       * Set the userinfo for this URI. If a non-null value is passed in and
       * the host value is null, then an exception is thrown.
       *
       * @param newUserinfo the userinfo for this URI
       *
       */
       void setUserInfo(const XMLCh* const newUserInfo);
  
      /**
       * Set the host for this URI. If null is passed in, the userinfo
       * field is also set to null and the port is set to -1.
       *
       * @param newHost the host for this URI
       *
       */
       void setHost(const XMLCh* const newHost);
  
      /**
       * Set the port for this URI. -1 is used to indicate that the port is
       * not specified, otherwise valid port numbers are  between 0 and 65535.
       * If a valid port number is passed in and the host field is null,
       * an exception is thrown.
       *
       * @param newPort the port number for this URI
       *
       */
       void setPort(int newPort);
    
      /**
       * Set the path for this URI. 
       *
       * If the supplied path is null, then the
       * query string and fragment are set to null as well. 
       *
       * If the supplied path includes a query string and/or fragment, 
       * these fields will be parsed and set as well. 
       *
       * Note:
       *
       * For URIs following the "generic URI" syntax, the path 
       * specified should start with a slash.
       *
       * For URIs that do not follow the generic URI syntax, this method
       * sets the scheme-specific part.
       *
       * @param newPath the path for this URI (may be null)
       *
       */
       void setPath(const XMLCh* const newPath);
  
      /**
       * Set the query string for this URI. A non-null value is valid only
       * if this is an URI conforming to the generic URI syntax and
       * the path value is not null.
       *
       * @param newQueryString the query string for this URI
       *
       */
       void setQueryString(const XMLCh* const newQueryString);
  
      /**
       * Set the fragment for this URI. A non-null value is valid only
       * if this is a URI conforming to the generic URI syntax and
       * the path value is not null.
       *
       * @param fragment the fragment for this URI
       *
       */
       void setFragment(const XMLCh* const newFragment);
  
       // -----------------------------------------------------------------------
      //  Miscellaneous methods
      // -----------------------------------------------------------------------
  
  private:
  
      static const XMLCh RESERVED_CHARACTERS[];
      static const XMLCh MARK_CHARACTERS[];
      static const XMLCh SCHEME_CHARACTERS[];
      static const XMLCh USERINFO_CHARACTERS[];
  
      /**
       * Unimplemented copy ctor
       */
      XMLUri(const XMLUri& toCopy);    
      XMLUri& operator=(const XMLUri& toAssign);
  
      // -----------------------------------------------------------------------
      //  Private helper methods
      // -----------------------------------------------------------------------
  
      /**
       * Determine whether a character is a reserved character:
       *
       * @return true if the string contains any reserved characters
       */
      static bool isReservedCharacter(const XMLCh theChar);
  
      /**
       * Determine whether a char is an unreserved character.
       *
       * @return true if the char is unreserved, false otherwise
       */
      static bool isUnreservedCharacter(const XMLCh theChar);
  
      /**
       * Determine whether a scheme conforms to the rules for a scheme name.
       * A scheme is conformant if it starts with an alphanumeric, and
       * contains only alphanumerics, '+','-' and '.'.
       *
       * @return true if the scheme is conformant, false otherwise
       */
      static bool isConformantSchemeName(const XMLCh* const scheme);
  
      /**
       * Determine whether a userInfo conforms to the rules for a userinfo.
       *
       * @return true if the scheme is conformant, false otherwise
       */
      static void isConformantUserInfo(const XMLCh* const userInfo);
  
      /**
       * Determine whether a given string contains only URI characters (also
       * called "uric" in RFC 2396). uric consist of all reserved
       * characters, unreserved characters and escaped characters.
       *
       * @return true if the string is comprised of uric, false otherwise
       */
      static bool isURIString(const XMLCh* const uric);
  
      /**
       * Determine whether a string is syntactically capable of representing
       * a valid IPv4 address or the domain name of a network host. 
       *
       * A valid IPv4 address consists of four decimal digit groups 
       * separated by a '.'. 
       *
       * A hostname consists of domain labels (each of which must begin and 
       * end with an alphanumeric but may contain '-') separated by a '.'. 
       * See RFC 2396 Section 3.2.2.
       *
       * @return true if the string is a syntactically valid IPv4 address
       *              or hostname
       */
       static bool isWellFormedAddress(const XMLCh* const addr);
  
      /**
       * Get the indicator as to whether this URI uses the "generic URI"
       * syntax.
       *
       * @return true if this URI uses the "generic URI" syntax, false
       *         otherwise
       */
       bool isGenericURI();
  
      // -----------------------------------------------------------------------
      //  Miscellaneous methods
      // -----------------------------------------------------------------------
  
      /**
       * Initialize all fields of this URI from another URI.
       *
       * @param toCopy the URI to copy (cannot be null)
       */
       void initialize(const XMLUri& toCopy);
  
      /**
       * Initializes this URI from a base URI and a URI specification string.
       * See RFC 2396 Section 4 and Appendix B for specifications on parsing
       * the URI and Section 5 for specifications on resolving relative URIs
       * and relative paths.
       *
       * @param baseURI the base URI (may be null if uriSpec is an absolute
       *               URI)
       *
       * @param uriSpec the URI spec string which may be an absolute or
       *                  relative URI (can only be null/empty if base
       *                  is not null)
       *
       */
       void initialize(const XMLUri* const baseURI
                     , const XMLCh*  const uriSpec);
  
      /**
       * Initialize the scheme for this URI from a URI string spec.
       *
       * @param uriSpec the URI specification (cannot be null)
       *
       */
       void initializeScheme(const XMLCh* const uriSpec);
                   
      /**
       * Initialize the authority (userinfo, host and port) for this
       * URI from a URI string spec.
       *
       * @param uriSpec the URI specification (cannot be null)
       *
       */
       void initializeAuthority(const XMLCh* const uriSpec);
  
      /**
       * Initialize the path for this URI from a URI string spec.
       *
       * @param uriSpec the URI specification (cannot be null)
       *
       */
       void initializePath(const XMLCh* const uriSpec);
  
      // -----------------------------------------------------------------------
      //  Data members
      //
      //  for all the data member, we own it, 
      //  responsible for the creation and/or deletion for
      //  the memory allocated.
      //
      // -----------------------------------------------------------------------
  
      XMLCh*          fScheme;
      XMLCh*          fUserInfo;
      XMLCh*          fHost;
      int             fPort;
      XMLCh*          fPath;
      XMLCh*          fQueryString;
      XMLCh*          fFragment;
      
  };
  
  #endif
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org