diff --git a/src/common.h b/src/common.h index a00c3a6..8fc889e 100644 --- a/src/common.h +++ b/src/common.h @@ -12,12 +12,10 @@ #include #include -using namespace std; - // JSON #include -typedef Json::Value JsonValue; +using namespace std; // Typedef some common templates typedef map StringConstMap; diff --git a/src/settings/Config.cpp b/src/settings/Config.cpp index 2ac75f3..e5a4b78 100644 --- a/src/settings/Config.cpp +++ b/src/settings/Config.cpp @@ -17,7 +17,7 @@ void TyroConfig::LoadJson(const char json[]) } } -JsonValue TyroConfig::GetRoot() +Json::Value TyroConfig::GetRoot() { return default_root; } diff --git a/src/settings/Config.h b/src/settings/Config.h index db17d1f..f6e8b7b 100644 --- a/src/settings/Config.h +++ b/src/settings/Config.h @@ -6,9 +6,9 @@ class TyroConfig { public: TyroConfig(); ~TyroConfig(); - JsonValue GetRoot(); + Json::Value GetRoot(); void LoadJson(const char json[]); private: - JsonValue default_root; + Json::Value default_root; Json::Reader reader; }; diff --git a/src/settings/LangConfig.cpp b/src/settings/LangConfig.cpp index b675239..b9a8314 100644 --- a/src/settings/LangConfig.cpp +++ b/src/settings/LangConfig.cpp @@ -10,16 +10,16 @@ LangConfig::LangConfig() this->language = ""; // "cache" reverse map of languages to their keys - JsonValue langList = this->GetRoot(); - JsonValue::iterator it; + Json::Value langList = this->GetRoot(); + Json::Value::iterator it; // Special case for non-recognized language reverseMap["Plain Text"] = ""; for (it = langList.begin(); it != langList.end(); ++it) { - JsonValue langObj = *it; - reverseMap[langObj.get("name", JsonValue()).asString()] = it.key().asString(); + Json::Value langObj = *it; + reverseMap[langObj.get("name", Json::Value()).asString()] = it.key().asString(); } } @@ -40,8 +40,8 @@ LangConfig::~LangConfig() */ string LangConfig::GetLangByFile(wxFileName &fileName) { - JsonValue langList = this->GetRoot(); - JsonValue::iterator it; + Json::Value langList = this->GetRoot(); + Json::Value::iterator it; wxString curr_file = fileName.GetFullName(); @@ -81,30 +81,30 @@ string LangConfig::GetLangByFile(wxFileName &fileName) * Get the list of keywords for the selected language * * @param string lang - * @return JsonValue + * @return Json::Value */ -JsonValue LangConfig::GetKeywordList(string lang) +Json::Value LangConfig::GetKeywordList(string lang) { if (lang == "none") lang = this->language; return this->GetRoot() - .get(lang, JsonValue()) - .get("keywords", JsonValue()); + .get(lang, Json::Value()) + .get("keywords", Json::Value()); } /** * Get the lexer theme map for the current language * * @param string lang - * @return JsonValue + * @return Json::Value */ -JsonValue LangConfig::GetLexerMap(string lang) +Json::Value LangConfig::GetLexerMap(string lang) { if (lang == "none") lang = this->language; return this->GetRoot() - .get(lang, JsonValue()) - .get("lexer_map", JsonValue()); + .get(lang, Json::Value()) + .get("lexer_map", Json::Value()); } /** @@ -134,8 +134,8 @@ string LangConfig::GetLang() string LangConfig::GetCurrentLangName() { return this->GetRoot() - .get(this->language, JsonValue()) - .get("name", JsonValue()) + .get(this->language, Json::Value()) + .get("name", Json::Value()) .asString(); } diff --git a/src/settings/LangConfig.h b/src/settings/LangConfig.h index 21e1714..e435d8a 100644 --- a/src/settings/LangConfig.h +++ b/src/settings/LangConfig.h @@ -10,8 +10,8 @@ public: void SetLang(const string &lang); string GetLang(); string GetLangByFile(wxFileName &fileName); - JsonValue GetKeywordList(string lang="none"); - JsonValue GetLexerMap(string lang="none"); + Json::Value GetKeywordList(string lang="none"); + Json::Value GetLexerMap(string lang="none"); StringMap GetLangList(); string GetCurrentLangName(); string GetLangByName(const string &name); diff --git a/src/settings/ThemeConfig.cpp b/src/settings/ThemeConfig.cpp index 4afc7b7..144f57c 100644 --- a/src/settings/ThemeConfig.cpp +++ b/src/settings/ThemeConfig.cpp @@ -30,8 +30,8 @@ ThemeConfig::~ThemeConfig() */ bool ThemeConfig::SetTheme(const string &theme_name) { - JsonValue theme_list = this->GetRoot(); - JsonValue selected_theme = theme_list.get(theme_name, JsonValue()); + Json::Value theme_list = this->GetRoot(); + Json::Value selected_theme = theme_list.get(theme_name, Json::Value()); if (selected_theme.isNull()) return FALSE; @@ -49,7 +49,7 @@ bool ThemeConfig::SetTheme(const string &theme_name) * * @return string */ -JsonValue ThemeConfig::GetTheme() +Json::Value ThemeConfig::GetTheme() { return this->current_theme; } @@ -59,13 +59,13 @@ JsonValue ThemeConfig::GetTheme() * * @param string type * @param string key - * @return JsonValue + * @return Json::Value */ -JsonValue ThemeConfig::GetThemeValue(const string &type, const string &key) +Json::Value ThemeConfig::GetThemeValue(const string &type, const string &key) { - JsonValue value = this->current_theme - .get(type, JsonValue()) - .get(key, JsonValue()); + Json::Value value = this->current_theme + .get(type, Json::Value()) + .get(key, Json::Value()); return value; } @@ -78,7 +78,7 @@ JsonValue ThemeConfig::GetThemeValue(const string &type, const string &key) */ wxColor ThemeConfig::GetThemeColor(const string &type, const string &key) { - JsonValue color_value = this->GetThemeValue(type, key); + Json::Value color_value = this->GetThemeValue(type, key); if (color_value.isArray()) { diff --git a/src/settings/ThemeConfig.h b/src/settings/ThemeConfig.h index d535dba..1b5f622 100644 --- a/src/settings/ThemeConfig.h +++ b/src/settings/ThemeConfig.h @@ -11,10 +11,10 @@ public: ThemeConfig(); ~ThemeConfig(); bool SetTheme(const string &theme_name); - JsonValue GetTheme(); - JsonValue GetThemeValue(const string &type, const string &key); + Json::Value GetTheme(); + Json::Value GetThemeValue(const string &type, const string &key); wxColor GetThemeColor(const string &type, const string &key); private: - JsonValue current_theme; + Json::Value current_theme; }; diff --git a/src/widgets/EditorPane.cpp b/src/widgets/EditorPane.cpp index eda0d10..9aecdc8 100644 --- a/src/widgets/EditorPane.cpp +++ b/src/widgets/EditorPane.cpp @@ -100,8 +100,8 @@ void EditorPane::ApplyTheme(const string &lang, const string &theme) } // Get the keywords and mapping for the selected language - JsonValue lexer_map = Glob_lang_config->GetLexerMap(lang); - JsonValue keywords_array = Glob_lang_config->GetKeywordList(lang); + Json::Value lexer_map = Glob_lang_config->GetLexerMap(lang); + Json::Value keywords_array = Glob_lang_config->GetKeywordList(lang); if (keywords_array.isArray()) { @@ -318,10 +318,10 @@ void EditorPane::BindEvents() /** * Iterate through the theme settings and apply them * - * @param JsonValue lexer_map - Maps token types to theme colors + * @param Json::Value lexer_map - Maps token types to theme colors * @return void */ -void EditorPane::_ApplyTheme(JsonValue &lexer_map) +void EditorPane::_ApplyTheme(Json::Value &lexer_map) { // Make sure to have a default font, especially for Linux wxFont globalFont = wxSystemSettings::GetFont(wxSYS_ANSI_FIXED_FONT); diff --git a/src/widgets/EditorPane.h b/src/widgets/EditorPane.h index aa3170c..c04bd51 100644 --- a/src/widgets/EditorPane.h +++ b/src/widgets/EditorPane.h @@ -28,5 +28,5 @@ protected: bool FileReadable(); bool FileWritable(); void BindEvents(); - void _ApplyTheme(JsonValue &lexer_map); + void _ApplyTheme(Json::Value &lexer_map); }; diff --git a/src/widgets/FileTreePane.cpp b/src/widgets/FileTreePane.cpp index e2ea84c..dd5a65d 100644 --- a/src/widgets/FileTreePane.cpp +++ b/src/widgets/FileTreePane.cpp @@ -89,7 +89,7 @@ void FileTreePane::CreateTree(const wxString &path) // Make the dir relative to the base path, // then only use the first dir segment fileName.MakeRelativeTo(this->base_path); - auto dir = std::string(fileName.GetPath()); + auto dir = string(fileName.GetPath()); if (dir.empty()) { @@ -136,7 +136,7 @@ void FileTreePane::AddDirToTree(wxTreeListItem &root, const wxString &path, cons wxString wFullPath(fullPath); // Stop early if folder exists - auto it = this->dir_set.find(std::string(fullPath)); + auto it = this->dir_set.find(string(fullPath)); if (it != this->dir_set.end()) { wxLogInfo("Redundant call to AddDirToTree for: %s, %s", path, parent); @@ -172,7 +172,7 @@ void FileTreePane::AddDirToTree(wxTreeListItem &root, const wxString &path, cons // Make the dir relative to the search path, // then only use the first dir segment fileName.MakeRelativeTo(fullPath); - auto dir = std::string(fileName.GetPath()); + auto dir = string(fileName.GetPath()); if (dir.empty()) { @@ -223,7 +223,7 @@ void FileTreePane::AddDirFiles(wxTreeListItem &root, const wxString &path, wxArr wxFileName fileName(item); fileName.MakeAbsolute(); - auto it = this->file_set.find(std::string(fileName.GetFullPath())); + auto it = this->file_set.find(string(fileName.GetFullPath())); if (it != this->file_set.end()) { continue; @@ -235,7 +235,7 @@ void FileTreePane::AddDirFiles(wxTreeListItem &root, const wxString &path, wxArr auto fileLabel = BaseName(fileName.GetFullName()); this->AppendItem(root, fileLabel, Icon_File, Icon_File, fileData); - this->file_set.insert(std::string(fileName.GetFullPath())); + this->file_set.insert(string(fileName.GetFullPath())); } } diff --git a/src/widgets/FileTreePane.h b/src/widgets/FileTreePane.h index d5d1808..1791082 100644 --- a/src/widgets/FileTreePane.h +++ b/src/widgets/FileTreePane.h @@ -18,8 +18,8 @@ public: private: wxString base_path = ""; wxImageList *img_list = nullptr; - unordered_set file_set; - unordered_set dir_set; + unordered_set file_set; + unordered_set dir_set; void BindEvents(); void OpenFolder(wxTreeListEvent& event); void OpenFileInEditor(wxTreeListEvent& event); diff --git a/tests/LangConfigTest.cpp b/tests/LangConfigTest.cpp index eb68aa6..2e55bca 100644 --- a/tests/LangConfigTest.cpp +++ b/tests/LangConfigTest.cpp @@ -47,7 +47,7 @@ TEST_CASE("Language Config Library") SECTION("GetLexerMap()") { - JsonValue lexer_map = config->GetLexerMap("none"); + Json::Value lexer_map = config->GetLexerMap("none"); REQUIRE(lexer_map.isNull()); lexer_map = config->GetLexerMap("cpp"); @@ -56,7 +56,7 @@ TEST_CASE("Language Config Library") SECTION("GetKeywordList()") { - JsonValue keyword_list = config->GetKeywordList("none"); + Json::Value keyword_list = config->GetKeywordList("none"); REQUIRE(keyword_list.isNull()); keyword_list = config->GetKeywordList("cpp"); diff --git a/tests/ThemeConfigTest.cpp b/tests/ThemeConfigTest.cpp index 2ce4791..9b6d52b 100644 --- a/tests/ThemeConfigTest.cpp +++ b/tests/ThemeConfigTest.cpp @@ -7,7 +7,7 @@ TEST_CASE("Theme Config Library") SECTION("GetTheme()") { - JsonValue theme = config->GetTheme(); + Json::Value theme = config->GetTheme(); REQUIRE(theme.isObject()); }