.. _program_listing_file_src_rdf4cpp_query_Variable.hpp: Program Listing for File Variable.hpp ===================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/rdf4cpp/query/Variable.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef RDF4CPP_VARIABLE_HPP #define RDF4CPP_VARIABLE_HPP #include #include #include namespace rdf4cpp::query { struct Variable : Node { private: [[nodiscard]] static Variable find(std::string_view name, bool anonymous, storage::DynNodeStoragePtr node_storage) noexcept; public: Variable() noexcept; explicit Variable(storage::identifier::NodeBackendHandle handle) noexcept; explicit Variable(std::string_view name, bool anonymous = false, storage::DynNodeStoragePtr node_storage = storage::default_node_storage); [[nodiscard]] static Variable make_named(std::string_view name, storage::DynNodeStoragePtr node_storage = storage::default_node_storage); [[nodiscard]] static Variable make_anonymous(std::string_view name, storage::DynNodeStoragePtr node_storage = storage::default_node_storage); [[nodiscard]] static Variable make_unchecked(std::string_view name, bool anonymous = false, storage::DynNodeStoragePtr node_storage = storage::default_node_storage); Variable to_node_storage(storage::DynNodeStoragePtr node_storage) const; [[nodiscard]] Variable try_get_in_node_storage(storage::DynNodeStoragePtr node_storage) const noexcept; [[nodiscard]] static Variable find_named(std::string_view name, storage::DynNodeStoragePtr node_storage = storage::default_node_storage) noexcept; [[nodiscard]] static Variable find_anonymous(std::string_view name, storage::DynNodeStoragePtr node_storage = storage::default_node_storage) noexcept; static void validate(std::string_view var_name, bool anonymous = false); [[nodiscard]] bool is_anonymous() const; [[nodiscard]] CowString name() const; [[nodiscard]] FetchOrSerializeResult fetch_or_serialize_name(std::string_view &out, writer::BufWriterParts writer) const noexcept; bool serialize(writer::BufWriterParts writer) const noexcept; [[nodiscard]] explicit operator std::string() const; friend std::ostream &operator<<(std::ostream &os, const Variable &variable); bool is_blank_node() const = delete; bool is_literal() const = delete; bool is_variable() const = delete; bool is_iri() const = delete; [[nodiscard]] std::strong_ordering order(Variable const &other) const noexcept; [[nodiscard]] bool order_eq(Variable const &other) const noexcept; [[nodiscard]] bool order_ne(Variable const &other) const noexcept; [[nodiscard]] bool eq(Variable const &other) const noexcept; [[nodiscard]] bool ne(Variable const &other) const noexcept; friend struct Node; // todo unbound() }; } // namespace rdf4cpp::query template<> struct std::hash { inline size_t operator()(rdf4cpp::query::Variable const &v) const noexcept { return std::hash()(v); } }; template<> struct std::formatter : std::formatter { auto format(rdf4cpp::query::Variable n, format_context &ctx) const -> decltype(ctx.out()); }; #endif //RDF4CPP_VARIABLE_HPP