diff --git a/include/docpp.hpp b/include/docpp.hpp index 6150885..87773f2 100644 --- a/include/docpp.hpp +++ b/include/docpp.hpp @@ -43,6 +43,11 @@ namespace docpp { std::pair property{}; protected: public: + /** + * @brief The npos value + */ + static const int npos = -1; + /** * @brief Construct a new HTMLProperty object * @param key The key of the property @@ -96,6 +101,11 @@ namespace docpp { std::vector properties{}; protected: public: + /** + * @brief The npos value + */ + static const int npos = -1; + /** * @brief Get the properties of the element * @return std::vector The properties of the element @@ -138,6 +148,11 @@ namespace docpp { HTMLElementProperties properties{}; protected: public: + /** + * @brief The npos value + */ + static const int npos = -1; + /** * @brief Construct a new HTMLElement object * @param tag The tag of the element @@ -189,6 +204,11 @@ namespace docpp { std::unordered_map sections{}; protected: public: + /** + * @brief The npos value + */ + static const int npos = -1; + /** * @brief Prepend an element to the section * @param element The element to add @@ -330,6 +350,11 @@ namespace docpp { HTMLSection document{}; protected: public: + /** + * @brief The npos value + */ + static const int npos = -1; + /** * @brief Get the document * @param std::string The type to return @@ -376,6 +401,11 @@ namespace docpp { std::pair property{}; protected: public: + /** + * @brief The npos value + */ + static const int npos = -1; + /** * @brief Construct a new CSSProperty object * @param key The key of the property @@ -432,6 +462,11 @@ namespace docpp { std::pair> element{}; protected: public: + /** + * @brief The npos value + */ + static const int npos = -1; + /** * @brief Construct a new CSSElement object * @param tag The tag of the element @@ -485,6 +520,11 @@ namespace docpp { std::vector elements{}; protected: public: + /** + * @brief The npos value + */ + static const int npos = -1; + /** * @brief Construct a new CSSStylesheet object * @param elements The elements to set diff --git a/src/docpp.cpp b/src/docpp.cpp index 452e1a4..23b7ef4 100644 --- a/src/docpp.cpp +++ b/src/docpp.cpp @@ -252,7 +252,7 @@ int docpp::HTML::HTMLSection::find(const HTMLElement& element) { } } - throw std::out_of_range("Element not found"); + return docpp::HTML::HTMLSection::npos; } int docpp::HTML::HTMLSection::find(const HTMLSection& section) { @@ -264,7 +264,7 @@ int docpp::HTML::HTMLSection::find(const HTMLSection& section) { } } - throw std::out_of_range("Section not found"); + return docpp::HTML::HTMLSection::npos; } int docpp::HTML::HTMLSection::size() const { @@ -504,7 +504,7 @@ int docpp::CSS::CSSStylesheet::find(const CSSElement& element) { } } - throw std::out_of_range("Element not found"); + return docpp::CSS::CSSStylesheet::npos; } int docpp::CSS::CSSStylesheet::size() const {