--- parser3/src/classes/xnode.C 2003/03/18 16:00:06 1.54.2.10.2.2 +++ parser3/src/classes/xnode.C 2003/03/21 16:16:43 1.54.2.10.2.6 @@ -7,7 +7,7 @@ #include "classes.h" #ifdef XML -static const char* IDENT_XNODE_C="$Date: 2003/03/18 16:00:06 $"; +static const char* IDENT_XNODE_C="$Date: 2003/03/21 16:16:43 $"; #include "pa_vmethod_frame.h" @@ -102,7 +102,7 @@ private: GdomeNode *as_node(const String& method_name, MethodParams* params, int index, const char* msg) { - ValuePtr value=params->as_no_junction(index, msg); + Value* value=params->as_no_junction(index, msg); if(Value* vxnode=value->as(VXNODE_TYPE, false)) return static_cast(vxnode)->get_node(method_name); else @@ -139,7 +139,7 @@ static void _insertBefore(Request& r, co GdomeException exc; if(GdomeNode *retNode=gdome_n_insertBefore(selfNode, newChild, refChild, &exc)) { // write out result - r.write_no_lang(ValuePtr(new VXnode(&pool, &r.charsets, retNode))); + r.write_no_lang(Value*(new VXnode(&&r.charsets, retNode))); } else throw Exception( method_name, @@ -156,7 +156,7 @@ static void _replaceChild(Request& r, co GdomeException exc; if(GdomeNode *retNode=gdome_n_replaceChild(selfNode, newChild, refChild, &exc)) { // write out result - r.write_no_lang(ValuePtr(new VXnode(&pool, &r.charsets, retNode))); + r.write_no_lang(Value*(new VXnode(&&r.charsets, retNode))); } else throw Exception( method_name, @@ -172,7 +172,7 @@ static void _removeChild(Request& r, con GdomeException exc; if(GdomeNode *retNode=gdome_n_removeChild(selfNode, oldChild, &exc)) { // write out result - r.write_no_lang(ValuePtr(new VXnode(&pool, &r.charsets, retNode))); + r.write_no_lang(Value*(new VXnode(&&r.charsets, retNode))); } else throw Exception( method_name, @@ -188,7 +188,7 @@ static void _appendChild(Request& r, con GdomeException exc; if(GdomeNode *retNode=gdome_n_appendChild(selfNode, newChild, &exc)) { // write out result - r.write_no_lang(ValuePtr(new VXnode(&pool, &r.charsets, retNode))); + r.write_no_lang(Value*(new VXnode(&&r.charsets, retNode))); } else throw Exception( method_name, @@ -203,7 +203,7 @@ static void _hasChildNodes(Request& r, c GdomeException exc; // write out result bool result=gdome_n_hasChildNodes(node, &exc)!=0; - r.write_no_lang(ValuePtr(new VBool(result))); + r.write_no_lang(Value*(new VBool(result))); } // Node cloneNode(in boolean deep); @@ -215,7 +215,7 @@ static void _cloneNode(Request& r, const GdomeException exc; // write out result - r.write_no_lang(ValuePtr(new VXnode(&pool, &r.charsets, gdome_n_cloneNode(node, deep, &exc)))); + r.write_no_lang(Value*(new VXnode(&&r.charsets, gdome_n_cloneNode(node, deep, &exc)))); } // DOM1 element @@ -285,7 +285,7 @@ static void _getAttributeNode(Request& r GdomeException exc; if(GdomeAttr *attr=gdome_el_getAttributeNode(element, r.transcode(name).get(), &exc)) { // write out result - r.write_no_lang(ValuePtr(new VXnode(&pool, &r.charsets, (GdomeNode *)attr))); + r.write_no_lang(Value*(new VXnode(&&r.charsets, (GdomeNode *)attr))); } else if(exc) throw Exception( method_name, @@ -295,12 +295,12 @@ static void _getAttributeNode(Request& r // Attr setAttributeNode(in Attr newAttr) raises(DOMException); static void _setAttributeNode(Request& r, const String& method_name, MethodParams* params) { GdomeElement *element=get_self_element(r, method_name); - GdomeAttr * newAttr=as_attr(pool, method_name, params, 0, "newAttr must be ATTRIBUTE node"); + GdomeAttr * newAttr=as_attr(method_name, params, 0, "newAttr must be ATTRIBUTE node"); GdomeException exc; if(GdomeAttr *returnAttr=gdome_el_setAttributeNode(element, newAttr, &exc)) { // write out result - r.write_no_lang(ValuePtr(new VXnode(&pool, &r.charsets, (GdomeNode *)returnAttr))); + r.write_no_lang(Value*(new VXnode(&&r.charsets, (GdomeNode *)returnAttr))); } else throw Exception( method_name, @@ -310,7 +310,7 @@ static void _setAttributeNode(Request& r // Attr removeAttributeNode(in Attr oldAttr) raises(DOMException); static void _removeAttributeNode(Request& r, const String& method_name, MethodParams* params) { GdomeElement *element=get_self_element(r, method_name); - GdomeAttr * oldAttr=as_attr(pool, method_name, params, 0, "oldAttr must be ATTRIBUTE node"); + GdomeAttr * oldAttr=as_attr(method_name, params, 0, "oldAttr must be ATTRIBUTE node"); GdomeException exc; gdome_el_removeAttributeNode(element, oldAttr, &exc); @@ -326,7 +326,7 @@ static void _getElementsByTagName(Reques const String& name=params->as_string(0, "name must be string"); - VHashPtr result(new VHash); + VHash* result(new VHash); GdomeException exc; if(GdomeNodeList *nodes= gdome_el_getElementsByTagName(element, r.transcode(name).get(), &exc)) { @@ -334,9 +334,9 @@ static void _getElementsByTagName(Reques for(gulong i=0; ihash(Exception::undefined_source).put( + result->hash().put( skey, - ValuePtr(new VXnode(&pool, &r.charsets, gdome_nl_item(nodes, i, &exc)))); + Value*(new VXnode(&&r.charsets, gdome_nl_item(nodes, i, &exc)))); } } else if(exc) throw Exception( @@ -355,7 +355,7 @@ static void _getElementsByTagNameNS(Requ const String& localName=params->as_string(1, "localName must be string"); GdomeException exc; - VHashPtr result(new VHash); + VHash* result(new VHash); if(GdomeNodeList *nodes= gdome_el_getElementsByTagNameNS( element, @@ -367,8 +367,8 @@ static void _getElementsByTagNameNS(Requ const String& skey(new String); *skey << pool.format_integer(i); - result->hash(Exception::undefined_source).put(skey, - ValuePtr(new VXnode(&pool, &r.charsets, gdome_nl_item(nodes, i, &exc)))); + result->hash().put(skey, + Value*(new VXnode(&&r.charsets, gdome_nl_item(nodes, i, &exc)))); } } @@ -393,7 +393,7 @@ static void _selectX(Request& r, const S void (*handler)(Request& r, const String& expression, xmlXPathObject_auto_ptr res, - ValuePtr& result)) { + Value*& result)) { // _asm int 3; VXnode& vnode=GET_SELF(r, VXnode); @@ -417,7 +417,7 @@ static void _selectX(Request& r, const S throw Exception(expression, exc); } - ValuePtr result; + Value* result; if(res.get()) handler(r, expression, res, result); if(result) @@ -427,26 +427,26 @@ static void _selectX(Request& r, const S static void selectNodesHandler(Request& r, const String& expression, xmlXPathObject_auto_ptr res, - ValuePtr& result) { - VHashPtr vhash(new VHash); result=vhash; + Value*& result) { + VHash* vhash(new VHash); result=vhash; switch(res->type) { case XPATH_UNDEFINED: break; case XPATH_NODESET: if(res->nodesetval) if(int size=res->nodesetval->nodeNr) { - HashStringValue& hash=vhash->hash(Exception::undefined_source); + HashStringValue& hash=vhash->hash(); for(int i=0; inodesetval->nodeTab[i])))); + Value*(new VXnode(&&r.charsets, gdome_xml_n_mkref(res->nodesetval->nodeTab[i])))); } } break; default: - throw Exception(Exception::undefined_type, + throw Exception(0, expression, "wrong xmlXPathEvalExpression result type (%d)", res->type); break; // never @@ -456,7 +456,7 @@ static void selectNodesHandler(Request& static void selectNodeHandler(Request& r, const String& expression, xmlXPathObject_auto_ptr res, - ValuePtr& result) { + Value*& result) { switch(res->type) { case XPATH_UNDEFINED: @@ -468,17 +468,17 @@ static void selectNodeHandler(Request& r expression, "resulted not in a single node (%d)", res->nodesetval->nodeNr); - result=ValuePtr(new VXnode(&pool, &r.charsets, gdome_xml_n_mkref(res->nodesetval->nodeTab[0]))); + result=Value*(new VXnode(&&r.charsets, gdome_xml_n_mkref(res->nodesetval->nodeTab[0]))); } break; case XPATH_BOOLEAN: - result=ValuePtr(new VBool(res->boolval!=0)); + result=Value*(new VBool(res->boolval!=0)); break; case XPATH_NUMBER: - result=ValuePtr(new VDouble(res->floatval)); + result=Value*(new VDouble(res->floatval)); break; case XPATH_STRING: - result=ValuePtr(new VString( + result=Value*(new VString( r.transcode( GdomeDOMString_auto_ptr( gdome_str_mkref_dup((const gchar *)res->stringval)).get(), expression))); @@ -494,10 +494,10 @@ static void selectNodeHandler(Request& r static void selectBoolHandler(Request& r, const String& expression, xmlXPathObject_auto_ptr res, - ValuePtr& result) { + Value*& result) { switch(res->type) { case XPATH_BOOLEAN: - result=ValuePtr(new VBool(res->boolval!=0)); + result=Value*(new VBool(res->boolval!=0)); break; case XPATH_NODESET: if(!(res->nodesetval && res->nodesetval->nodeNr)) @@ -514,10 +514,10 @@ static void selectBoolHandler(Request& r static void selectNumberHandler(Request& r, const String& expression, xmlXPathObject_auto_ptr res, - ValuePtr& result) { + Value*& result) { switch(res->type) { case XPATH_NUMBER: - result=ValuePtr(new VDouble(res->floatval)); + result=Value*(new VDouble(res->floatval)); break; case XPATH_NODESET: if(!(res->nodesetval && res->nodesetval->nodeNr)) @@ -534,12 +534,12 @@ static void selectNumberHandler(Request& static void selectStringHandler(Request& r, const String& expression, xmlXPathObject_auto_ptr res, - ValuePtr& result) { + Value*& result) { switch(res->type) { case XPATH_UNDEFINED: break; case XPATH_STRING: - result=ValuePtr(new VString( + result=Value*(new VString( r.transcode( GdomeDOMString_auto_ptr( gdome_str_mkref_dup((const gchar *)res->stringval)).get(), expression))); @@ -638,7 +638,7 @@ MXnode::MXnode(const char* aname, VState // consts #define CONST(name) \ - consts.put(String* (new String(#name)), ValuePtr(new VInt(GDOME_##name))) + consts.put(String* (new String(#name)), Value*(new VInt(GDOME_##name))) CONST(ELEMENT_NODE); CONST(ATTRIBUTE_NODE);