.. _program_listing_file_src_rdf4cpp_IRIFactory.hpp: Program Listing for File IRIFactory.hpp ======================================= |exhale_lsh| :ref:`Return to documentation for file ` (``src/rdf4cpp/IRIFactory.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef RDF4CPP_IRIFACTORY_HPP #define RDF4CPP_IRIFACTORY_HPP #include #include #include #include #include #include namespace rdf4cpp { struct IRIFactory { using prefix_map_type = boost::container::flat_map>; private: prefix_map_type prefixes; std::string base; IRIView::AllParts base_parts_cache; public: constexpr static std::string_view default_base = "http://example.org/"; explicit IRIFactory(std::string_view base = default_base); explicit IRIFactory(prefix_map_type &&prefixes, std::string_view base = default_base); IRIFactory(IRIFactory &&) noexcept = default; IRIFactory &operator=(IRIFactory &&) noexcept = default; // provide only const iterators to ensure that no key/values will be changed using const_iterator = prefix_map_type::const_iterator; using const_reverse_iterator = prefix_map_type::const_reverse_iterator; [[nodiscard]] const_iterator begin() const noexcept { return prefixes.begin(); } [[nodiscard]] const_iterator end() const noexcept { return prefixes.end(); } [[nodiscard]] const_reverse_iterator rbegin() const noexcept { return prefixes.rbegin(); } [[nodiscard]] const_reverse_iterator rend() const noexcept { return prefixes.rend(); } [[nodiscard]] nonstd::expected from_relative(std::string_view rel, storage::DynNodeStoragePtr node_storage = storage::default_node_storage) const noexcept; [[nodiscard]] nonstd::expected from_maybe_relative(std::string_view rel, storage::DynNodeStoragePtr node_storage = storage::default_node_storage) const noexcept; [[nodiscard]] nonstd::expected from_prefix(std::string_view prefix, std::string_view local, storage::DynNodeStoragePtr node_storage = storage::default_node_storage) const; [[nodiscard]] IRIFactoryError assign_prefix(std::string_view prefix, std::string_view expanded); void assign_prefix_unchecked(std::string_view prefix, std::string_view expanded); void clear_prefix(std::string_view prefix); [[nodiscard]] std::string_view get_base() const noexcept; [[nodiscard]] IRIFactoryError set_base(std::string_view b) noexcept; void set_base_unchecked(std::string_view b) noexcept; [[nodiscard]] static nonstd::expected create_and_validate(std::string_view iri, storage::DynNodeStoragePtr node_storage = storage::default_node_storage) noexcept; }; } // namespace rdf4cpp #endif //RDF4CPP_IRIFACTORY_HPP