libcamera: yaml_parser: Remove memberNames() function

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>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Han-Lin Chen <hanlinchen@chromium.org>
This commit is contained in:
Laurent Pinchart 2022-05-25 01:58:12 +03:00
parent 12bf404147
commit 9dacead615
3 changed files with 0 additions and 33 deletions

View file

@ -172,7 +172,6 @@ public:
bool contains(const std::string &key) const; bool contains(const std::string &key) const;
const YamlObject &operator[](const std::string &key) const; const YamlObject &operator[](const std::string &key) const;
std::vector<std::string> memberNames() const;
private: private:
LIBCAMERA_DISABLE_COPY_AND_MOVE(YamlObject) LIBCAMERA_DISABLE_COPY_AND_MOVE(YamlObject)

View file

@ -335,28 +335,6 @@ bool YamlObject::contains(const std::string &key) const
return true; 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 * \fn YamlObject::operator[](const std::string &key) const
* \brief Retrieve a member by name from the dictionary * \brief Retrieve a member by name from the dictionary

View file

@ -500,16 +500,6 @@ protected:
/* Make sure utils::map_keys() works on the adapter. */ /* Make sure utils::map_keys() works on the adapter. */
(void)utils::map_keys(dictObj.asDict()); (void)utils::map_keys(dictObj.asDict());
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 */ /* Test leveled objects */
auto &level1Obj = (*root)["level1"]; auto &level1Obj = (*root)["level1"];