[
https://issues.apache.org/jira/browse/GEODE-3288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16271106#comment-16271106
]
ASF GitHub Bot commented on GEODE-3288:
---------------------------------------
dgkimura commented on a change in pull request #160: GEODE-3288: Converts char*
to std::string on public API.
URL: https://github.com/apache/geode-native/pull/160#discussion_r153835744
##########
File path: cppcache/src/ExpirationAction.cpp
##########
@@ -17,33 +17,30 @@
#include <geode/ExpirationAction.hpp>
-#include <string>
-#include <ace/OS.h>
+namespace apache {
+namespace geode {
+namespace client {
-using namespace apache::geode::client;
+const std::string ExpirationAction::names[] = {"INVALIDATE",
"LOCAL_INVALIDATE",
+ "DESTROY", "LOCAL_DESTROY",
+ "INVALID_ACTION"};
-char* ExpirationAction::names[] = {(char*)"INVALIDATE",
- (char*)"LOCAL_INVALIDATE", (char*)"DESTROY",
- (char*)"LOCAL_DESTROY", (char*)nullptr};
-
-ExpirationAction::Action ExpirationAction::fromName(const char* name) {
- uint32_t i = 0;
- while ((names[i] != nullptr) || (i <= static_cast<uint32_t>(LOCAL_DESTROY)))
{
- if (name && names[i] && ACE_OS::strcasecmp(names[i], name) == 0) {
+ExpirationAction::Action ExpirationAction::fromName(const std::string& name) {
+ for (int i = INVALIDATE; i <= INVALID_ACTION; i++) {
+ if (names[i] == name) {
return static_cast<Action>(i);
}
- ++i;
}
return INVALID_ACTION;
}
-const char* ExpirationAction::fromOrdinal(const int ordinal) {
+const std::string& ExpirationAction::fromOrdinal(const int ordinal) {
if (INVALIDATE <= ordinal && ordinal <= LOCAL_DESTROY) {
return names[ordinal];
}
- return nullptr;
+ return names[INVALID_ACTION];
Review comment:
Same as other comment regarding enums
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Replace char* with std::string
> ------------------------------
>
> Key: GEODE-3288
> URL: https://issues.apache.org/jira/browse/GEODE-3288
> Project: Geode
> Issue Type: Improvement
> Components: native client
> Reporter: Ernest Burghardt
>
> In all public API headers
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)