Added nodiscard

This commit is contained in:
Robert 2021-04-18 15:44:48 +02:00
parent d8c11c48c9
commit 87046f5d18
6 changed files with 99 additions and 260 deletions

View file

@ -22,12 +22,12 @@ namespace osmp
IMember(const IMember& other) = delete;
virtual ~IMember() {}
IMember::Type GetType() const;
[[nodiscard]] IMember::Type GetType() const;
const std::vector<Tag>& GetTags() const;
size_t GetTagsSize() const;
const Tag& GetTag(size_t index) const;
std::string GetTag(const std::string& key) const;
[[nodiscard]] const std::vector<Tag>& GetTags() const;
[[nodiscard]] size_t GetTagsSize() const;
[[nodiscard]] const Tag& GetTag(size_t index) const;
[[nodiscard]] std::string GetTag(const std::string& key) const;
protected:
IMember(const tinyxml2::XMLElement* element, Object* parent, IMember::Type type);

View file

@ -15,20 +15,20 @@ namespace osmp
class Object
{
public:
Object(const std::string& file);
explicit Object(const std::string& file);
~Object();
std::vector<std::shared_ptr<Node>> GetNodes() const;
size_t GetNodesSize() const;
std::shared_ptr<Node> GetNode(uint64_t id) const;
[[nodiscard]] std::vector<std::shared_ptr<Node>> GetNodes() const;
[[nodiscard]] size_t GetNodesSize() const;
[[nodiscard]] std::shared_ptr<Node> GetNode(uint64_t id) const;
std::vector<std::shared_ptr<Way>> GetWays() const;
size_t GetWaysSize() const;
std::shared_ptr<Way> GetWay(uint64_t id) const;
[[nodiscard]] std::vector<std::shared_ptr<Way>> GetWays() const;
[[nodiscard]] size_t GetWaysSize() const;
[[nodiscard]] std::shared_ptr<Way> GetWay(uint64_t id) const;
std::vector<std::shared_ptr<Relation>> GetRelations() const;
size_t GetRelationsSize() const;
std::shared_ptr<Relation> GetRelation(uint64_t id) const;
[[nodiscard]] std::vector<std::shared_ptr<Relation>> GetRelations() const;
[[nodiscard]] size_t GetRelationsSize() const;
[[nodiscard]] std::shared_ptr<Relation> GetRelation(uint64_t id) const;
public:
const std::string version;

View file

@ -21,17 +21,17 @@ namespace osmp
public:
Relation(const tinyxml2::XMLElement* xml, Object* parent);
std::string GetRelationType();
[[nodiscard]] std::string GetRelationType();
const std::vector<Member>& GetNodes() const;
size_t GetNodesSize() const;
const Member& GetNode(size_t index) const;
[[nodiscard]] const std::vector<Member>& GetNodes() const;
[[nodiscard]] size_t GetNodesSize() const;
[[nodiscard]] const Member& GetNode(size_t index) const;
const std::vector<Member>& GetWays() const;
size_t GetWaysSize() const;
const Member& GetWay(size_t index) const;
[[nodiscard]] const std::vector<Member>& GetWays() const;
[[nodiscard]] size_t GetWaysSize() const;
[[nodiscard]] const Member& GetWay(size_t index) const;
bool HasNullMembers() const { return hasNullMembers; }
[[nodiscard]] bool HasNullMembers() const { return hasNullMembers; }
private:
std::string relationType;

View file

@ -16,9 +16,9 @@ namespace osmp
public:
Way(const tinyxml2::XMLElement* way_elem, Object* parent);
const std::vector<std::shared_ptr<Node>>& GetNodes() const;
size_t GetNodesSize() const;
const std::shared_ptr<Node>& GetNode(size_t index) const;
[[nodiscard]] const std::vector<std::shared_ptr<Node>>& GetNodes() const;
[[nodiscard]] size_t GetNodesSize() const;
[[nodiscard]] const std::shared_ptr<Node>& GetNode(size_t index) const;
public:
bool area, closed; // Closed := Startpoint = endpoint, Area := Closed AND certain conditions are not met

View file

@ -14,8 +14,8 @@ namespace osmp
double minlat, minlon, maxlat, maxlon;
} Bounds;
std::string GetSafeAttributeString(const tinyxml2::XMLElement* elem, const std::string& name);
double GetSafeAttributeFloat(const tinyxml2::XMLElement* elem, const std::string& name);
uint64_t GetSafeAttributeUint64(const tinyxml2::XMLElement* elem, const std::string& name);
bool GetSafeAttributeBool(const tinyxml2::XMLElement* elem, const std::string& name);
[[nodiscard]] std::string GetSafeAttributeString(const tinyxml2::XMLElement* elem, const std::string& name);
[[nodiscard]] double GetSafeAttributeFloat(const tinyxml2::XMLElement* elem, const std::string& name);
[[nodiscard]] uint64_t GetSafeAttributeUint64(const tinyxml2::XMLElement* elem, const std::string& name);
[[nodiscard]] bool GetSafeAttributeBool(const tinyxml2::XMLElement* elem, const std::string& name);
}