diff --git a/common/fileview2/fvresultset.cpp b/common/fileview2/fvresultset.cpp index 2c46aa66523..5974f407593 100644 --- a/common/fileview2/fvresultset.cpp +++ b/common/fileview2/fvresultset.cpp @@ -2342,11 +2342,12 @@ extern FILEVIEW_API unsigned writeResultCursorXml(IXmlWriterExt & writer, IResul writer.outputCString(schemaName, "@xmlSchema"); if (xmlns) { - Owned it = const_cast(xmlns)->getIterator(); + Owned it = xmlns->getIterator(); ForEach(*it) { const char *name = it->getPropKey(); - writer.outputXmlns(name,const_cast(xmlns)->queryProp(name)); + const char *value = it->queryPropValue(); + writer.outputXmlns(name,value); } } cursor->beginWriteXmlRows(writer); diff --git a/common/pkgfiles/package.cpp b/common/pkgfiles/package.cpp index 65a3998f902..0516a2473d5 100644 --- a/common/pkgfiles/package.cpp +++ b/common/pkgfiles/package.cpp @@ -52,7 +52,7 @@ void CPackageNode::mergeEnvironment(const CPackageNode *base) ForEach(*envIterator) { const char *id = envIterator->getPropKey(); - const char *val = base->mergedEnvironment->queryProp(id); + const char *val = envIterator->queryPropValue(); if (id && val && !mergedEnvironment->hasProp(id)) mergedEnvironment->setProp(id, val); } diff --git a/common/thorhelper/roxiedebug.cpp b/common/thorhelper/roxiedebug.cpp index 7f0333072a4..7d1a9d220f7 100644 --- a/common/thorhelper/roxiedebug.cpp +++ b/common/thorhelper/roxiedebug.cpp @@ -898,7 +898,7 @@ void DebugActivityRecord::outputProperties(IXmlWriter *output) while (iterator->isValid()) { const char *propName = iterator->getPropKey(); - const char *propValue = properties->queryProp(propName); + const char *propValue = iterator->queryPropValue(); output->outputBeginNested("att", false); output->outputCString(propName, "@name"); output->outputCString(propValue, "@value"); output->outputEndNested("att"); iterator->next(); } @@ -1900,7 +1900,7 @@ void CBaseServerDebugContext::getCurrentGraphXGMML(IXmlWriter *output, bool orig while (iterator->isValid()) { const char *graphName = iterator->getPropKey(); - const char *graphXML = completedGraphs->queryProp(graphName); + const char *graphXML = iterator->queryPropValue(); output->outputString(0, 0, NULL); output->outputQuoted(graphXML); iterator->next(); diff --git a/common/thorhelper/roxiehelper.cpp b/common/thorhelper/roxiehelper.cpp index c4ced835b4a..20602b64535 100644 --- a/common/thorhelper/roxiehelper.cpp +++ b/common/thorhelper/roxiehelper.cpp @@ -2253,15 +2253,16 @@ void FlushingStringBuffer::startDataset(const char *elementName, const char *res s.append("result_").append(sequence+1).append('\''); if (xmlns) { - Owned it = const_cast(xmlns)->getIterator(); //should fix IProperties to be const friendly + Owned it = xmlns->getIterator(); ForEach(*it) { const char *name = it->getPropKey(); + const char *value = it->queryPropValue(); s.append(' '); if (!streq(name, "xmlns")) s.append("xmlns:"); s.append(name).append("='"); - encodeUtf8XML(const_cast(xmlns)->queryProp(name), s); + encodeUtf8XML(value, s); s.append("'"); } } diff --git a/common/thorhelper/thorsoapcall.cpp b/common/thorhelper/thorsoapcall.cpp index 67a1dcdd5f0..be9abd2b4b2 100644 --- a/common/thorhelper/thorsoapcall.cpp +++ b/common/thorhelper/thorsoapcall.cpp @@ -1920,7 +1920,7 @@ class CWSCAsyncFor : implements IWSCAsyncFor, public CInterface, public CAsyncFo const char * key = iter->getPropKey(); if (!httpHeaderBlockContainsHeader(httpheaders, key)) { - const char * value = traceHeaders->queryProp(key); + const char * value = iter->queryPropValue(); if (!isEmptyString(value)) request.append(key).append(": ").append(value).append("\r\n"); } diff --git a/ecl/eclagent/eclagent.cpp b/ecl/eclagent/eclagent.cpp index d6c749a09c7..dc22e1f69dd 100644 --- a/ecl/eclagent/eclagent.cpp +++ b/ecl/eclagent/eclagent.cpp @@ -3613,7 +3613,7 @@ extern int HTHOR_API eclagent_main(int argc, const char *argv[], OwnedqueryProp(key); + const char *val = it->queryPropValue(); if (val[0]=='<') { Owned valtree = createPTreeFromXMLString(val); diff --git a/esp/bindings/SOAP/Platform/soapmessage.cpp b/esp/bindings/SOAP/Platform/soapmessage.cpp index afbff7d681b..89768ab5c2e 100644 --- a/esp/bindings/SOAP/Platform/soapmessage.cpp +++ b/esp/bindings/SOAP/Platform/soapmessage.cpp @@ -33,7 +33,7 @@ static void serializeAttributes(StringBuffer& outbuf, IProperties* attrs) for (it->first(); it->isValid(); it->next()) { const char* k = it->getPropKey(); - const char* v = attrs->queryProp(k); + const char* v = it->queryPropValue(); outbuf.append(' ').append(k).append("=\""); encodeUtf8XML(v,outbuf); outbuf.append('"'); @@ -171,7 +171,8 @@ void CRpcMessage::add_attr(const char * path, const char * name, const char * va for (piter->first(); piter->isValid(); piter->next()) { const char *propkey = piter->getPropKey(); - par->add_attribute(propkey, attrs.queryProp(propkey)); + const char *value = piter->queryPropValue(); + par->add_attribute(propkey, value); } } } @@ -181,7 +182,8 @@ void CRpcMessage::add_attr(const char * path, const char * name, const char * va for (piter->first(); piter->isValid(); piter->next()) { const char *propkey = piter->getPropKey(); - add_attribute(propkey, attrs.queryProp(propkey)); + const char *value = piter->queryPropValue(); + add_attribute(propkey, value); } } } @@ -579,7 +581,7 @@ CSoapValue::CSoapValue(CSoapValue* soapvalue) m_attributes.setown(createProperties()); Owned it = attrs->getIterator(); for (it->first(); it->isValid(); it->next()) - m_attributes->setProp(it->getPropKey(), attrs->queryProp(it->getPropKey())); + m_attributes->setProp(it->getPropKey(), it->queryPropValue()); } m_is_array_element = soapvalue->m_is_array_element; } @@ -1171,7 +1173,7 @@ void CSoapValue::add_value(const char* path, const char* ns, const char* name, c for (piter->first(); piter->isValid(); piter->next()) { const char *propkey = piter->getPropKey(); - sv->add_attribute(propkey, attrs.queryProp(propkey)); + sv->add_attribute(propkey, piter->queryPropValue()); } } } diff --git a/esp/bindings/SOAP/Platform/soapparam.cpp b/esp/bindings/SOAP/Platform/soapparam.cpp index 7356b881291..6d01fa5c70a 100644 --- a/esp/bindings/SOAP/Platform/soapparam.cpp +++ b/esp/bindings/SOAP/Platform/soapparam.cpp @@ -576,7 +576,7 @@ bool EspBaseArrayParam::unmarshall(IEspContext* ctx, IProperties ¶ms, MapStr { if (strlen(keyname)==taglen || !strncmp(keyname+taglen, "_rd_", 4)) { - const char *finger = params.queryProp(iter->getPropKey()); + const char *finger = iter->queryPropValue(); StringBuffer itemval; while (*finger) { @@ -610,7 +610,7 @@ bool EspBaseArrayParam::unmarshall(IEspContext* ctx, IProperties ¶ms, MapStr } else if (strncmp(keyname+taglen, "_i", 2)==0) { - append(params.queryProp(iter->getPropKey())); + append(iter->queryPropValue()); hasValue = true; } } diff --git a/esp/bindings/SOAP/ws_ecl_client/ws_ecl_client_bind.hpp b/esp/bindings/SOAP/ws_ecl_client/ws_ecl_client_bind.hpp index 8f7d73bdcd5..0c67715f61a 100644 --- a/esp/bindings/SOAP/ws_ecl_client/ws_ecl_client_bind.hpp +++ b/esp/bindings/SOAP/ws_ecl_client/ws_ecl_client_bind.hpp @@ -344,7 +344,7 @@ class CClientRequestNode : implements IClientRequestNode, public CInterface ForEach(*piter) { const char *propkey = piter->getPropKey(); - rpcMsg.add_value(path, "", propkey, "", m_params->queryProp(propkey), false); + rpcMsg.add_value(path, "", propkey, "", piter->queryPropValue(), false); } } diff --git a/esp/bindings/http/client/httpclient.cpp b/esp/bindings/http/client/httpclient.cpp index 6f9968ea850..922b4c8d1eb 100644 --- a/esp/bindings/http/client/httpclient.cpp +++ b/esp/bindings/http/client/httpclient.cpp @@ -685,7 +685,7 @@ IHttpMessage *CHttpClient::sendRequestEx(const char* method, const char* content { if (strieq(key, HTTP_HEADER_CONTENT_ENCODING) || strieq(key, HTTP_HEADER_TRANSFER_ENCODING)) alreadyEncoded = true; - const char *value = headers->queryProp(key); + const char *value = iter->queryPropValue(); if (value && *value) httprequest->addHeader(key, value); } diff --git a/esp/esdllib/esdl_def.cpp b/esp/esdllib/esdl_def.cpp index 7325bcf9c8d..dce6db127f8 100644 --- a/esp/esdllib/esdl_def.cpp +++ b/esp/esdllib/esdl_def.cpp @@ -201,7 +201,7 @@ class EsdlDefObject : public CInterface ForEach(*it) { const char *name = it->getPropKey(); - const char *val = props->queryProp(name); + const char *val = it->queryPropValue(); xml.appendf(" %s=\"", name); encodeUtf8XML(val, xml); xml.append('\"'); diff --git a/esp/esdllib/esdl_def_helper.cpp b/esp/esdllib/esdl_def_helper.cpp index 01355a41818..93075e575dc 100644 --- a/esp/esdllib/esdl_def_helper.cpp +++ b/esp/esdllib/esdl_def_helper.cpp @@ -346,7 +346,7 @@ void EsdlDefinitionHelper::loadTransformParams( EsdlXslTypeId xslId, IProperties const char *key = it->getPropKey(); //set parameter in the XSL transform skipping over the @ prefix, if any const char* paramName = *key == '@' ? key+1 : key; - trans->setParameter(paramName, params->queryProp(key)); + trans->setParameter(paramName, it->queryPropValue()); } } @@ -360,7 +360,7 @@ void EsdlDefinitionHelper::loadTransformParams( EsdlXslTypeId xslId, IProperties const char *key = it->getPropKey(); //set parameter in the XSL transform skipping over the @ prefix, if any const char* paramName = *key == '@' ? key+1 : key; - trans->setParameter(paramName, overrideParams->queryProp(key)); + trans->setParameter(paramName, it->queryPropValue()); } } } diff --git a/esp/esdllib/esdl_transformer2.cpp b/esp/esdllib/esdl_transformer2.cpp index 744b7863a96..868321188da 100644 --- a/esp/esdllib/esdl_transformer2.cpp +++ b/esp/esdllib/esdl_transformer2.cpp @@ -224,7 +224,7 @@ void Esdl2Base::serialize_attributes(StringBuffer &out) { if (stricmp(key, "base_type") != 0) { - const char *value = m_def->queryProp(key); + const char *value = piter->queryPropValue(); if (value && *value) out.appendf(" %s=\"%s\"", key, value); } @@ -1311,7 +1311,7 @@ void Esdl2Request::addDefaults(IPropertyTree *req) const char *path = iter->getPropKey(); if (!req->hasProp(path)) { - const char *value = defvals->queryProp(path); + const char *value = iter->queryPropValue(); ensurePTree(req, path); req->setProp(path, value); } diff --git a/esp/esdlscriptlib/esdl_script.cpp b/esp/esdlscriptlib/esdl_script.cpp index 979982bcfba..4c4c24b7f5c 100644 --- a/esp/esdlscriptlib/esdl_script.cpp +++ b/esp/esdlscriptlib/esdl_script.cpp @@ -3479,8 +3479,8 @@ class CEsdlCustomTransform : public CInterfaceOf const char *prefix = ns->getPropKey(); const char *existing = sourceContext->queryNamespace(prefix); savedNamespaces->setProp(prefix, isEmptyString(existing) ? "" : existing); - sourceContext->registerNamespace(prefix, namespaces->queryProp(prefix)); - targetXpath->registerNamespace(prefix, namespaces->queryProp(prefix)); + sourceContext->registerNamespace(prefix, ns->queryPropValue()); + targetXpath->registerNamespace(prefix, ns->queryPropValue()); } CXpathContextScope scope(sourceContext, "transform", XpathVariableScopeType::simple, savedNamespaces); if (!isEmptyString(target) && !streq(target, ".")) @@ -3607,7 +3607,7 @@ void processServiceAndMethodTransforms(IEsdlScriptContext * scriptCtx, std::init { const char *name = userPropIt->getPropKey(); if (name && *name) - sourceContext->addInputValue(name, user->getProperty(name)); + sourceContext->addInputValue(name, userPropIt->queryPropValue()); } auto it = statusLabels.find(user->getStatus()); diff --git a/esp/platform/espcontext.cpp b/esp/platform/espcontext.cpp index f860f96bde8..7cb4094b855 100755 --- a/esp/platform/espcontext.cpp +++ b/esp/platform/espcontext.cpp @@ -795,7 +795,7 @@ bool getUrlParams(IProperties *props, StringBuffer& params) params.append(key); if (stricmp(key,"ver_")==0) hasVersion = true; - const char* v = props->queryProp(key); + const char* v = it->queryPropValue(); if (v && *v) params.appendf("=%s",v); } diff --git a/esp/services/WsDeploy/WsDeployService.cpp b/esp/services/WsDeploy/WsDeployService.cpp index 6d9a52637af..3268d6d635e 100644 --- a/esp/services/WsDeploy/WsDeployService.cpp +++ b/esp/services/WsDeploy/WsDeployService.cpp @@ -6405,7 +6405,7 @@ void CWsDeployFileInfo::initFileInfo(bool createOrOverwrite, bool bClearEnv) { StringBuffer prop; pParams->getProp(iter->getPropKey(), prop); - const char* val = pSettings->queryProp(iter->getPropKey()); + const char* val = iter->queryPropValue(); if (!val || strcmp(val, prop.str())) { diff --git a/esp/services/ws_ecl/ws_ecl_service.cpp b/esp/services/ws_ecl/ws_ecl_service.cpp index 7969b4ccf61..a444ce2d13c 100644 --- a/esp/services/ws_ecl/ws_ecl_service.cpp +++ b/esp/services/ws_ecl/ws_ecl_service.cpp @@ -595,7 +595,7 @@ void CWsEclBinding::xsltTransform(const char* xml, unsigned int len, const char* const char *key = it->getPropKey(); //set parameter in the XSL transform skipping over the @ prefix, if any const char* paramName = *key == '@' ? key+1 : key; - trans->setParameter(paramName, StringBuffer().append('\'').append(params->queryProp(key)).append('\'').str()); + trans->setParameter(paramName, StringBuffer().append('\'').append(it->queryPropValue()).append('\'').str()); } } diff --git a/esp/services/ws_esdlconfig/ws_esdlconfigservice.cpp b/esp/services/ws_esdlconfig/ws_esdlconfigservice.cpp index d4ec4c0432d..da81cfc31a4 100644 --- a/esp/services/ws_esdlconfig/ws_esdlconfigservice.cpp +++ b/esp/services/ws_esdlconfig/ws_esdlconfigservice.cpp @@ -265,7 +265,7 @@ void CWsESDLConfigEx::wrapWithDefinitionElement(IEsdlDefinitionInfo* defInfo, St ForEach(*iter) { const char* name = iter->getPropKey(); - const char* val = metadata.queryProp(name); + const char* val = iter->queryPropValue(); // skip the leading @ in the property name definitionElement.appendf(" %s=\"%s\"", &name[1], val); } diff --git a/esp/services/ws_fs/ws_fsBinding.cpp b/esp/services/ws_fs/ws_fsBinding.cpp index 6693bd96cf6..fb5ed95c7df 100644 --- a/esp/services/ws_fs/ws_fsBinding.cpp +++ b/esp/services/ws_fs/ws_fsBinding.cpp @@ -378,7 +378,7 @@ void CFileSpraySoapBindingEx::xsltTransform(const char* xml, const char* sheet, const char *key = it->getPropKey(); //set parameter in the XSL transform skipping over the @ prefix, if any const char* paramName = *key == '@' ? key+1 : key; - trans->setParameter(paramName, StringBuffer().append('\'').append(params->queryProp(key)).append('\'').str()); + trans->setParameter(paramName, StringBuffer().append('\'').append(it->queryPropValue()).append('\'').str()); } } diff --git a/esp/services/ws_workunits/ws_wuresult.cpp b/esp/services/ws_workunits/ws_wuresult.cpp index a4ab8e5204d..314ce18e34e 100644 --- a/esp/services/ws_workunits/ws_wuresult.cpp +++ b/esp/services/ws_workunits/ws_wuresult.cpp @@ -223,7 +223,7 @@ void CWsWuResultOutHelper::readFilterByReq() ForEach(*iter) { const char* keyname = iter->getPropKey(); - const char* keyValue = reqParams->queryProp(iter->getPropKey()); + const char* keyValue = iter->queryPropValue(); if (isEmptyString(keyname) || isEmptyString(keyValue) || strncmp(keyname, "FilterBys", 9)) continue; diff --git a/system/jlib/jprop.cpp b/system/jlib/jprop.cpp index 2ff7b961b75..339f3dc3119 100644 --- a/system/jlib/jprop.cpp +++ b/system/jlib/jprop.cpp @@ -35,35 +35,32 @@ template class PropertyIteratorOf : implements PITER, public CInterface { protected: - HashIterator *piter; const HashTable &properties; + HashIterator piter; public: IMPLEMENT_IINTERFACE; - PropertyIteratorOf(const HashTable &_properties) : properties(_properties) + PropertyIteratorOf(const HashTable &_properties) : properties(_properties), piter(properties) { properties.Link(); - piter = new HashIterator(properties); } ~PropertyIteratorOf() { properties.Release(); - piter->Release(); } - virtual bool first() + virtual bool first() override { - return piter->first(); + return piter.first(); } - virtual bool next() + virtual bool next() override { - return piter->next(); + return piter.next(); } - virtual bool isValid() + virtual bool isValid() override { - return piter->isValid(); + return piter.isValid(); } - virtual PTYPE getPropKey() = 0; }; typedef IPropertyIterator char_ptrIPropertyIterator; @@ -71,12 +68,17 @@ class char_ptrPropertyIterator : public PropertyIteratorOf(_properties) { } - virtual const char *getPropKey() + virtual const char *getPropKey() const override { - IMapping &cur = piter->query(); + IMapping &cur = piter.query(); const char *key = (const char *) (cur.getKey()); return key; } + virtual const char *queryPropValue() const override + { + IMapping &cur = piter.query(); + return StringAttrMapping::mapToValue(&cur)->str(); + } }; template diff --git a/system/jlib/jprop.hpp b/system/jlib/jprop.hpp index fdbb24e9ee3..a54d266355b 100644 --- a/system/jlib/jprop.hpp +++ b/system/jlib/jprop.hpp @@ -32,7 +32,8 @@ interface jlib_decl IPropertyIteratorOf : extends IInterface virtual bool first() = 0; virtual bool next() = 0; virtual bool isValid() = 0; - virtual PTYPE getPropKey() = 0; + virtual PTYPE getPropKey() const = 0; + virtual const char * queryPropValue() const = 0; }; template @@ -64,7 +65,6 @@ interface jlib_decl IPropertiesOf : extends serializable #endif interface IPropertyIterator : public IPropertyIteratorOf { }; -interface IAtomPropertyIterator : public IPropertyIteratorOf { }; interface IProperties : public IPropertiesOf { }; #ifdef _MSC_VER diff --git a/system/jlib/jptree.cpp b/system/jlib/jptree.cpp index 4b314e3f5b3..82ee2685da5 100644 --- a/system/jlib/jptree.cpp +++ b/system/jlib/jptree.cpp @@ -8302,7 +8302,7 @@ IPropertyTree *createPTreeFromHttpParameters(const char *nameWithAttrs, IPropert continue; if (skipLeadingDotParameters && key.charAt(0)=='.') continue; - const char *value = parameters->queryProp(key); + const char *value = iter->queryPropValue(); if (!value || !*value) continue; ensureHttpParameter(content, key, value); @@ -8525,10 +8525,9 @@ void applyProperties(IPropertyTree * target, const IProperties * source) Owned iter = source->getIterator(); ForEach(*iter) { - StringBuffer value; const char * name = iter->getPropKey(); - source->getProp(name, value); - target->setProp(name, value.str()); + const char * value = iter->queryPropValue(); + target->setProp(name, value); } } diff --git a/system/jlib/jsuperhash.hpp b/system/jlib/jsuperhash.hpp index 9936e86112f..8806ad52993 100644 --- a/system/jlib/jsuperhash.hpp +++ b/system/jlib/jsuperhash.hpp @@ -229,7 +229,7 @@ class jlib_decl SuperHashIterator : public CInterface { if (cur) cur = table.next(cur); return (cur != NULL); } protected: - void * queryPointer() { assertex(cur); return cur; } + void * queryPointer() const { assertex(cur); return cur; } private: bool linkTable; @@ -242,7 +242,7 @@ class SuperHashIteratorOf : public SuperHashIterator { public: SuperHashIteratorOf(const SuperHashTable & _table, bool linkTable=true) : SuperHashIterator(_table, linkTable) {} - ET & query() + ET & query() const { return *(static_cast(queryPointer())); } }; diff --git a/system/jlib/jtrace.cpp b/system/jlib/jtrace.cpp index b45b67aed8e..c5828eb1531 100644 --- a/system/jlib/jtrace.cpp +++ b/system/jlib/jtrace.cpp @@ -60,7 +60,7 @@ class CHPCCHttpTextMapCarrier : public opentelemetry::context::propagation::Text ForEach(*iter) { const char * key = iter->getPropKey(); - const char * val = httpHeaders->queryProp(key); + const char * val = iter->queryPropValue(); this->httpHeaders->setProp(key, val); } } @@ -182,8 +182,7 @@ class CSpan : public CInterfaceOf ForEach(*iter) { const char * key = iter->getPropKey(); - if (!isEmptyString(key)) - setSpanAttribute(key, attributes->queryProp(key)); + setSpanAttribute(key, iter->queryPropValue()); } }