Make some functions static

This commit is contained in:
Thomas Goyne 2014-07-08 15:16:49 -07:00
parent e60197962a
commit e713f741a4
5 changed files with 12 additions and 8 deletions

View File

@ -69,13 +69,16 @@ namespace ec = boost::system::errc;
#undef CreateDirectory #undef CreateDirectory
namespace agi { namespace fs { namespace agi { namespace fs {
namespace {
WRAP_BFS(file_size, SizeImpl)
WRAP_BFS(space, Space)
}
WRAP_BFS_IGNORE_ERROR(exists, Exists) WRAP_BFS_IGNORE_ERROR(exists, Exists)
WRAP_BFS_IGNORE_ERROR(is_regular_file, FileExists) WRAP_BFS_IGNORE_ERROR(is_regular_file, FileExists)
WRAP_BFS_IGNORE_ERROR(is_directory, DirectoryExists) WRAP_BFS_IGNORE_ERROR(is_directory, DirectoryExists)
WRAP_BFS(file_size, SizeImpl)
WRAP_BFS(last_write_time, ModifiedTime) WRAP_BFS(last_write_time, ModifiedTime)
WRAP_BFS(create_directories, CreateDirectory) WRAP_BFS(create_directories, CreateDirectory)
WRAP_BFS(space, Space)
WRAP_BFS(remove, Remove) WRAP_BFS(remove, Remove)
WRAP_BFS(canonical, Canonicalize) WRAP_BFS(canonical, Canonicalize)

View File

@ -144,17 +144,17 @@ void AssDialogue::Parse(std::string const& raw) {
Text = text; Text = text;
} }
void append_int(std::string &str, int v) { static void append_int(std::string &str, int v) {
boost::spirit::karma::generate(back_inserter(str), boost::spirit::karma::int_, v); boost::spirit::karma::generate(back_inserter(str), boost::spirit::karma::int_, v);
str += ','; str += ',';
} }
void append_str(std::string &out, std::string const& str) { static void append_str(std::string &out, std::string const& str) {
out += str; out += str;
out += ','; out += ',';
} }
void append_unsafe_str(std::string &out, std::string const& str) { static void append_unsafe_str(std::string &out, std::string const& str) {
for (auto c : str) { for (auto c : str) {
if (c == ',') if (c == ',')
out += ';'; out += ';';

View File

@ -223,7 +223,7 @@ std::string keypress_to_str(int key_code, int modifier) {
return combo; return combo;
} }
bool check(std::string const& context, agi::Context *c, int key_code, int modifier) { static bool check(std::string const& context, agi::Context *c, int key_code, int modifier) {
std::string combo = keypress_to_str(key_code, modifier); std::string combo = keypress_to_str(key_code, modifier);
if (combo.empty()) return false; if (combo.empty()) return false;
@ -237,7 +237,7 @@ bool check(std::string const& context, agi::Context *c, int key_code, int modifi
bool check(std::string const& context, agi::Context *c, wxKeyEvent &evt) { bool check(std::string const& context, agi::Context *c, wxKeyEvent &evt) {
try { try {
if (!hotkey::check(context, c, evt.GetKeyCode(), evt.GetModifiers())) { if (!check(context, c, evt.GetKeyCode(), evt.GetModifiers())) {
evt.Skip(); evt.Skip();
return false; return false;
} }

View File

@ -34,7 +34,6 @@ void init();
void clear(); void clear();
bool check(std::string const& context, agi::Context *c, wxKeyEvent &evt); bool check(std::string const& context, agi::Context *c, wxKeyEvent &evt);
bool check(std::string const& context, agi::Context *c, int key_code, wchar_t key_char, int modifier);
std::string keypress_to_str(int key_code, int modifier); std::string keypress_to_str(int key_code, int modifier);
std::string get_hotkey_str_first(std::string const& context, std::string const& command); std::string get_hotkey_str_first(std::string const& context, std::string const& command);
std::vector<std::string> get_hotkey_strs(std::string const& context, std::string const& command); std::vector<std::string> get_hotkey_strs(std::string const& context, std::string const& command);

View File

@ -56,6 +56,7 @@
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/treebook.h> #include <wx/treebook.h>
namespace {
/// General preferences page /// General preferences page
void General(wxTreebook *book, Preferences *parent) { void General(wxTreebook *book, Preferences *parent) {
auto p = new OptionPage(book, parent, _("General")); auto p = new OptionPage(book, parent, _("General"));
@ -635,6 +636,7 @@ void Interface_Hotkeys::OnUpdateFilter(wxCommandEvent&) {
dvc->Expand(context); dvc->Expand(context);
} }
} }
}
void Preferences::SetOption(std::unique_ptr<agi::OptionValue> new_value) { void Preferences::SetOption(std::unique_ptr<agi::OptionValue> new_value) {
pending_changes[new_value->GetName()] = std::move(new_value); pending_changes[new_value->GetName()] = std::move(new_value);