// -------------------------------------------------------------------------- //! give a unsigned int if exist and if is of the good type, else return false // -------------------------------------------------------------------------- bool XipTreeRequestReceiver::getUniqueUIntElement(short IdElement, unsigned int &content) { char * res = getElementContent(IdElement, sizeof(unsigned int)); if(res) { content = *((unsigned int *)res); return true; } return false; }
// -------------------------------------------------------------------------- //! give a double if exist and if is of the good type, else return false // -------------------------------------------------------------------------- bool XipTreeRequestReceiver::getUniqueDoubleElement(short IdElement, double &content) { char * res = getElementContent(IdElement, sizeof(double)); if(res) { content = *((double *)res); return true; } return false; }
// -------------------------------------------------------------------------- //! give a float if exist and if is of the good type, else return false // -------------------------------------------------------------------------- bool XipTreeRequestReceiver::getUniqueFloatElement(short IdElement, float &content) { char * res = getElementContent(IdElement, sizeof(float)); if(res) { content = *((float *)res); return true; } return false; }
// -------------------------------------------------------------------------- //! give a bool if exist and if is of the good type, else return false // -------------------------------------------------------------------------- bool XipTreeRequestReceiver::getUniqueBoolElement(short IdElement, bool &content) { char * res = getElementContent(IdElement, sizeof(bool)); if(res) { content = *((bool *)res); return true; } return false; }
void configurePCPtoTCMappings(char* url, unsigned short pcpToTcMappingTable[], unsigned short tableSize) { MemoryStruct httpPutBody; MemoryStruct httpResponseBody; MemoryStruct httpResponseHeaders; httpPutBody.data = createRequestBody1(pcpToTcMappingTable, tableSize); httpPutBody.size = strlen(httpPutBody.data); httpPutBody.bytesCopied = 0; httpPutBody.bytesRemaining = httpPutBody.size; printf("requestBody:\n\n%s\n", httpPutBody.data); printf("getElementContent:\n"); char* element = getElementContent(&httpPutBody, "ns0:priority"); printf("getElementContent: returned %s\n", element); free(element); printf("getElementContent2:\n"); char* element2 = getElementContent2(&httpPutBody, "ns0:priority"); printf("getElementContent2: returned %s\n", element2); free(element2); /* httpPutBody.size = strlen(httpPutBody.data); httpPutBody.bytesCopied = 0; httpPutBody.bytesRemaining = httpPutBody.size; httpResponseBody.data = malloc(1); httpResponseBody.size = 0; httpResponseHeaders.data = malloc(1); httpResponseHeaders.size = 0; //printf("requestBody:\n\n%s\n", requestBody); httpPut(NULL, url, &httpPutBody, &httpResponseBody, &httpResponseHeaders); */ free(httpPutBody.data); //free(httpResponseBody.data); //free(httpResponseHeaders.data); }
string Configurable::getElementContent(Configurator&c, const char * key, const xmlNode * node) { return getElementContent(c.doc, key,node); }