Add [[nodiscard]] attribute where meaningful
Mainly functions with zero side effects.
Change-Id: Ie812f9ad67bfd54f13aaae35932a6d00ca80cbd6
diff --git a/src/schema.hpp b/src/schema.hpp
index a1fd5b5..b103fd4 100644
--- a/src/schema.hpp
+++ b/src/schema.hpp
@@ -54,20 +54,20 @@
public:
virtual ~Schema();
- virtual yang::NodeTypes nodeType(const std::string& path) const = 0;
- virtual yang::NodeTypes nodeType(const schemaPath_& location, const ModuleNodePair& node) const = 0;
- virtual bool isModule(const std::string& name) const = 0;
- virtual bool listHasKey(const schemaPath_& listPath, const std::string& key) const = 0;
- virtual bool leafIsKey(const std::string& leafPath) const = 0;
- virtual bool isConfig(const std::string& path) const = 0;
- virtual std::optional<std::string> defaultValue(const std::string& leafPath) const = 0;
- virtual const std::set<std::string> listKeys(const schemaPath_& listPath) const = 0;
- virtual yang::TypeInfo leafType(const schemaPath_& location, const ModuleNodePair& node) const = 0;
- virtual yang::TypeInfo leafType(const std::string& path) const = 0;
- virtual std::optional<std::string> leafTypeName(const std::string& path) const = 0;
- virtual std::string leafrefPath(const std::string& leafrefPath) const = 0;
- virtual std::optional<std::string> description(const std::string& location) const = 0;
- virtual yang::Status status(const std::string& location) const = 0;
+ [[nodiscard]] virtual yang::NodeTypes nodeType(const std::string& path) const = 0;
+ [[nodiscard]] virtual yang::NodeTypes nodeType(const schemaPath_& location, const ModuleNodePair& node) const = 0;
+ [[nodiscard]] virtual bool isModule(const std::string& name) const = 0;
+ [[nodiscard]] virtual bool listHasKey(const schemaPath_& listPath, const std::string& key) const = 0;
+ [[nodiscard]] virtual bool leafIsKey(const std::string& leafPath) const = 0;
+ [[nodiscard]] virtual bool isConfig(const std::string& path) const = 0;
+ [[nodiscard]] virtual std::optional<std::string> defaultValue(const std::string& leafPath) const = 0;
+ [[nodiscard]] virtual const std::set<std::string> listKeys(const schemaPath_& listPath) const = 0;
+ [[nodiscard]] virtual yang::TypeInfo leafType(const schemaPath_& location, const ModuleNodePair& node) const = 0;
+ [[nodiscard]] virtual yang::TypeInfo leafType(const std::string& path) const = 0;
+ [[nodiscard]] virtual std::optional<std::string> leafTypeName(const std::string& path) const = 0;
+ [[nodiscard]] virtual std::string leafrefPath(const std::string& leafrefPath) const = 0;
+ [[nodiscard]] virtual std::optional<std::string> description(const std::string& location) const = 0;
+ [[nodiscard]] virtual yang::Status status(const std::string& location) const = 0;
- virtual std::set<ModuleNodePair> availableNodes(const boost::variant<dataPath_, schemaPath_, module_>& path, const Recursion recursion) const = 0;
+ [[nodiscard]] virtual std::set<ModuleNodePair> availableNodes(const boost::variant<dataPath_, schemaPath_, module_>& path, const Recursion recursion) const = 0;
};