コード例 #1
0
/*
 * This handler takes one parameter, and returns a struct containing three 
 * elements, times10, times100 and times1000, the result of multiplying the 
 * number by 10, 100 and 1000.  
 */
XMLRPC_VALUE validator1_simpleStructReturnTest (XMLRPC_SERVER server, XMLRPC_REQUEST xRequest, void* userData) {
   XMLRPC_VALUE xStruct = XMLRPC_CreateVector(0, xmlrpc_vector_struct);
   int iIncoming = XMLRPC_GetValueInt(XMLRPC_VectorRewind(XMLRPC_RequestGetData(xRequest)));

   XMLRPC_AddValuesToVector(xStruct,
                            XMLRPC_CreateValueInt("times10", iIncoming * 10),
                            XMLRPC_CreateValueInt("times100", iIncoming * 100),
                            XMLRPC_CreateValueInt("times1000", iIncoming * 1000),
                            NULL);

   return xStruct;
}
コード例 #2
0
ファイル: xmlrpc.cpp プロジェクト: BackupTheBerlios/btg-svn
 t_int XMLRPC::genericSDTSerialize(sourceType *_source)
 {
    return XMLRPC_AddValueToVector(
                                   XMLRPC_RequestGetData(xmlrpc_request),
                                   XMLRPC_CreateValueInt(NULL, static_cast<int>(*_source))
                                   );
 }
コード例 #3
0
ファイル: xmlrpc.cpp プロジェクト: BackupTheBerlios/btg-svn
         bool XMLRPC::addByte(t_byte const _byte)
         {
            XMLRPC_AddValueToVector(
                                    XMLRPC_RequestGetData(xmlrpc_request),
                                    XMLRPC_CreateValueInt(NULL, _byte)
                                    );

            success();
            return true;
         }
コード例 #4
0
/*
 * This handler takes a single parameter, a struct, containing at least three 
 * elements named moe, larry and curly, all <i4>s.  Your handler must add the 
 * three numbers and return the result.  
 */
XMLRPC_VALUE validator1_easyStructTest (XMLRPC_SERVER server, XMLRPC_REQUEST xRequest, void* userData) {
   XMLRPC_VALUE xReturn = NULL;
   int iSum = 0;

   if(xRequest) {
      XMLRPC_VALUE xStruct = XMLRPC_VectorRewind(XMLRPC_RequestGetData(xRequest));
      if(xStruct) {
         iSum += XMLRPC_VectorGetIntWithID(xStruct, "curly");
         iSum += XMLRPC_VectorGetIntWithID(xStruct, "moe");
         iSum += XMLRPC_VectorGetIntWithID(xStruct, "larry");
      }
   }

   xReturn = XMLRPC_CreateValueInt(0, iSum);

   return xReturn;
}
コード例 #5
0
/*
 * This handler takes a single parameter, a struct, that models a daily 
 * calendar.  At the top level, there is one struct for each year.  Each year 
 * is broken down into months, and months into days.  Most of the days are 
 * empty in the struct you receive, but the entry for April 1, 2000 contains 
 * a least three elements named moe, larry and curly, all <i4>s.  Your 
 * handler must add the three numbers and return the result.  
 * 
 * Ken MacLeod: "This description isn't clear, I expected '2000.April.1' when 
 * in fact it's '2000.04.01'.  Adding a note saying that month and day are 
 * two-digits with leading 0s, and January is 01 would help." Done.  
 */
XMLRPC_VALUE validator1_nestedStructTest (XMLRPC_SERVER server, XMLRPC_REQUEST xRequest, void* userData) {
   XMLRPC_VALUE xReturn = NULL; 
   XMLRPC_VALUE xParams = XMLRPC_RequestGetData(xRequest);

   int iSum = 0;

   XMLRPC_VALUE xStruct = XMLRPC_VectorRewind(xParams);
   XMLRPC_VALUE xYear = XMLRPC_VectorGetValueWithID(xStruct, "2000");
   XMLRPC_VALUE xMonth = XMLRPC_VectorGetValueWithID(xYear, "04");
   XMLRPC_VALUE xDay = XMLRPC_VectorGetValueWithID(xMonth, "01");

   iSum += XMLRPC_VectorGetIntWithID(xDay, "larry");
   iSum += XMLRPC_VectorGetIntWithID(xDay, "curly");
   iSum += XMLRPC_VectorGetIntWithID(xDay, "moe");

   xReturn = XMLRPC_CreateValueInt(0, iSum);

   return xReturn;
}
コード例 #6
0
/*   
 * This handler takes a single parameter, an array of structs, each of which 
 * contains at least three elements named moe, larry and curly, all <i4>s.  
 * Your handler must add all the struct elements named curly and return the 
 * result.  
 */
XMLRPC_VALUE validator1_arrayOfStructsTest (XMLRPC_SERVER server, XMLRPC_REQUEST xRequest, void* userData) {
   XMLRPC_VALUE xReturn = NULL;

   int iCurly = 0;

   if(xRequest) {
      XMLRPC_VALUE xArray = XMLRPC_VectorRewind(XMLRPC_RequestGetData(xRequest));
      if(xArray) {
         XMLRPC_VALUE xIter = XMLRPC_VectorRewind(xArray);
         while(xIter) {
            iCurly += XMLRPC_VectorGetIntWithID(xIter, "curly");

            xIter = XMLRPC_VectorNext(xArray);
         }
      }
   }

   xReturn = XMLRPC_CreateValueInt(0, iCurly);

   return xReturn;
}
コード例 #7
0
void LLXMLRPCValue::appendInt(const char* id, int v)
{
	XMLRPC_AddValueToVector(mV, XMLRPC_CreateValueInt(id, v));
}
コード例 #8
0
void LLXMLRPCValue::appendInt(int v)
{
	XMLRPC_AddValueToVector(mV, XMLRPC_CreateValueInt(NULL, v));
}