68#include <unordered_map>
108 bool load(const
std::
string& file_path) noexcept;
168 [[nodiscard]]
bool is_valid() const noexcept;
181 bool is_enable_log_{
false};
182 bool is_valid_{
false};
184 std::string error_string_;
186 std::vector<std::pair<std::string, std::string>> remap_list_;
187 std::unordered_map<std::string, std::string> cache_map_;
bool unload() noexcept
Clears the remap table and marks the instance as invalid.
const std::string & convert(const std::string &url) noexcept
Translates url according to the loaded remap rules.
UrlRemap() noexcept
Constructs an empty, invalid UrlRemap. No file is loaded.
bool is_valid() const noexcept
Returns whether a remap file has been successfully loaded.
Definition url_remap.h:200
const std::string & get_error_string() const noexcept
Returns the human-readable error description from the last failed operation.
Definition url_remap.h:202
void set_enable_log(bool enable_log) noexcept
Enables or disables logging of each URL conversion.
Definition url_remap.h:196
bool reload(const std::string &file_path) noexcept
Unloads the current configuration and loads a new one atomically.
bool load(const std::string &file_path) noexcept
Loads and parses a JSON remap configuration from file_path.
bool is_enable_log() const noexcept
Returns whether conversion logging is currently enabled.
Definition url_remap.h:198
Platform-independent macro definitions for the VLink library.
#define VLINK_EXPORT
Definition macros.h:85
#define VLINK_DISALLOW_COPY_AND_ASSIGN(classname)
Deletes the copy constructor and copy-assignment operator of classname.
Definition macros.h:184