C++17ification.
C++17ification! - Filesystem interaction now uses std::filesystem::path. - Usage of const char*, std::string have been changed to std::string_view where appropriate. - Usage of printf-style functions changed to use fmt.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2015 Ben Vanik. All rights reserved. *
|
||||
* Copyright 2020 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
@@ -10,6 +10,7 @@
|
||||
#ifndef XENIA_UI_FILE_PICKER_H_
|
||||
#define XENIA_UI_FILE_PICKER_H_
|
||||
|
||||
#include <filesystem>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@@ -34,7 +35,7 @@ class FilePicker {
|
||||
FilePicker()
|
||||
: mode_(Mode::kOpen),
|
||||
type_(Type::kFile),
|
||||
title_(L"Select Files"),
|
||||
title_("Select Files"),
|
||||
multi_selection_(false) {}
|
||||
virtual ~FilePicker() = default;
|
||||
|
||||
@@ -44,14 +45,14 @@ class FilePicker {
|
||||
Type type() const { return type_; }
|
||||
void set_type(Type type) { type_ = type; }
|
||||
|
||||
std::wstring title() const { return title_; }
|
||||
void set_title(std::wstring title) { title_ = std::move(title); }
|
||||
const std::string& title() const { return title_; }
|
||||
void set_title(std::string title) { title_ = std::move(title); }
|
||||
|
||||
std::vector<std::pair<std::wstring, std::wstring>> extensions() const {
|
||||
std::vector<std::pair<std::string, std::string>> extensions() const {
|
||||
return extensions_;
|
||||
}
|
||||
void set_extensions(
|
||||
std::vector<std::pair<std::wstring, std::wstring>> extensions) {
|
||||
std::vector<std::pair<std::string, std::string>> extensions) {
|
||||
extensions_ = std::move(extensions);
|
||||
}
|
||||
|
||||
@@ -60,8 +61,10 @@ class FilePicker {
|
||||
multi_selection_ = multi_selection;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> selected_files() const { return selected_files_; }
|
||||
void set_selected_files(std::vector<std::wstring> selected_files) {
|
||||
std::vector<std::filesystem::path> selected_files() const {
|
||||
return selected_files_;
|
||||
}
|
||||
void set_selected_files(std::vector<std::filesystem::path> selected_files) {
|
||||
selected_files_ = std::move(selected_files);
|
||||
}
|
||||
|
||||
@@ -70,11 +73,11 @@ class FilePicker {
|
||||
private:
|
||||
Mode mode_;
|
||||
Type type_;
|
||||
std::wstring title_;
|
||||
std::vector<std::pair<std::wstring, std::wstring>> extensions_;
|
||||
std::string title_;
|
||||
std::vector<std::pair<std::string, std::string>> extensions_;
|
||||
bool multi_selection_;
|
||||
|
||||
std::vector<std::wstring> selected_files_;
|
||||
std::vector<std::filesystem::path> selected_files_;
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
||||
Reference in New Issue
Block a user