xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peiyo...@apache.org
Subject cvs commit: xml-xerces/c/src/xercesc/util/Platforms/MacOS MacOSPlatformUtils.cpp
Date Thu, 24 Apr 2003 02:55:24 GMT
peiyongz    2003/04/23 19:55:24

  Modified:    c/src/xercesc/util/Platforms/MacOS MacOSPlatformUtils.cpp
  Log:
  Logical Path Resolution
  
  Revision  Changes    Path
  1.14      +15 -97    xml-xerces/c/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp
  
  Index: MacOSPlatformUtils.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- MacOSPlatformUtils.cpp	9 Mar 2003 16:56:49 -0000	1.13
  +++ MacOSPlatformUtils.cpp	24 Apr 2003 02:55:24 -0000	1.14
  @@ -119,7 +119,6 @@
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  -
   //----------------------------------------------------------------------------
   // Function Prototypes
   //----------------------------------------------------------------------------
  @@ -355,106 +354,23 @@
       return (toCheck[0] != L'/');
   }
   
  -
  -XMLCh*
  -XMLPlatformUtils::weavePaths(const   XMLCh* const    basePath
  -                                    , const XMLCh* const    relativePath)
  -
  +XMLCh* XMLPlatformUtils::getCurrentDirectory()
   {
  -    // Code from Windows largely unmodified for the Macintosh,
  -    // with the exception of removing support for '\' path
  -    // separator.
  -    //
  -    // Note that there is no support currently for Macintosh
  -    // path separators ':'.
  -
  -    // Create a buffer as large as both parts and empty it
  -    ArrayJanitor<XMLCh> tmpBuf(new XMLCh[XMLString::stringLen(basePath)
  -        + XMLString::stringLen(relativePath)
  -        + 2]);
  -    tmpBuf[0] = 0;
  -
  -    //
  -    //  If we have no base path, then just take the relative path as
  -    //  is.
  -    //
  -    if (!basePath)
  -    {
  -        XMLString::copyString(tmpBuf.get(), relativePath);
  -        return tmpBuf.release();
  -    }
  -
  -    if (!*basePath)
  -    {
  -        XMLString::copyString(tmpBuf.get(), relativePath);
  -        return tmpBuf.release();
  -    }
  -
  -    const XMLCh* basePtr = basePath + (XMLString::stringLen(basePath) - 1);
  -    if (*basePtr != chForwardSlash)
  -    {
  -        while ((basePtr >= basePath) && (*basePtr != chForwardSlash))
  -            basePtr--;
  -    }
  -
  -    // There is no relevant base path, so just take the relative part
  -    if (basePtr < basePath)
  -    {
  -        XMLString::copyString(tmpBuf.get(), relativePath);
  -        return tmpBuf.release();
  -    }
  -
  -    //  We have some path part, so we need to check to see if we have to
  -    //  weave any of the parts together.
  -    const XMLCh* pathPtr = relativePath;
  -
  -    while (true)
  -    {
  -        // If it does not start with some period, then we are done
  -        if (*pathPtr != chPeriod)
  -            break;
  -
  -        unsigned int periodCount = 1;
  -        pathPtr++;
  -        if (*pathPtr == chPeriod)
  -        {
  -            pathPtr++;
  -            periodCount++;
  -        }
  -
  -        // Has to be followed by a / or the null to mean anything
  -        if ((*pathPtr != chForwardSlash) &&  *pathPtr)
  -            break;
   
  -        if (*pathPtr)
  -            pathPtr++;
  +    /*** 
  +     *  REVISIT:
  +     * 
  +     *   To be implemented later
  +    ***/
   
  -        // If it's one period, just eat it, else move backwards in the base
  -        if (periodCount == 2)
  -        {
  -            basePtr--;
  -            while ((basePtr >= basePath) && (*basePtr != chForwardSlash))
  -                basePtr--;
  -
  -            // The base cannot provide enough levels, so it's in error/
  -            if (basePtr < basePath)
  -                ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_BasePathUnderflow);
  -        }
  -    }
  -
  -    // Copy the base part up to the base pointer
  -    XMLCh* bufPtr = tmpBuf.get();
  -    const XMLCh* tmpPtr = basePath;
  -    while (tmpPtr <= basePtr)
  -        *bufPtr++ = *tmpPtr++;
  -
  -    // And then copy on the rest of our path
  -    XMLString::copyString(bufPtr, pathPtr);
  -
  -    // Orphan the buffer and return it
  -    return tmpBuf.release();
  +    XMLCh curDir[]={ chPeriod, chForwardSlash, chNull};
  +    return getFullPath(curDir);
   }
   
  +inline bool XMLPlatformUtils::isAnySlash(XMLCh c) 
  +{
  +    return ( chBackSlash == c || chForwardSlash == c);
  +}
   
   // ---------------------------------------------------------------------------
   //  XMLPlatformUtils: Timing Methods
  @@ -1582,5 +1498,7 @@
       //	Return number of unicode characters in dst
   	return result;
   }
  +
  +#include <xercesc/util/LogicalPath.c>
   
   XERCES_CPP_NAMESPACE_END
  
  
  

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


Mime
View raw message