summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Szyndela <adrian.s@samsung.com>2020-10-28 09:02:06 +0100
committerAdrian Szyndela <adrian.s@samsung.com>2020-10-30 12:37:28 +0100
commitf17b5679dc5c6f44c87938430daccfa2eae67cac (patch)
treecd9f23077ed10a0f774eebe47d2d22f876e37118
parent861655ed3072bb21cdc2111baddd63845f7a2cd0 (diff)
downloadlibdbuspolicy-f17b5679dc5c6f44c87938430daccfa2eae67cac.tar.gz
libdbuspolicy-f17b5679dc5c6f44c87938430daccfa2eae67cac.tar.bz2
libdbuspolicy-f17b5679dc5c6f44c87938430daccfa2eae67cac.zip
refactoring: move makeDecisionItem, and use new interface
Change-Id: Ibb64103c318ff1cf404dd23bdf837c28da06a120
-rw-r--r--src/internal/serialized_convert.hpp5
-rw-r--r--src/internal/storage_backend_flatbuffers.cpp5
-rw-r--r--src/internal/storage_backend_flatbuffers.hpp2
3 files changed, 7 insertions, 5 deletions
diff --git a/src/internal/serialized_convert.hpp b/src/internal/serialized_convert.hpp
index de00f2f..5d0b8af 100644
--- a/src/internal/serialized_convert.hpp
+++ b/src/internal/serialized_convert.hpp
@@ -24,11 +24,6 @@ ldp_xml_parser::Decision makeDecision(D d) {
return static_cast<ldp_xml_parser::Decision>(d);
}
-template <typename DI>
-inline ldp_xml_parser::DecisionItem makeDecisionItem(const DI *di) {
- return ldp_xml_parser::DecisionItem(makeDecision(di->decision()), di->privilege()->c_str());
-}
-
template <typename T>
ldp_xml_parser::BusAccessType makeBusAccessType(T type) {
return static_cast<ldp_xml_parser::BusAccessType>(type);
diff --git a/src/internal/storage_backend_flatbuffers.cpp b/src/internal/storage_backend_flatbuffers.cpp
index 1b0b84e..6aedb60 100644
--- a/src/internal/storage_backend_flatbuffers.cpp
+++ b/src/internal/storage_backend_flatbuffers.cpp
@@ -35,6 +35,11 @@ const unsigned int FB_ID_SIZE = 4;
template <typename T>
struct type_helper;
+ldp_xml_parser::DecisionItem StorageBackendFlatbuffers::makeDecisionItem(const DecisionItem *item) const {
+ return ldp_xml_parser::DecisionItem(makeDecision(decisionItemGetDecision(item)),
+ stringGetCStr(decisionItemGetPrivilege(item)));
+}
+
boost::string_ref StorageBackendFlatbuffers::toStringRef(const flatbuffers::String *str) const {
return boost::string_ref(str->c_str(), str->size());
}
diff --git a/src/internal/storage_backend_flatbuffers.hpp b/src/internal/storage_backend_flatbuffers.hpp
index f5181ff..f831282 100644
--- a/src/internal/storage_backend_flatbuffers.hpp
+++ b/src/internal/storage_backend_flatbuffers.hpp
@@ -230,6 +230,8 @@ private:
bool match(const ldp_xml_parser::MatchItemAccess &match, const FB::ItemAccess *item) const;
+ ldp_xml_parser::DecisionItem makeDecisionItem(const FB::DecisionItem *item) const;
+
boost::string_ref toStringRef(const flatbuffers::String *str) const;
};