/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Cynara {
-const std::string PolicyKeyFeature::m_wildcardValue = CYNARA_ADMIN_WILDCARD;
-const std::string PolicyKeyFeature::m_anyValue = CYNARA_ADMIN_ANY;
+const std::string &PolicyKeyFeature::wildcardValue(void) {
+ static const std::string value(CYNARA_ADMIN_WILDCARD);
+ return value;
+}
+
+const std::string &PolicyKeyFeature::anyValue(void) {
+ static const std::string value(CYNARA_ADMIN_ANY);
+ return value;
+}
const std::string &PolicyKeyFeature::toString(void) const {
return value();
}
static PolicyKeyFeature createWildcard(void) {
- return PolicyKeyFeature(m_wildcardValue);
+ return PolicyKeyFeature(wildcardValue());
}
static PolicyKeyFeature createAny(void) {
- return PolicyKeyFeature(m_anyValue);
+ return PolicyKeyFeature(anyValue());
}
// TODO: Different features (client, user, privilege)
protected:
explicit PolicyKeyFeature(const ValueType &value) : m_value(value),
- m_isWildcard(value == PolicyKeyFeature::m_wildcardValue),
- m_isAny(value == PolicyKeyFeature::m_anyValue) {}
+ m_isWildcard(value == wildcardValue()),
+ m_isAny(value == anyValue()) {}
static bool anyAny(const PolicyKeyFeature &pkf1, const PolicyKeyFeature &pkf2) {
return pkf1.isAny() || pkf2.isAny();
bool m_isWildcard;
bool m_isAny;
- const static std::string m_wildcardValue;
- const static std::string m_anyValue;
+ const static std::string &wildcardValue(void);
+ const static std::string &anyValue(void);
};
class PolicyKey