Skip to content

Commit

Permalink
string_view
Browse files Browse the repository at this point in the history
  • Loading branch information
igagis committed Mar 2, 2024
1 parent e97625a commit 829f457
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/ruisapp/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void application::update_window_rect(const ruis::rect& rect)
}

#if CFG_OS_NAME != CFG_OS_NAME_ANDROID && CFG_OS_NAME != CFG_OS_NAME_IOS
std::unique_ptr<papki::file> application::get_res_file(const std::string& path) const
std::unique_ptr<papki::file> application::get_res_file(std::string_view path) const
{
return std::make_unique<papki::fs_file>(path);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ruisapp/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class application : public utki::intrusive_singleton<application>
* @param path - file path to initialize the file interface with.
* @return Instance of the file interface into the resources storage.
*/
std::unique_ptr<papki::file> get_res_file(const std::string& path = std::string()) const;
std::unique_ptr<papki::file> get_res_file(std::string_view path = {}) const;

public:
/**
Expand Down
6 changes: 4 additions & 2 deletions src/ruisapp/glue/android/glue.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,9 @@ class asset_file : public papki::file
mutable AAsset* handle = nullptr;

public:
asset_file(AAssetManager* manager, const std::string& pathName = std::string()) :
asset_file(AAssetManager* manager,
// TODO: naming convention
std::string_view pathName = std::string_view()) :
manager(manager),
papki::file(pathName)
{
Expand Down Expand Up @@ -1125,7 +1127,7 @@ ruisapp::application::application(std::string name, const window_params& wp) :
this->update_window_rect(ruis::rect(ruis::vector2(0), win_size.to<ruis::real>()));
}

std::unique_ptr<papki::file> ruisapp::application::get_res_file(const std::string& path) const
std::unique_ptr<papki::file> ruisapp::application::get_res_file(std::string_view path) const
{
return std::make_unique<asset_file>(native_activity->assetManager, path);
}
Expand Down
6 changes: 3 additions & 3 deletions src/ruisapp/glue/ios/glue.mm
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ - (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
}

void application::swap_frame_buffers(){
//do nothing
// do nothing
}

void application::show_virtual_keyboard()noexcept{
Expand All @@ -348,7 +348,7 @@ - (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
//TODO:
}

std::unique_ptr<papki::file> application::get_res_file(const std::string& path)const{
std::unique_ptr<papki::file> application::get_res_file(std::string_view path)const{
std::string dir([[[NSBundle mainBundle] resourcePath] fileSystemRepresentation]);

// TRACE(<< "res path = " << dir << std::endl)
Expand All @@ -360,5 +360,5 @@ - (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
}

void application::set_mouse_cursor_visible(bool visible){
//do nothing
// do nothing
}

0 comments on commit 829f457

Please sign in to comment.