summaryrefslogtreecommitdiffhomepage
path: root/editor
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-05 19:29:40 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-05 19:29:40 +0100
commit12eca108a07cde1606fca3e472aed58749407699 (patch)
tree44ac90dffca8cde0fc06800c5546cd12f5cd9249 /editor
parent28f5a46ba0058752d4e92cc66e0260f4ed2b8cf3 (diff)
replace std::string with Corrade's String
Diffstat (limited to 'editor')
-rw-r--r--editor/editor.cpp5
-rw-r--r--editor/editor.hpp5
2 files changed, 6 insertions, 4 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp
index 3586a3bf..499dd441 100644
--- a/editor/editor.cpp
+++ b/editor/editor.cpp
@@ -11,6 +11,7 @@
#include <Corrade/Containers/StringView.h>
+#include <string_view>
#include <vector>
#include <filesystem>
@@ -25,7 +26,9 @@ void tile_editor::load_atlases()
{
static const std::filesystem::path image_path{IMAGE_PATH, std::filesystem::path::generic_format};
using atlas_array = std::vector<std::shared_ptr<tile_atlas>>;
- for (auto& atlas : json_helper::from_json<atlas_array>(image_path/(_name + ".json")))
+ const String filename = _name + ".json";
+ const auto filename_view = std::string_view{filename.cbegin(), filename.cend()};
+ for (auto& atlas : json_helper::from_json<atlas_array>(image_path/filename_view))
{
StringView name = atlas->name();
if (auto x = name.findLast('.'); x)
diff --git a/editor/editor.hpp b/editor/editor.hpp
index 869307c7..09277590 100644
--- a/editor/editor.hpp
+++ b/editor/editor.hpp
@@ -9,9 +9,8 @@
#include <optional>
#include <vector>
#include <map>
-#include <string>
#include <memory>
-#include <Corrade/Containers/StringView.h>
+#include <Corrade/Containers/String.h>
namespace floormat {
@@ -32,7 +31,7 @@ private:
sel_none, sel_tile, sel_perm,
};
- std::string _name;
+ String _name;
std::map<std::string, std::shared_ptr<tile_atlas>> _atlases;
tile_image_proto _selected_tile;
std::tuple<std::shared_ptr<tile_atlas>, std::vector<decltype(tile_image_proto::variant)>> _permutation;