dbertoni    02/04/25 23:25:23

  Modified:    c/src/XalanExtensions FunctionDifference.cpp
                        FunctionDistinct.cpp FunctionIntersection.cpp
                        FunctionNodeSet.cpp FunctionNodeSet.hpp
                        XalanExtensions.hpp
  Log:
  Make sure nodes are added in document order.
  
  Revision  Changes    Path
  1.7       +3 -1      xml-xalan/c/src/XalanExtensions/FunctionDifference.cpp
  
  Index: FunctionDifference.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanExtensions/FunctionDifference.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FunctionDifference.cpp    17 Apr 2002 05:34:20 -0000      1.6
  +++ FunctionDifference.cpp    26 Apr 2002 06:25:23 -0000      1.7
  @@ -108,9 +108,11 @@
   
                if (nodeset2.indexOf(theNode) == NodeRefListBase::npos)
                {
  -                     theResult->addNode(theNode);
  +                     theResult->addNodeInDocOrder(theNode, executionContext);
                }
        }
  +
  +     theResult->setDocumentOrder();
   
        return executionContext.getXObjectFactory().createNodeSet(theResult);
   }
  
  
  
  1.9       +3 -1      xml-xalan/c/src/XalanExtensions/FunctionDistinct.cpp
  
  Index: FunctionDistinct.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanExtensions/FunctionDistinct.cpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- FunctionDistinct.cpp      17 Apr 2002 05:34:20 -0000      1.8
  +++ FunctionDistinct.cpp      26 Apr 2002 06:25:23 -0000      1.9
  @@ -140,7 +140,7 @@
   
                        if (theStrings.find(theCachedString) == 
theStrings.end())
                        {
  -                             theResult->addNode(theNode);
  +                             theResult->addNodeInDocOrder(theNode, 
executionContext);
   
                                theStrings.insert(theCachedString);
                        }
  @@ -148,6 +148,8 @@
                        clear(theCachedString);
                }
        }
  +
  +     theResult->setDocumentOrder();
   
        return executionContext.getXObjectFactory().createNodeSet(theResult);
   }
  
  
  
  1.7       +3 -1      xml-xalan/c/src/XalanExtensions/FunctionIntersection.cpp
  
  Index: FunctionIntersection.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanExtensions/FunctionIntersection.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FunctionIntersection.cpp  17 Apr 2002 05:34:20 -0000      1.6
  +++ FunctionIntersection.cpp  26 Apr 2002 06:25:23 -0000      1.7
  @@ -105,9 +105,11 @@
   
                if (nodeset2.indexOf(theNode) != NodeRefListBase::npos)
                {
  -                     theResult->addNode(theNode);
  +                     theResult->addNodeInDocOrder(theNode, executionContext);
                }
        }
  +
  +     theResult->setDocumentOrder();
   
        return executionContext.getXObjectFactory().createNodeSet(theResult);
   }
  
  
  
  1.8       +20 -8     xml-xalan/c/src/XalanExtensions/FunctionNodeSet.cpp
  
  Index: FunctionNodeSet.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanExtensions/FunctionNodeSet.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FunctionNodeSet.cpp       17 Apr 2002 05:34:20 -0000      1.7
  +++ FunctionNodeSet.cpp       26 Apr 2002 06:25:23 -0000      1.8
  @@ -139,7 +139,8 @@
   
   
   
  -FunctionNodeSet::FunctionNodeSet()
  +FunctionNodeSet::FunctionNodeSet(bool        convertString) :
  +     m_convertString(convertString)
   {
   }
   
  @@ -165,19 +166,22 @@
   
        assert(args[0].null() == false);
   
  -     if (args[0]->getType() != XObject::eTypeResultTreeFrag)
  +     const XObject::eObjectType      theType = args[0]->getType();
  +
  +     if (theType == XObject::eTypeResultTreeFrag ||
  +             (theType == XObject::eTypeString && m_convertString == true))
  +     {
  +             return XObjectPtr(new XResultTreeFragNodeSetProxy(args[0]));
  +     }
  +     else
        {
                executionContext.warn(
  -                     "Invalid argument type in function nodeset()!",
  +                     getInvalidArgumentTypeError(),
                        context,
                        locator);
   
                return args[0];
        }
  -     else
  -     {
  -             return XObjectPtr(new XResultTreeFragNodeSetProxy(args[0]));
  -     }
   }
   
   
  @@ -197,5 +201,13 @@
   const XalanDOMString
   FunctionNodeSet::getError() const
   {
  -     return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The 
node-set() function accepts one argument"));
  +     return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The nodeset() 
function accepts one argument"));
  +}
  +
  +
  +
  +const XalanDOMString
  +FunctionNodeSet::getInvalidArgumentTypeError() const
  +{
  +     return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("Invalid 
argument type in function nodeset()"));
   }
  
  
  
  1.5       +14 -2     xml-xalan/c/src/XalanExtensions/FunctionNodeSet.hpp
  
  Index: FunctionNodeSet.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanExtensions/FunctionNodeSet.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FunctionNodeSet.hpp       17 Apr 2002 05:34:20 -0000      1.4
  +++ FunctionNodeSet.hpp       26 Apr 2002 06:25:23 -0000      1.5
  @@ -80,7 +80,12 @@
   {
   public:
   
  -     FunctionNodeSet();
  +     /**
  +      * Constructor.
  +      * 
  +      * @param convertString If true, strings as well as result tree 
fragments will be converted to nodesets.
  +      */
  +     FunctionNodeSet(bool    convertString = true);
   
        virtual
        ~FunctionNodeSet();
  @@ -103,9 +108,12 @@
   
   protected:
   
  -     const XalanDOMString
  +     virtual const XalanDOMString
        getError() const;
   
  +     virtual const XalanDOMString
  +     getInvalidArgumentTypeError() const;
  +
   private:
   
        // Not implemented...
  @@ -114,6 +122,10 @@
   
        bool
        operator==(const FunctionNodeSet&) const;
  +
  +
  +     // Data members...
  +     const bool      m_convertString;
   };
   
   
  
  
  
  1.2       +60 -6     xml-xalan/c/src/XalanExtensions/XalanExtensions.hpp
  
  Index: XalanExtensions.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanExtensions/XalanExtensions.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XalanExtensions.hpp       18 Jul 2001 05:50:19 -0000      1.1
  +++ XalanExtensions.hpp       26 Apr 2002 06:25:23 -0000      1.2
  @@ -59,12 +59,66 @@
   
   
   
  -#include <XalanExtensions/FunctionDifference.hpp>
  -#include <XalanExtensions/FunctionDistinct.hpp>
  -#include <XalanExtensions/FunctionEvaluate.hpp>
  -#include <XalanExtensions/FunctionHasSameNodes.hpp>
  -#include <XalanExtensions/FunctionIntersection.hpp>
  -#include <XalanExtensions/FunctionNodeSet.hpp>
  +// Base header file.  Must be first.
  +#include <XalanExtensions/XalanExtensionsDefinitions.hpp>
  +
  +
  +
  +#include <XalanDOM/XalanDOMString.hpp>
  +
  +
  +
  +class Function;
  +class XPathEnvSupportDefault;
  +
  +
  +
  +class XALAN_XALANEXTENSIONS_EXPORT XalanExtensionsInstaller
  +{
  +public:
  +
  +     struct FunctionTableEntry
  +     {
  +             const XalanDOMChar*             theFunctionName;
  +             const Function*                 theFunction;
  +     };
  +
  +     static void
  +     installLocal(XPathEnvSupportDefault&    theSupport);
  +
  +     static void
  +     installGlobal();
  +
  +     static void
  +     uninstallLocal(XPathEnvSupportDefault&  theSupport);
  +
  +     static void
  +     uninstallGlobal();
  +
  +protected:
  +
  +     static void
  +     doInstallLocal(
  +                     const XalanDOMChar*                     theNamespace,
  +                     const FunctionTableEntry        theFunctionTable[],
  +                     XPathEnvSupportDefault&         theSupport);
  +
  +     static void
  +     doInstallGlobal(
  +                     const XalanDOMChar*                     theNamespace,
  +                     const FunctionTableEntry        theFunctionTable[]);
  +
  +     static void
  +     doUninstallLocal(
  +                     const XalanDOMChar*                     theNamespace,
  +                     const FunctionTableEntry        theFunctionTable[],
  +                     XPathEnvSupportDefault&         theSupport);
  +
  +     static void
  +     doUninstallGlobal(
  +                     const XalanDOMChar*                     theNamespace,
  +                     const FunctionTableEntry        theFunctionTable[]);
  +};
   
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to