11 using dotnamecpp::assets::IAssetManager;
16 std::shared_ptr<IJsonSerializer> jsonSerializer,
17 std::string filename =
"customstrings.json");
30 const std::string &locale =
"en")
const override;
33 std::optional<std::string>
getEmail(
const std::string &
id)
const override;
36 std::optional<std::string>
getUrl(
const std::string &
id)
const override;
39 std::optional<std::string>
getTel(
const std::string &
id)
const override;
42 std::optional<std::string>
getPath(
const std::string &
id)
const override;
48 std::shared_ptr<IAssetManager> assetManager_;
49 std::shared_ptr<IJsonSerializer> jsonSerializer_;
50 std::string filename_;
53 mutable std::mutex cacheMutex_;
54 mutable std::optional<nlohmann::json> cachedData_;
60 std::optional<nlohmann::json> findById(
const std::string &
id)
const;
std::optional< std::string > getUrl(const std::string &id) const override
Get the Url object.
Definition CustomStringsLoader.cpp:116
CustomStringsLoader(std::shared_ptr< IAssetManager > assetManager, std::shared_ptr< IJsonSerializer > jsonSerializer, std::string filename="customstrings.json")
Definition CustomStringsLoader.cpp:6
std::optional< std::string > getTel(const std::string &id) const override
Get the Tel object.
Definition CustomStringsLoader.cpp:133
CustomStringsLoader & operator=(CustomStringsLoader &&)=delete
std::optional< std::string > getLocalizedString(const std::string &id, const std::string &locale="en") const override
Get the Localized String object.
Definition CustomStringsLoader.cpp:71
Result< nlohmann::json, JsonError > load() const override
Load the custom strings JSON data.
Definition CustomStringsLoader.cpp:17
std::optional< std::string > getEmail(const std::string &id) const override
Get the Email object.
Definition CustomStringsLoader.cpp:99
std::string getCustomStringSign() const override
Get the Custom String Sign object.
Definition CustomStringsLoader.cpp:167
std::optional< std::string > getPath(const std::string &id) const override
Get the Path object.
Definition CustomStringsLoader.cpp:150
CustomStringsLoader(CustomStringsLoader &&)=delete
CustomStringsLoader & operator=(const CustomStringsLoader &)=delete
~CustomStringsLoader() override=default
CustomStringsLoader(const CustomStringsLoader &)=delete
Interface for loading custom strings from JSON.
Definition ICustomStringsLoader.hpp:14
Definition UtilsError.hpp:93
Definition DirectoryManager.cpp:5