-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18727 from kenrowland/HPCC-31548
HPCC-31548 Improve qualifyMethodName in HIDL generated code for ESP services Reviewed-By: Terrence Asselin <[email protected]> Reviewed-by: Gavin Halliday <[email protected]> Merged-by: Gavin Halliday <[email protected]>
- Loading branch information
Showing
5 changed files
with
120 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/*############################################################################## | ||
HPCC SYSTEMS software Copyright (C) 2024 HPCC Systems®. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
############################################################################## */ | ||
|
||
#pragma warning( disable : 4786 ) | ||
|
||
#include "soaphidlbind.hpp" | ||
|
||
void CHttpSoapHidlBinding::registerMethodNames(std::initializer_list<const char *> names) | ||
{ | ||
for (const char *name : names) | ||
{ | ||
std::string methodNameKey(name); | ||
std::transform(methodNameKey.cbegin(), methodNameKey.cend(), methodNameKey.begin(), | ||
[](unsigned char c){ return std::tolower(c); }); | ||
m_qualifiedMethodNames.emplace(methodNameKey.c_str(), name); | ||
} | ||
} | ||
|
||
bool CHttpSoapHidlBinding::qualifyMethodName(IEspContext &context, const char *methname, StringBuffer *methQName) | ||
{ | ||
if (!methname || !*methname) | ||
{ | ||
if (methQName != nullptr) | ||
methQName->clear(); | ||
return true; | ||
} | ||
std::string methodName(methname); | ||
std::transform(methodName.cbegin(), methodName.cend(), methodName.begin(), | ||
[](unsigned char c){ return std::tolower(c); }); | ||
auto it = m_qualifiedMethodNames.find(methodName); | ||
if (it != m_qualifiedMethodNames.end()) | ||
{ | ||
if (methQName != nullptr) | ||
methQName->set(it->second.c_str()); | ||
return true; | ||
} | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/*############################################################################## | ||
HPCC SYSTEMS software Copyright (C) 2024 HPCC Systems®. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
############################################################################## */ | ||
|
||
#ifndef _SOAPHIDLBIND_HPP__ | ||
#define _SOAPHIDLBIND_HPP__ | ||
|
||
#include "soapbind.hpp" | ||
#include <algorithm> | ||
|
||
class esp_http_decl CHttpSoapHidlBinding : public CHttpSoapBinding | ||
{ | ||
public: | ||
CHttpSoapHidlBinding(IPropertyTree* cfg, const char *bindname=NULL, const char *procname=NULL, http_soap_log_level level=hsl_none) : | ||
CHttpSoapBinding(cfg, bindname, procname, level) {} | ||
virtual bool qualifyMethodName(IEspContext &context, const char *methname, StringBuffer *methQName); | ||
|
||
protected: | ||
virtual void registerMethodNames(std::initializer_list<const char *> names); | ||
|
||
private: | ||
std::map<std::string, std::string> m_qualifiedMethodNames; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters