You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by pe...@apache.org on 2003/04/24 04:56:22 UTC

cvs commit: xml-xerces/c/src/xercesc/util/Platforms/OS2 OS2PlatformUtils.cpp

peiyongz    2003/04/23 19:56:22

  Modified:    c/src/xercesc/util/Platforms/OS2 OS2PlatformUtils.cpp
  Log:
  Logical Path Resolution
  
  Revision  Changes    Path
  1.4       +15 -97    xml-xerces/c/src/xercesc/util/Platforms/OS2/OS2PlatformUtils.cpp
  
  Index: OS2PlatformUtils.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/OS2/OS2PlatformUtils.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- OS2PlatformUtils.cpp	9 Mar 2003 16:57:56 -0000	1.3
  +++ OS2PlatformUtils.cpp	24 Apr 2003 02:56:22 -0000	1.4
  @@ -232,107 +232,23 @@
       return true;
   }
   
  -XMLCh* XMLPlatformUtils::weavePaths( const   XMLCh* const    basePath
  -                                   , const XMLCh* const    relativePath )
  +XMLCh* XMLPlatformUtils::getCurrentDirectory()
   {
  -    // Create a buffer as large as both parts and empty it
  -    XMLCh* tmpBuf = new XMLCh[XMLString::stringLen(basePath)
  -                              + XMLString::stringLen(relativePath)
  -                              + 2];
  -    *tmpBuf = 0;
  -
  -    //
  -    //  If we have no base path, then just take the relative path as
  -    //  is.
  -    //
  -    if (!basePath || !*basePath)
  -    {
  -        XMLString::copyString(tmpBuf, relativePath);
  -        return tmpBuf;
  -    }
  -
  -    const XMLCh* basePtr = basePath + (XMLString::stringLen(basePath) - 1);
  -    if ((*basePtr != chForwardSlash)
  -    &&  (*basePtr != chBackSlash))
  -    {
  -        while ((basePtr >= basePath)
  -        &&     ((*basePtr != chForwardSlash) && (*basePtr != chBackSlash)))
  -        {
  -            basePtr--;
  -        }
  -    }
  -
  -    // There is no relevant base path, so just take the relative part
  -    if (basePtr < basePath)
  -    {
  -        XMLString::copyString(tmpBuf, relativePath);
  -        return tmpBuf;
  -    }
   
  -    // After this, make sure the buffer gets handled if we exit early
  -    ArrayJanitor<XMLCh> janBuf(tmpBuf);
  +    /*** 
  +     *  REVISIT:
  +     * 
  +     *   To be implemented later
  +    ***/
   
  -    //
  -    //  We have some path part, so we need to check to see if we ahve 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 / or the null to mean anything
  -        if ((*pathPtr != chForwardSlash) && (*pathPtr != chBackSlash)
  -        &&  *pathPtr)
  -        {
  -            break;
  -        }
  -        if (*pathPtr)
  -            pathPtr++;
  -
  -        // If its one period, just eat it, else move backwards in the base
  -        if (periodCount == 2)
  -        {
  -            basePtr--;
  -            while ((basePtr >= basePath)
  -            &&     ((*basePtr != chForwardSlash) && (*basePtr != chBackSlash)))
  -            {
  -                basePtr--;
  -            }
  -
  -            if (basePtr < basePath)
  -            {
  -                // The base cannot provide enough levels, so its in error
  -                // <TBD>
  -            }
  -        }
  -    }
  -
  -    // Copy the base part up to the base pointer
  -    XMLCh* bufPtr = tmpBuf;
  -    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
  -    janBuf.orphan();
  -    return tmpBuf;
  +    XMLCh curDir[]={ chPeriod, chForwardSlash, chNull};
  +    return getFullPath(curDir);
   }
   
  -
  +inline bool XMLPlatformUtils::isAnySlash(XMLCh c) 
  +{
  +    return ( chBackSlash == c || chForwardSlash == c);
  +}
   
   // -----------------------------------------------------------------------
   //  Timing methods
  @@ -513,6 +429,8 @@
       return 0;
   #endif
   }
  +
  +#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