auriemma    01/02/27 14:00:10

  Modified:    c/src/XSLT ElemSort.cpp ElemSort.hpp ElemTemplateElement.cpp
  Log:
  Updated ElemSort to use AVT's.
  
  Revision  Changes    Path
  1.7       +50 -9     xml-xalan/c/src/XSLT/ElemSort.cpp
  
  Index: ElemSort.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemSort.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ElemSort.cpp      2001/02/12 02:34:53     1.6
  +++ ElemSort.cpp      2001/02/27 22:00:06     1.7
  @@ -83,10 +83,10 @@
                                                columnNumber,
                                                Constants::ELEMNAME_SORT),
        m_selectPattern(0),
  -     m_langAVT(),
  -     m_dataTypeAVT(Constants::ATTRVAL_DATATYPE_TEXT),
  -     m_orderAVT(Constants::ATTRVAL_ORDER_ASCENDING),
  -     m_caseOrderAVT()
  +     m_langAVT(0),
  +     m_dataTypeAVT(0),
  +     m_orderAVT(0),
  +     m_caseOrderAVT(0)
   {
        const unsigned int nAttrs = atts.getLength();
   
  @@ -100,22 +100,26 @@
                                = 
constructionContext.createXPath(atts.getValue(i), *this);
                }
                else if(equals(aname, Constants::ATTRNAME_LANG))
  -             {
  -                     m_langAVT = atts.getValue(i);
  +             {                       
  +                     m_langAVT = new AVT(aname,      atts.getType(i), 
atts.getValue(i),
  +                             *this, constructionContext);
                }
                else if(equals(aname, Constants::ATTRNAME_DATATYPE))
                {
  -                     m_dataTypeAVT = atts.getValue(i);
  +                     m_dataTypeAVT = new AVT(aname,  atts.getType(i), 
atts.getValue(i),
  +                             *this, constructionContext);
                }
                else if(equals(aname, Constants::ATTRNAME_ORDER))
                {
  -                     m_orderAVT = atts.getValue(i);
  +                     m_orderAVT = new AVT(aname,     atts.getType(i), 
atts.getValue(i),
  +                             *this, constructionContext);
                }
                else if(equals(aname, Constants::ATTRNAME_CASEORDER))
                {
                        constructionContext.warn("Xalan C++ does not yet handle 
the " + Constants::ATTRNAME_CASEORDER + " attribute!");
   
  -                     m_caseOrderAVT = atts.getValue(i);
  +                     m_caseOrderAVT = new AVT(aname, atts.getType(i), 
atts.getValue(i),
  +                             *this, constructionContext);
                }
                else if(!isAttrOK(aname, atts, i, constructionContext))
                {
  @@ -123,12 +127,49 @@
                }
        }
   
  +     //m_dataTypeAVT(Constants::ATTRVAL_DATATYPE_TEXT),
  +     //m_orderAVT(Constants::ATTRVAL_ORDER_ASCENDING),
  +
  +
  +     if(0 == m_dataTypeAVT)
  +     {
  +             m_dataTypeAVT = new AVT(c_wstr(Constants::ATTRNAME_DATATYPE), 
c_wstr(Constants::ATTRTYPE_CDATA), c_wstr(Constants::ATTRVAL_DATATYPE_TEXT), 
  +                     *this, constructionContext);
  +     }
  +
  +     if(0 == m_orderAVT)
  +     {
  +             m_orderAVT = new AVT(c_wstr(Constants::ATTRNAME_ORDER), 
c_wstr(Constants::ATTRTYPE_CDATA), c_wstr(Constants::ATTRVAL_ORDER_ASCENDING),
  +                     *this, constructionContext);
  +     }
  +
        if(0 == m_selectPattern)
        {
                m_selectPattern = 
constructionContext.createXPath(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING(".")),
 *this);
        }
   }
   
  +
  +ElemSort::~ElemSort()
  +{
  +#if defined(XALAN_CANNOT_DELETE_CONST)
  +     delete (AVT*)m_langAVT;
  +
  +     delete (AVT*)m_dataTypeAVT;
  +
  +     delete (AVT*)m_orderAVT;
  +
  +     delete (AVT*)m_caseOrderAVT;
  +#else
  +     delete m_langAVT;
  +
  +     delete m_dataTypeAVT;
  +
  +     delete m_orderAVT;
  +
  +     delete m_caseOrderAVT;
  +#endif
  +}
   
   
   const XalanDOMString&
  
  
  
  1.7       +14 -10    xml-xalan/c/src/XSLT/ElemSort.hpp
  
  Index: ElemSort.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemSort.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ElemSort.hpp      2001/02/12 02:34:53     1.6
  +++ ElemSort.hpp      2001/02/27 22:00:07     1.7
  @@ -65,6 +65,7 @@
   
   
   // Base class header file.
  +#include "AVT.hpp"
   #include "ElemTemplateElement.hpp"
   
   
  @@ -74,6 +75,7 @@
   
   
   class XPath;
  +class AVT;
   
   
   
  @@ -97,12 +99,14 @@
                        int                                                     
        lineNumber,
                        int                                                     
        columnNumber);
   
  +     ~ElemSort();
  +
        /**
         * Retrieve the language attribute value template(AVT) 
         * 
  -      * @return string corresponding the language AVT
  +      * @return the language AVT
         */
  -     const XalanDOMString&
  +     const AVT*
        getLangAVT() const
        {
                return m_langAVT;
  @@ -111,9 +115,9 @@
        /**
         * Retrieve the order attribute value template(AVT) 
         * 
  -      * @return string corresponding the order AVT
  +      * @return the order AVT
         */
  -     const XalanDOMString&
  +     const AVT*
        getOrderAVT() const
        {
                return m_orderAVT;
  @@ -122,9 +126,9 @@
        /**
         * Retrieve the data type attribute value template(AVT) 
         * 
  -      * @return string corresponding the data type AVT
  +      * @return the data type AVT
         */
  -     const XalanDOMString&
  +     const AVT*
        getDataTypeAVT() const
        {
                return m_dataTypeAVT;
  @@ -148,10 +152,10 @@
   
        const XPath*    m_selectPattern;
   
  -    XalanDOMString   m_langAVT;
  -    XalanDOMString   m_dataTypeAVT;
  -     XalanDOMString  m_orderAVT;
  -    XalanDOMString   m_caseOrderAVT;
  +    const AVT*               m_langAVT;
  +    const AVT*               m_dataTypeAVT;
  +     const AVT*              m_orderAVT;
  +    const AVT*               m_caseOrderAVT;
   };
   
   
  
  
  
  1.46      +27 -5     xml-xalan/c/src/XSLT/ElemTemplateElement.cpp
  
  Index: ElemTemplateElement.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplateElement.cpp,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- ElemTemplateElement.cpp   2001/02/12 23:55:25     1.45
  +++ ElemTemplateElement.cpp   2001/02/27 22:00:07     1.46
  @@ -582,16 +582,38 @@
                {
                        ElemSort* sort = foreach->getSortElems()[i];
                        assert(sort != 0);
  -                     
  -                     const XalanDOMString langString = 
(!isEmpty(sort->getLangAVT())) ? 
  -                             
executionContext.evaluateAttrVal(sourceNodeContext, *sort, sort->getLangAVT()): 
XalanDOMString();
   
  -                     const XalanDOMString dataTypeString = 
executionContext.evaluateAttrVal(sourceNodeContext, *sort, 
sort->getDataTypeAVT());
  +                     const AVT* avt = 0;
   
  +                     XalanDOMString langString;
  +                                             
  +                     avt = sort->getLangAVT();
  +
  +                     if(0 != avt)
  +                     {
  +                             avt->evaluate(langString, sourceNodeContext, 
xslInstruction, executionContext);
  +                     }
  +
  +                     XalanDOMString dataTypeString;
  +
  +                     avt = sort->getDataTypeAVT();
  +
  +                     if(0 != avt)
  +                     {
  +                             avt->evaluate(dataTypeString, 
sourceNodeContext, xslInstruction, executionContext);
  +                     }                       
  +
                        bool treatAsNumbers = ((!isEmpty(dataTypeString)) && 
equals(dataTypeString,Constants::ATTRVAL_DATATYPE_NUMBER)) ? 
                                true : false;
  +
  +                     XalanDOMString orderString;
  +
  +                     avt = sort->getOrderAVT();
   
  -                     const XalanDOMString    orderString = 
executionContext.evaluateAttrVal(sourceNodeContext, *sort, sort->getOrderAVT());
  +                     if(0 != avt)
  +                     {
  +                             avt->evaluate(orderString, sourceNodeContext, 
xslInstruction, executionContext);
  +                     }                       
   
                        bool descending = ((!isEmpty(orderString)) &&  
equals(orderString,Constants::ATTRVAL_ORDER_DESCENDING))? 
                                true : false;
  
  
  

Reply via email to