Program Listing for File Regex.hpp

Return to documentation for file (src/rdf4cpp/regex/Regex.hpp)

#ifndef RDF4CPP_RDF_REGEX_REGEX_HPP
#define RDF4CPP_RDF_REGEX_REGEX_HPP

#include <string_view>
#include <memory>

#include <rdf4cpp/regex/RegexError.hpp>
#include <rdf4cpp/regex/RegexFlags.hpp>
#include <rdf4cpp/regex/RegexReplacer.hpp>
#include <rdf4cpp/TriBool.hpp>

namespace rdf4cpp::regex {

struct Regex {
    using value_type = char;
    using flag_type = RegexFlags;
    using replacer_type = RegexReplacer;

private:
    friend struct RegexReplacer;

    struct Impl;
    std::shared_ptr<Impl const> impl_;

public:
    explicit Regex(std::string_view regex, flag_type flags = flag_type::none());

    [[nodiscard]] TriBool regex_match(std::string_view str) const noexcept;

    [[nodiscard]] TriBool regex_search(std::string_view str) const noexcept;

    [[nodiscard]] replacer_type make_replacer(std::string_view rewrite) const;
};

}  //namespace rdf4cpp::regex

#endif  //RDF4CPP_RDF_REGEX_REGEX_HPP