You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@celix.apache.org by GitBox <gi...@apache.org> on 2021/03/03 12:44:03 UTC

[GitHub] [celix] pnoltes commented on a change in pull request #324: Feature/gcc 4 9 0 fixes

pnoltes commented on a change in pull request #324:
URL: https://github.com/apache/celix/pull/324#discussion_r586385635



##########
File path: libs/framework/include/celix/Properties.h
##########
@@ -253,6 +259,38 @@ namespace celix {
         std::size_t size() const {
             return celix_properties_size(cProps.get());
         }
+
+        /**
+         * @brief Converts the properties a (new) std::string, std::string map.
+         */
+        std::map<std::string, std::string> convertToMap() const {
+            std::map<std::string, std::string> result{};
+            for (const auto& pair : *this) {
+                result[pair.first] = pair.second;
+            }
+            return result;
+        }
+
+        /**
+         * @brief Converts the properties a (new) std::string, std::string unordered map.
+         */
+        std::unordered_map<std::string, std::string> convertToUnorderedMap() const {
+            std::unordered_map<std::string, std::string> result{};
+            for (const auto& pair : *this) {
+                result[pair.first] = pair.second;
+            }
+            return result;
+        }
+
+        /**
+         * @brief cast the celix::Properties to a std::string, std::string map.
+         * @warning This method is added to ensure backwards compatibility with the celix::dm::Properties, but the
+         * use of this cast should be avoided.
+         * This method will eventually be removed.
+         */
+        operator std::map<std::string, std::string>() const {

Review comment:
       Agree. I added a define for this.
   
   We can enable this - for now - downstream and eventually remove this.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org