dbertoni    01/01/25 08:59:05

  Modified:    c/src/PlatformSupport DirectoryEnumerator.hpp
  Log:
  Changes for Solaris port.  Changed enumerators to accept a specific search 
specification.
  
  Revision  Changes    Path
  1.15      +71 -20    xml-xalan/c/src/PlatformSupport/DirectoryEnumerator.hpp
  
  Index: DirectoryEnumerator.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/DirectoryEnumerator.hpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DirectoryEnumerator.hpp   2001/01/08 18:13:29     1.14
  +++ DirectoryEnumerator.hpp   2001/01/25 16:59:03     1.15
  @@ -74,15 +74,14 @@
   
   #include <functional>
   #include <iterator>
  -#include <vector>
   
   
   
  -#include <XalanDOM/XalanDOMString.hpp>
  +//#include <XalanDOM/XalanDOMString.hpp>
   
   
   
  -#include <PlatformSupport/DOMStringHelper.hpp>
  +//#include <PlatformSupport/DOMStringHelper.hpp>
   
   
   
  @@ -150,7 +149,7 @@
         */
        bool isDirectory() const
        {
  -#if defined(AIX) || defined(HPUX)    
  +#if defined(AIX) || defined(HPUX) || defined(SOLARIS)
                return false;
   #else                
                return d_type == DT_DIR;                
  @@ -201,19 +200,15 @@
                 class StringConversionFunction>
   void
   EnumerateDirectory(
  -                     const StringType&                       theDirectory,
  +                     const StringType&                       
theFullSearchSpec,
                        OutputIteratorType                      
theOutputIterator,
                        FilterPredicateType                     
theFilterPredicate,
                        StringConversionFunction        theConversionFunction)
   {
   #if defined(_MSC_VER)
  -     StringType      theSearchSpec(theDirectory);
  -
  -     append(theSearchSpec, "\\*");
  -
        FindFileStruct          theFindData;
   
  -     long    theSearchHandle = 
_wfindfirst(const_cast<wchar_t*>(theConversionFunction(theSearchSpec)),
  +     long    theSearchHandle = 
_wfindfirst(const_cast<wchar_t*>(theConversionFunction(theFullSearchSpec)),
                                                                                
  &theFindData);
   
        if (theSearchHandle != -1)
  @@ -224,7 +219,7 @@
                        {
                                if (theFilterPredicate(theFindData) == true)
                                {
  -                                     *theOutputIterator = 
XalanDOMString(theFindData.getName());
  +                                     *theOutputIterator = 
StringType(theFindData.getName());
                                }
                        }
                        while(_wfindnext(theSearchHandle,
  @@ -249,6 +244,27 @@
   
   
   
  +template<class OutputIteratorType,
  +              class FilterPredicateType,
  +              class StringType,
  +              class StringConversionFunction>
  +void
  +EnumerateDirectory(
  +                     const StringType&                       theDirectory,
  +                     const StringType&                       theSearchSpec,
  +                     OutputIteratorType                      
theOutputIterator,
  +                     FilterPredicateType                     
theFilterPredicate,
  +                     StringConversionFunction        theConversionFunction)
  +{
  +     StringType      theFullSearchSpec(theDirectory);
  +
  +     theFullSearchSpec += theSearchSpec;
  +
  +     EnumerateDirectory(theFullSearchSpec, theOutputIterator, 
theFilterPredicate, theConversionFunction);
  +}
  +
  +
  +
   #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
   template<class CollectionType, class StringType>
   struct DirectoryEnumeratorFunctor
  @@ -291,29 +307,64 @@
        typedef typename BaseClassType::result_type             result_type;
        typedef typename BaseClassType::argument_type   argument_type;
   
  +     void
  +     operator()(
  +                     const argument_type&    theFullSearchSpec,
  +                     CollectionType&                 theCollection) const
  +     {
  +#if !defined(XALAN_NO_NAMESPACES)
  +             using std::back_inserter;
  +#endif
  +
  +             EnumerateDirectory(theFullSearchSpec,
  +                                                back_inserter(theCollection),
  +                                                m_filterPredicate,
  +                                                m_conversionFunction);
  +     }
  +
        result_type
  -     operator()(const argument_type&         theDirectory) const
  +     operator()(const argument_type&         theFullSearchSpec) const
        {
                result_type             theCollection;
   
  -             operator()(theDirectory,
  -                                theCollection);
  +             operator()(
  +                             theFullSearchSpec,
  +                             theCollection);
   
                return theCollection;
        }
   
        void
  -     operator()(const argument_type&         theDirectory,
  -                        CollectionType&                      theCollection) 
const
  +     operator()(
  +                     const argument_type&    theDirectory,
  +                     const argument_type&    theSearchSpec,
  +                     CollectionType&                 theCollection) const
        {
   #if !defined(XALAN_NO_NAMESPACES)
                using std::back_inserter;
   #endif
   
  -             EnumerateDirectory(theDirectory,
  -                                                back_inserter(theCollection),
  -                                                m_filterPredicate,
  -                                                m_conversionFunction);
  +             EnumerateDirectory(
  +                             theDirectory,
  +                             theSearchSpec,
  +                             back_inserter(theCollection),
  +                             m_filterPredicate,
  +                             m_conversionFunction);
  +     }
  +
  +     result_type
  +     operator()(
  +                     const argument_type&    theDirectory,
  +                     const argument_type&    theSearchSpec) const
  +     {
  +             result_type             theCollection;
  +
  +             operator()(
  +                             theDirectory,
  +                             theSearchSpec,
  +                             theCollection);
  +
  +             return theCollection;
        }
   
   private:
  
  
  

Reply via email to