[libcamera-devel,RFC,08/12] libcamera: yaml_parser: Remove memberNames() function
diff mbox series

Message ID 20220524225816.6830-9-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • Replace boost JSON parser with libyaml in Raspberry Pi IPA
Related show

Commit Message

Laurent Pinchart May 24, 2022, 10:58 p.m. UTC
Now that YamlObject supports iteration, the memberNames() function isn't
useful anymore as it can be implemented using utils::map_keys() if
really needed. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/libcamera/internal/yaml_parser.h |  1 -
 src/libcamera/yaml_parser.cpp            | 22 ----------------------
 test/yaml-parser.cpp                     | 10 ----------
 3 files changed, 33 deletions(-)

Patch
diff mbox series

diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h
index 22ed87efdf8f..79537ff2ea7c 100644
--- a/include/libcamera/internal/yaml_parser.h
+++ b/include/libcamera/internal/yaml_parser.h
@@ -170,7 +170,6 @@  public:
 
 	bool contains(const std::string &key) const;
 	const YamlObject &operator[](const std::string &key) const;
-	std::vector<std::string> memberNames() const;
 
 private:
 	LIBCAMERA_DISABLE_COPY_AND_MOVE(YamlObject)
diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp
index a156df36e222..65b9a9097375 100644
--- a/src/libcamera/yaml_parser.cpp
+++ b/src/libcamera/yaml_parser.cpp
@@ -333,28 +333,6 @@  bool YamlObject::contains(const std::string &key) const
 	return true;
 }
 
-/**
- * \fn YamlObject::memberNames()
- * \brief Retrieve all member names of the dictionary
- *
- * This function retrieve member names of a YamlObject. Only YamlObject
- * instances of Dictionary type associate elements with names, calling this
- * function on other types of instances is invalid and results in undefined
- * behaviour.
- *
- * \todo Replace this function with an iterator-based API
- *
- * \return A vector of string as the member names
- */
-std::vector<std::string> YamlObject::memberNames() const
-{
-	std::vector<std::string> memberNames;
-	for (auto &[key, _] : dictionary_)
-		memberNames.push_back(key);
-
-	return memberNames;
-}
-
 /**
  * \fn YamlObject::operator[](const std::string &key) const
  * \brief Retrieve a member by name from the dictionary
diff --git a/test/yaml-parser.cpp b/test/yaml-parser.cpp
index 7ad9936bb82b..3662e7144dfd 100644
--- a/test/yaml-parser.cpp
+++ b/test/yaml-parser.cpp
@@ -488,16 +488,6 @@  protected:
 			i++;
 		}
 
-		auto memeberNames = dictObj.memberNames();
-		sort(memeberNames.begin(), memeberNames.end());
-
-		if (memeberNames[0] != "a" ||
-		    memeberNames[1] != "b" ||
-		    memeberNames[2] != "c") {
-			cerr << "Dictionary object fail to parse member names" << std::endl;
-			return TestFail;
-		}
-
 		/* Test leveled objects */
 		auto &level1Obj = (*root)["level1"];