dbertoni    01/09/14 13:56:21

  Modified:    c/samples/ExternalFunction ExternalFunction.cpp
  Log:
  Changes for new Function signatures.
  
  Revision  Changes    Path
  1.19      +40 -33    xml-xalan/c/samples/ExternalFunction/ExternalFunction.cpp
  
  Index: ExternalFunction.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/samples/ExternalFunction/ExternalFunction.cpp,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ExternalFunction.cpp      2001/06/07 18:00:25     1.18
  +++ ExternalFunction.cpp      2001/09/14 20:56:21     1.19
  @@ -37,26 +37,21 @@
         * object.
         *
         * @param executionContext executing context
  -      * @param context          current context node
  -      * @param opPos            current op position
  -      * @param args             vector of pointers to XObject arguments
  -      * @return                 pointer to the result XObject
  +      * @param context current context node
  +      * @param arg The argument for the function
  +      * @param locator A Locator instance for error reporting
  +      * @return pointer to the result XObject
         */
        virtual XObjectPtr
        execute(
  -                     XPathExecutionContext&                  
executionContext,
  -                     XalanNode*                                              
context,
  -                     int                                                     
        /* opPos */,
  -                     const XObjectArgVectorType&             args)
  -     {
  -             if (args.size() != 1)
  -             {
  -                     executionContext.error("The square-root() function 
takes one argument!", context);
  -             }
  -
  -             assert(args[0].null() == false);
  +                     XPathExecutionContext&  executionContext,
  +                     XalanNode*                              /* context */,  
                
  +                     const XObjectPtr                arg,
  +                     const Locator*                  /* locator */) const
  +     {
  +             assert(arg.null() == false);    
   
  -             return 
executionContext.getXObjectFactory().createNumber(sqrt(args[0]->num()));
  +             return 
executionContext.getXObjectFactory().createNumber(sqrt(arg->num()));
        }
   
        /**
  @@ -74,6 +69,14 @@
                return new FunctionSquareRoot(*this);
        }
   
  +protected:
  +
  +     const XalanDOMString
  +     getError() const
  +     {
  +             return XALAN_STATIC_UCODE_STRING("The square-root() function 
accepts one argument!");
  +     }
  +
   private:
   
        // Not implemented...
  @@ -104,19 +107,14 @@
         */
        virtual XObjectPtr
        execute(
  -                     XPathExecutionContext&                  
executionContext,
  -                     XalanNode*                                              
context,
  -                     int                                                     
        /* opPos */,
  -                     const XObjectArgVectorType&             args)
  -     {
  -             if (args.size() != 1)
  -             {
  -                     executionContext.error("The cube() function takes one 
argument!", context);
  -             }
  -
  -             assert(args[0].null() == false);
  +                     XPathExecutionContext&  executionContext,
  +                     XalanNode*                              /* context */,  
                
  +                     const XObjectPtr                arg,
  +                     const Locator*                  /* locator */) const
  +     {
  +             assert(arg.null() == false);
   
  -             return 
executionContext.getXObjectFactory().createNumber(pow(args[0]->num(), 3));
  +             return 
executionContext.getXObjectFactory().createNumber(pow(arg->num(), 3));
        }
   
        /**
  @@ -134,6 +132,14 @@
                return new FunctionCube(*this);
        }
   
  +protected:
  +
  +     const XalanDOMString
  +     getError() const
  +     {
  +             return XALAN_STATIC_UCODE_STRING("The cube() function accepts 
one argument!");
  +     }
  +
   private:
   
        // Not implemented...
  @@ -164,10 +170,9 @@
         */
        virtual XObjectPtr
        execute(
  -                     XPathExecutionContext&                  
executionContext,
  -                     XalanNode*                                              
context,
  -                     int                                                     
        /* opPos */,
  -                     const XObjectArgVectorType&             args)
  +                     XPathExecutionContext&  executionContext,
  +                     XalanNode*                              /* context */,
  +                     const Locator*                  /* locator */) const
        {
                time_t  theTime;
   
  @@ -198,10 +203,12 @@
                return new FunctionAsctime(*this);
        }
   
  +protected:
  +
        const XalanDOMString
        getError() const
        {
  -             return XalanDOMString("The asctime() function takes no 
arguments!");
  +             return XALAN_STATIC_UCODE_STRING("The asctime() function 
accepts one argument!");
        }
   
   private:
  
  
  

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

Reply via email to