File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed
Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,23 @@ namespace dotnamecpp::utils {
147147 return std::nullopt ;
148148 }
149149
150+ std::optional<std::string> CustomStringsLoader::getPath (const std::string& id) const {
151+ auto item = findById (id);
152+ if (!item) {
153+ return std::nullopt ;
154+ }
155+
156+ try {
157+ if (item->contains (" data" ) && (*item)[" data" ].contains (" path" )) {
158+ return (*item)[" data" ][" path" ].get <std::string> ();
159+ }
160+ } catch (const std::exception&) {
161+ return std::nullopt ;
162+ }
163+
164+ return std::nullopt ;
165+ }
166+
150167 std::string CustomStringsLoader::getCustomStringSign () const {
151168 std::string result;
152169
Original file line number Diff line number Diff line change @@ -38,6 +38,9 @@ namespace dotnamecpp::utils {
3838 [[nodiscard]]
3939 std::optional<std::string> getTel (const std::string& id) const override ;
4040
41+ [[nodiscard]]
42+ std::optional<std::string> getPath (const std::string& id) const override ;
43+
4144 [[nodiscard]]
4245 std::string getCustomStringSign () const override ;
4346
Original file line number Diff line number Diff line change @@ -61,6 +61,15 @@ namespace dotnamecpp::utils {
6161 [[nodiscard]]
6262 virtual std::optional<std::string> getTel (const std::string& id) const = 0;
6363
64+ /* *
65+ * @brief Get the Path object
66+ *
67+ * @param id
68+ * @return std::optional<std::string>
69+ */
70+ [[nodiscard]]
71+ virtual std::optional<std::string> getPath (const std::string& id) const = 0;
72+
6473 /* *
6574 * @brief Get the Custom String Sign object
6675 *
You can’t perform that action at this time.
0 commit comments