From c128c4ce6f5b277b5d2609c9a540cb1acc14ce2c Mon Sep 17 00:00:00 2001 From: Antoine Beauchamp Date: Sun, 24 Dec 2023 12:14:15 -0500 Subject: [PATCH] *** Major class name refactoring: Rename `Configuration` class to `ConfigFile`. This is to better match documentation term `Configuration File` and match the parent container class named `ConfigManager`. --- src/api/sa_cfgmgr.cpp | 6 +- src/api/sa_configuration.cpp | 8 +-- src/api/sa_private_casting.cpp | 12 ++-- src/api/sa_private_casting.h | 10 +-- src/core/CMakeLists.txt | 4 +- .../{Configuration.cpp => ConfigFile.cpp} | 64 +++++++++--------- src/core/{Configuration.h => ConfigFile.h} | 42 ++++++------ src/core/ConfigManager.cpp | 32 ++++----- src/core/ConfigManager.h | 16 ++--- src/core/DefaultSettings.h | 2 +- src/core/Menu.cpp | 14 ++-- src/core/Menu.h | 18 ++--- src/core/ObjectFactory.cpp | 2 +- src/core/ObjectFactory.h | 2 +- src/core/Plugin.cpp | 14 ++-- src/core/Plugin.h | 18 ++--- src/core/Validator.cpp | 6 +- src/shellextension/CContextMenu.cpp | 4 +- src/tests/QuickLoader.cpp | 8 +-- src/tests/TestActionExecute.cpp | 4 +- src/tests/TestActionProperty.cpp | 4 +- src/tests/TestConfigManager.cpp | 38 +++++------ src/tests/TestConfiguration.cpp | 20 +++--- src/tests/TestObjectFactory.cpp | 66 +++++++++---------- src/tests/TestPlugins.cpp | 54 +++++++-------- 25 files changed, 234 insertions(+), 234 deletions(-) rename src/core/{Configuration.cpp => ConfigFile.cpp} (88%) rename src/core/{Configuration.h => ConfigFile.h} (81%) diff --git a/src/api/sa_cfgmgr.cpp b/src/api/sa_cfgmgr.cpp index 978e282f..8ff93a7f 100644 --- a/src/api/sa_cfgmgr.cpp +++ b/src/api/sa_cfgmgr.cpp @@ -31,7 +31,7 @@ using namespace shellanything; size_t sa_cfgmgr_get_configuration_count() { - Configuration::ConfigurationPtrList configs = ConfigManager::GetInstance().GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = ConfigManager::GetInstance().GetConfigFiles(); size_t count = configs.size(); return count; } @@ -40,10 +40,10 @@ sa_error_t sa_cfgmgr_get_configuration_element(size_t index, sa_configuration_t* { if (configuration == NULL) return SA_ERROR_INVALID_ARGUMENTS; - Configuration::ConfigurationPtrList configs = ConfigManager::GetInstance().GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = ConfigManager::GetInstance().GetConfigFiles(); if (configs.empty() || index > (configs.size() - 1)) return SA_ERROR_VALUE_OUT_OF_BOUNDS; - shellanything::Configuration* config_element = configs[index]; + shellanything::ConfigFile* config_element = configs[index]; *configuration = AS_TYPE_CONFIGURATION(config_element); return SA_ERROR_SUCCESS; } diff --git a/src/api/sa_configuration.cpp b/src/api/sa_configuration.cpp index a2eb8537..19f1ed6c 100644 --- a/src/api/sa_configuration.cpp +++ b/src/api/sa_configuration.cpp @@ -23,7 +23,7 @@ *********************************************************************************/ #include "shellanything/sa_configuration.h" -#include "Configuration.h" +#include "ConfigFile.h" #include "sa_private_casting.h" #include "sa_string_private.h" @@ -42,7 +42,7 @@ sa_error_t sa_configuration_load_file_buffer(const char* path, char* error_buffe return SA_ERROR_INVALID_ARGUMENTS; std::string tmp_error; - shellanything::Configuration* config = shellanything::Configuration::LoadFile(path, tmp_error); + shellanything::ConfigFile* config = shellanything::ConfigFile::LoadFile(path, tmp_error); // Check for error if (config == NULL) @@ -62,7 +62,7 @@ sa_error_t sa_configuration_load_file_string(const char* path, sa_string_t* erro return SA_ERROR_INVALID_ARGUMENTS; std::string tmp_error; - shellanything::Configuration* config = shellanything::Configuration::LoadFile(path, tmp_error); + shellanything::ConfigFile* config = shellanything::ConfigFile::LoadFile(path, tmp_error); // Check for error if (config == NULL) @@ -80,7 +80,7 @@ sa_boolean sa_configuration_is_valid_config_file(const char* path) { if (path == NULL) return 0; - bool valid = shellanything::Configuration::IsValidConfigFile(path); + bool valid = shellanything::ConfigFile::IsValidConfigFile(path); if (valid) return 1; return 0; diff --git a/src/api/sa_private_casting.cpp b/src/api/sa_private_casting.cpp index 5f6cd5b2..546a0d61 100644 --- a/src/api/sa_private_casting.cpp +++ b/src/api/sa_private_casting.cpp @@ -92,19 +92,19 @@ sa_menu_t AS_TYPE_MENU(shellanything::Menu* object) sa_menu_t my_type; my_type.opaque = (void*)(object); return my_type; } -const shellanything::Configuration* AS_CLASS_CONFIGURATION(sa_configuration_immutable_t* object) +const shellanything::ConfigFile* AS_CLASS_CONFIGURATION(sa_configuration_immutable_t* object) { - return (const shellanything::Configuration*)(object->opaque); + return (const shellanything::ConfigFile*)(object->opaque); } -shellanything::Configuration* AS_CLASS_CONFIGURATION(sa_configuration_t* object) +shellanything::ConfigFile* AS_CLASS_CONFIGURATION(sa_configuration_t* object) { - return (shellanything::Configuration*)(object->opaque); + return (shellanything::ConfigFile*)(object->opaque); } -sa_configuration_immutable_t AS_TYPE_CONFIGURATION(const shellanything::Configuration* object) +sa_configuration_immutable_t AS_TYPE_CONFIGURATION(const shellanything::ConfigFile* object) { sa_configuration_immutable_t my_type; my_type.opaque = (void*)(object); return my_type; } -sa_configuration_t AS_TYPE_CONFIGURATION(shellanything::Configuration* object) +sa_configuration_t AS_TYPE_CONFIGURATION(shellanything::ConfigFile* object) { sa_configuration_t my_type; my_type.opaque = (void*)(object); return my_type; } diff --git a/src/api/sa_private_casting.h b/src/api/sa_private_casting.h index 44aadf1c..dd52fcb7 100644 --- a/src/api/sa_private_casting.h +++ b/src/api/sa_private_casting.h @@ -32,7 +32,7 @@ #include "SelectionContext.h" #include "Icon.h" #include "Menu.h" -#include "Configuration.h" +#include "ConfigFile.h" #include "Validator.h" #include "PropertyStore.h" @@ -58,10 +58,10 @@ shellanything::Menu* AS_CLASS_MENU(sa_menu_t* object); sa_menu_immutable_t AS_TYPE_MENU(const shellanything::Menu* object); sa_menu_t AS_TYPE_MENU(shellanything::Menu* object); -const shellanything::Configuration* AS_CLASS_CONFIGURATION(sa_configuration_immutable_t* object); -shellanything::Configuration* AS_CLASS_CONFIGURATION(sa_configuration_t* object); -sa_configuration_immutable_t AS_TYPE_CONFIGURATION(const shellanything::Configuration* object); -sa_configuration_t AS_TYPE_CONFIGURATION(shellanything::Configuration* object); +const shellanything::ConfigFile* AS_CLASS_CONFIGURATION(sa_configuration_immutable_t* object); +shellanything::ConfigFile* AS_CLASS_CONFIGURATION(sa_configuration_t* object); +sa_configuration_immutable_t AS_TYPE_CONFIGURATION(const shellanything::ConfigFile* object); +sa_configuration_t AS_TYPE_CONFIGURATION(shellanything::ConfigFile* object); const shellanything::Validator* AS_CLASS_VALIDATOR(sa_validator_immutable_t* object); shellanything::Validator* AS_CLASS_VALIDATOR(sa_validator_t* object); diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 3eb543c2..76ee0f14 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -11,7 +11,7 @@ set(SHELLANYTHING_CORE_HEADER_FILES "" ${CMAKE_SOURCE_DIR}/src/core/ActionStop.h ${CMAKE_SOURCE_DIR}/src/core/App.h ${CMAKE_SOURCE_DIR}/src/core/BaseAction.h - ${CMAKE_SOURCE_DIR}/src/core/Configuration.h + ${CMAKE_SOURCE_DIR}/src/core/ConfigFile.h ${CMAKE_SOURCE_DIR}/src/core/ConfigManager.h ${CMAKE_SOURCE_DIR}/src/core/SelectionContext.h ${CMAKE_SOURCE_DIR}/src/core/DefaultSettings.h @@ -41,7 +41,7 @@ add_library(sa.core SHARED ActionStop.cpp App.cpp BaseAction.cpp - Configuration.cpp + ConfigFile.cpp ConfigManager.cpp SelectionContext.cpp DefaultSettings.cpp diff --git a/src/core/Configuration.cpp b/src/core/ConfigFile.cpp similarity index 88% rename from src/core/Configuration.cpp rename to src/core/ConfigFile.cpp index dc91fbd7..99b22ca9 100644 --- a/src/core/Configuration.cpp +++ b/src/core/ConfigFile.cpp @@ -22,7 +22,7 @@ * SOFTWARE. *********************************************************************************/ -#include "Configuration.h" +#include "ConfigFile.h" #include "SelectionContext.h" #include "ActionProperty.h" #include "ObjectFactory.h" @@ -47,7 +47,7 @@ using namespace tinyxml2; namespace shellanything { - static Configuration* gUpdatingConfiguration = NULL; + static ConfigFile* gUpdatingConfigFile = NULL; std::string GetXmlEncoding(XMLDocument& doc, std::string& error) { @@ -96,28 +96,28 @@ namespace shellanything return encoding; } - Configuration::Configuration() : + ConfigFile::ConfigFile() : mFileModifiedDate(0), mDefaults(NULL) { } - Configuration::~Configuration() + ConfigFile::~ConfigFile() { DeleteChildren(); } - Configuration* Configuration::GetUpdatingConfiguration() + ConfigFile* ConfigFile::GetUpdatingConfigFile() { - return gUpdatingConfiguration; + return gUpdatingConfigFile; } - void Configuration::SetUpdatingConfiguration(Configuration* configuration) + void ConfigFile::SetUpdatingConfigFile(ConfigFile* config_file) { - gUpdatingConfiguration = configuration; + gUpdatingConfigFile = config_file; } - Configuration* Configuration::LoadFile(const std::string& path, std::string& error) + ConfigFile* ConfigFile::LoadFile(const std::string& path, std::string& error) { error = ""; @@ -208,7 +208,7 @@ namespace shellanything return NULL; } - Configuration* config = new Configuration(); + ConfigFile* config = new ConfigFile(); config->SetFilePath(path); config->SetFileModifiedDate(file_modified_date); @@ -290,7 +290,7 @@ namespace shellanything return config; } - bool Configuration::IsValidConfigFile(const std::string& path) + bool ConfigFile::IsValidConfigFile(const std::string& path) { std::string file_extension = ra::filesystem::GetFileExtention(path); file_extension = ra::strings::Uppercase(file_extension); @@ -317,29 +317,29 @@ namespace shellanything return true; } - const std::string& Configuration::GetFilePath() const + const std::string& ConfigFile::GetFilePath() const { return mFilePath; } - void Configuration::SetFilePath(const std::string& file_path) + void ConfigFile::SetFilePath(const std::string& file_path) { mFilePath = file_path; } - const uint64_t& Configuration::GetFileModifiedDate() const + const uint64_t& ConfigFile::GetFileModifiedDate() const { return mFileModifiedDate; } - void Configuration::SetFileModifiedDate(const uint64_t& file_modified_date) + void ConfigFile::SetFileModifiedDate(const uint64_t& file_modified_date) { mFileModifiedDate = file_modified_date; } - void Configuration::Update(const SelectionContext& context) + void ConfigFile::Update(const SelectionContext& context) { - SetUpdatingConfiguration(this); + SetUpdatingConfigFile(this); //run callbacks of each plugins //for each plugins @@ -365,10 +365,10 @@ namespace shellanything child->Update(context); } - SetUpdatingConfiguration(NULL); + SetUpdatingConfigFile(NULL); } - void Configuration::ApplyDefaultSettings() + void ConfigFile::ApplyDefaultSettings() { if (mDefaults && mDefaults->GetActions().size() > 0) { @@ -405,7 +405,7 @@ namespace shellanything } } - Menu* Configuration::FindMenuByCommandId(const uint32_t& command_id) + Menu* ConfigFile::FindMenuByCommandId(const uint32_t& command_id) { //for each child Menu::MenuPtrList children = GetMenus(); @@ -420,7 +420,7 @@ namespace shellanything return NULL; } - Menu* Configuration::FindMenuByName(const std::string& name, FIND_BY_NAME_FLAGS flags) + Menu* ConfigFile::FindMenuByName(const std::string& name, FIND_BY_NAME_FLAGS flags) { //for each child Menu::MenuPtrList children = GetMenus(); @@ -435,7 +435,7 @@ namespace shellanything return NULL; } - uint32_t Configuration::AssignCommandIds(const uint32_t& first_command_id) + uint32_t ConfigFile::AssignCommandIds(const uint32_t& first_command_id) { uint32_t nextCommandId = first_command_id; @@ -450,23 +450,23 @@ namespace shellanything return nextCommandId; } - void Configuration::AddPlugin(Plugin* plugin) + void ConfigFile::AddPlugin(Plugin* plugin) { mPlugins.push_back(plugin); - plugin->SetParentConfiguration(this); + plugin->SetParentConfigFile(this); } - const Plugin::PluginPtrList& Configuration::GetPlugins() const + const Plugin::PluginPtrList& ConfigFile::GetPlugins() const { return mPlugins; } - Menu::MenuPtrList Configuration::GetMenus() + Menu::MenuPtrList ConfigFile::GetMenus() { return mMenus; } - void Configuration::SetDefaultSettings(DefaultSettings* defaults) + void ConfigFile::SetDefaultSettings(DefaultSettings* defaults) { if (mDefaults) delete mDefaults; @@ -474,18 +474,18 @@ namespace shellanything mDefaults = defaults; } - const DefaultSettings* Configuration::GetDefaultSettings() const + const DefaultSettings* ConfigFile::GetDefaultSettings() const { return mDefaults; } - void Configuration::AddMenu(Menu* menu) + void ConfigFile::AddMenu(Menu* menu) { mMenus.push_back(menu); - menu->SetParentConfiguration(this); + menu->SetParentConfigFile(this); } - void Configuration::DeleteChildren() + void ConfigFile::DeleteChildren() { // Delete menus for (size_t i = 0; i < mMenus.size(); i++) @@ -508,7 +508,7 @@ namespace shellanything mPlugins.clear(); } - void Configuration::DeleteChild(Menu* menu) + void ConfigFile::DeleteChild(Menu* menu) { delete menu; } diff --git a/src/core/Configuration.h b/src/core/ConfigFile.h similarity index 81% rename from src/core/Configuration.h rename to src/core/ConfigFile.h index 4fe722c7..c14ea22f 100644 --- a/src/core/Configuration.h +++ b/src/core/ConfigFile.h @@ -38,59 +38,59 @@ namespace shellanything { /// - /// A configuration holds mutiple Menu instances. + /// A ConfigFile holds mutiple Menu instances. /// - class SHELLANYTHING_EXPORT Configuration + class SHELLANYTHING_EXPORT ConfigFile { public: /// - /// A list of Configuration pointer. + /// A list of ConfigFile pointer. /// - typedef std::vector ConfigurationPtrList; + typedef std::vector ConfigFilePtrList; - Configuration(); - virtual ~Configuration(); + ConfigFile(); + virtual ~ConfigFile(); private: // Disable copy constructor and copy operator - Configuration(const Configuration&); - Configuration& operator=(const Configuration&); + ConfigFile(const ConfigFile&); + ConfigFile& operator=(const ConfigFile&); public: /// - /// Get the configuration pointer that is currently updating. + /// Get the ConfigFile pointer that is currently updating. /// - /// Returns the configuration pointer that is currently updating. Returns NULL if no configuration is updating. - static Configuration* GetUpdatingConfiguration(); + /// Returns the ConfigFile pointer that is currently updating. Returns NULL if no configuration is updating. + static ConfigFile* GetUpdatingConfigFile(); /// - /// Set the configuration pointer that is currently updating. + /// Set the ConfigFile pointer that is currently updating. /// - /// The current updating configuration - static void SetUpdatingConfiguration(Configuration* configuration); + /// The current updating ConfigFile + static void SetUpdatingConfigFile(ConfigFile* config_file); /// - /// Load a configuration file. + /// Load a Configuration File. /// /// The file path to load /// The error desription if the file cannot be loaded. /// Returns a valid Configuration pointer if the file can be loaded. Returns NULL otherwise. - static Configuration* LoadFile(const std::string& path, std::string& error); + static ConfigFile* LoadFile(const std::string& path, std::string& error); /// - /// Detect if a given file is a valid configuration file. + /// Detect if a given file is a valid Configuration File. /// /// The file path to load - /// Returns true if the file is a valid configuration file. Returns false otherwise. + /// Returns true if the file is a valid Configuration File. Returns false otherwise. static bool IsValidConfigFile(const std::string& path); /// - /// Returns the file path of this configuration. + /// Returns the file path of this ConfigFile. /// const std::string& GetFilePath() const; /// - /// Set the file path of this configuration. + /// Set the file path of this ConfigFile. /// void SetFilePath(const std::string& file_path); @@ -166,7 +166,7 @@ namespace shellanything const DefaultSettings* GetDefaultSettings() const; /// - /// Add a Menu to this Configuration. The Configuration takes ownership of the Menu. + /// Add a Menu to this ConfigFile. The ConfigFile takes ownership of the Menu. /// /// The Menu to add. void AddMenu(Menu* menu); diff --git a/src/core/ConfigManager.cpp b/src/core/ConfigManager.cpp index 350521c6..fea5d80e 100644 --- a/src/core/ConfigManager.cpp +++ b/src/core/ConfigManager.cpp @@ -59,10 +59,10 @@ namespace shellanything SA_LOG(INFO) << __FUNCTION__ << "()"; //validate existing configurations - Configuration::ConfigurationPtrList existing = GetConfigurations(); + ConfigFile::ConfigFilePtrList existing = GetConfigFiles(); for (size_t i = 0; i < existing.size(); i++) { - Configuration* config = existing[i]; + ConfigFile* config = existing[i]; //compare the file's date at the load time and the current date const std::string& file_path = config->GetFilePath(); @@ -98,7 +98,7 @@ namespace shellanything for (size_t j = 0; j < files.size(); j++) { const std::string& file_path = files[j]; - if (Configuration::IsValidConfigFile(file_path)) + if (ConfigFile::IsValidConfigFile(file_path)) { //is this file already loaded ? if (!IsConfigFileLoaded(file_path)) @@ -107,7 +107,7 @@ namespace shellanything //parse the file std::string error; - Configuration* config = Configuration::LoadFile(file_path, error); + ConfigFile* config = ConfigFile::LoadFile(file_path, error); if (config == NULL) { //log an error message @@ -140,10 +140,10 @@ namespace shellanything void ConfigManager::Update(const SelectionContext& context) { //for each child - Configuration::ConfigurationPtrList configurations = ConfigManager::GetConfigurations(); + ConfigFile::ConfigFilePtrList configurations = ConfigManager::GetConfigFiles(); for (size_t i = 0; i < configurations.size(); i++) { - Configuration* config = configurations[i]; + ConfigFile* config = configurations[i]; config->Update(context); } } @@ -151,10 +151,10 @@ namespace shellanything Menu* ConfigManager::FindMenuByCommandId(const uint32_t& command_id) { //for each child - Configuration::ConfigurationPtrList configurations = ConfigManager::GetConfigurations(); + ConfigFile::ConfigFilePtrList configurations = ConfigManager::GetConfigFiles(); for (size_t i = 0; i < configurations.size(); i++) { - Configuration* config = configurations[i]; + ConfigFile* config = configurations[i]; Menu* match = config->FindMenuByCommandId(command_id); if (match) return match; @@ -166,10 +166,10 @@ namespace shellanything Menu* ConfigManager::FindMenuByName(const std::string& name, FIND_BY_NAME_FLAGS flags) { //for each child - Configuration::ConfigurationPtrList configurations = ConfigManager::GetConfigurations(); + ConfigFile::ConfigFilePtrList configurations = ConfigManager::GetConfigFiles(); for (size_t i = 0; i < configurations.size(); i++) { - Configuration* config = configurations[i]; + ConfigFile* config = configurations[i]; Menu* match = config->FindMenuByName(name, flags); if (match) return match; @@ -184,17 +184,17 @@ namespace shellanything uint32_t nextCommandId = first_command_id; //for each child - Configuration::ConfigurationPtrList configurations = ConfigManager::GetConfigurations(); + ConfigFile::ConfigFilePtrList configurations = ConfigManager::GetConfigFiles(); for (size_t i = 0; i < configurations.size(); i++) { - Configuration* config = configurations[i]; + ConfigFile* config = configurations[i]; nextCommandId = config->AssignCommandIds(nextCommandId); } return nextCommandId; } - Configuration::ConfigurationPtrList ConfigManager::GetConfigurations() + ConfigFile::ConfigFilePtrList ConfigManager::GetConfigFiles() { return mConfigurations; } @@ -213,7 +213,7 @@ namespace shellanything { for (size_t i = 0; i < mConfigurations.size(); i++) { - const Configuration* config = mConfigurations[i]; + const ConfigFile* config = mConfigurations[i]; if (config != NULL && config->GetFilePath() == path) return true; } @@ -225,13 +225,13 @@ namespace shellanything // delete configurations for (size_t i = 0; i < mConfigurations.size(); i++) { - Configuration* config = mConfigurations[i]; + ConfigFile* config = mConfigurations[i]; delete config; } mConfigurations.clear(); } - void ConfigManager::DeleteChild(Configuration* config) + void ConfigManager::DeleteChild(ConfigFile* config) { mConfigurations.erase(std::find(mConfigurations.begin(), mConfigurations.end(), config)); delete config; diff --git a/src/core/ConfigManager.h b/src/core/ConfigManager.h index 550eb3be..1c2b1df0 100644 --- a/src/core/ConfigManager.h +++ b/src/core/ConfigManager.h @@ -28,7 +28,7 @@ #include "shellanything/export.h" #include "shellanything/config.h" #include "StringList.h" -#include "Configuration.h" +#include "ConfigFile.h" #include "SelectionContext.h" #include "Enums.h" @@ -36,7 +36,7 @@ namespace shellanything { /// - /// The ConfigManager holds mutiple Configuration instances. + /// The ConfigManager holds mutiple ConfigFile instances. /// class SHELLANYTHING_EXPORT ConfigManager { @@ -53,15 +53,15 @@ namespace shellanything static ConfigManager& GetInstance(); /// - /// Get the list of Configuration pointers handled by the manager + /// Get the list of ConfigFile pointers handled by the manager /// - Configuration::ConfigurationPtrList GetConfigurations(); + ConfigFile::ConfigFilePtrList GetConfigFiles(); /// - /// Returns true if the given path is a Configuration loaded by the manager. + /// Returns true if the given path is a ConfigFile loaded by the manager. /// /// The path of a Configuration file - /// Returns true if the given path is a Configuration loaded by the manager. Returns false otherwise. + /// Returns true if the given path is a ConfigFile loaded by the manager. Returns false otherwise. bool IsConfigFileLoaded(const std::string& path) const; /// @@ -119,11 +119,11 @@ namespace shellanything private: //methods void DeleteChildren(); - void DeleteChild(Configuration* config); + void DeleteChild(ConfigFile* config); //attributes StringList mPaths; - Configuration::ConfigurationPtrList mConfigurations; + ConfigFile::ConfigFilePtrList mConfigurations; }; } //namespace shellanything diff --git a/src/core/DefaultSettings.h b/src/core/DefaultSettings.h index 83eea5c3..587bae14 100644 --- a/src/core/DefaultSettings.h +++ b/src/core/DefaultSettings.h @@ -33,7 +33,7 @@ namespace shellanything { /// - /// The DefaultSettings class defines the default values when a configuration . + /// The DefaultSettings class defines the default values for a ConfigFile. /// class SHELLANYTHING_EXPORT DefaultSettings { diff --git a/src/core/Menu.cpp b/src/core/Menu.cpp index d90e8fd7..479d09e4 100644 --- a/src/core/Menu.cpp +++ b/src/core/Menu.cpp @@ -35,7 +35,7 @@ namespace shellanything Menu::Menu() : mParentMenu(NULL), - mParentConfiguration(NULL), + mParentConfigFile(NULL), mNameMaxLength(DEFAULT_NAME_MAX_LENGTH), mSeparator(false), mColumnSeparator(false), @@ -95,19 +95,19 @@ namespace shellanything mParentMenu = menu; } - Configuration* Menu::GetParentConfiguration() + ConfigFile* Menu::GetParentConfigFile() { - return mParentConfiguration; + return mParentConfigFile; } - const Configuration* Menu::GetParentConfiguration() const + const ConfigFile* Menu::GetParentConfigFile() const { - return mParentConfiguration; + return mParentConfigFile; } - void Menu::SetParentConfiguration(Configuration* configuration) + void Menu::SetParentConfigFile(ConfigFile* config_file) { - mParentConfiguration = configuration; + mParentConfigFile = config_file; } bool Menu::IsSeparator() const diff --git a/src/core/Menu.h b/src/core/Menu.h index 71dcf26f..ac9d7f31 100644 --- a/src/core/Menu.h +++ b/src/core/Menu.h @@ -38,7 +38,7 @@ namespace shellanything { - class Configuration; // For Set/GetParentConfiguration() + class ConfigFile; // For Set/GetParentConfiguration() /// /// The Menu class defines a displayed menu option. @@ -85,17 +85,17 @@ namespace shellanything void SetParentMenu(Menu* menu); /// - /// Get the parent configuration. + /// Get the parent ConfigFile. /// - /// Returns a pointer to the parent configuration. Returns NULL if the object has no parent configuration. - Configuration* GetParentConfiguration(); - const Configuration* GetParentConfiguration() const; + /// Returns a pointer to the parent ConfigFile. Returns NULL if the object has no parent ConfigFile. + ConfigFile* GetParentConfigFile(); + const ConfigFile* GetParentConfigFile() const; /// - /// Set the parent configuration. + /// Set the parent ConfigFile. /// - /// The parent of this menu - void SetParentConfiguration(Configuration* configuration); + /// The parent of this menu + void SetParentConfigFile(ConfigFile* config_file); /// /// Returns true of the menu is a separator. @@ -298,7 +298,7 @@ namespace shellanything private: Menu* mParentMenu; - Configuration* mParentConfiguration; + ConfigFile* mParentConfigFile; Icon mIcon; Validator::ValidatorPtrList mValidities; Validator::ValidatorPtrList mVisibilities; diff --git a/src/core/ObjectFactory.cpp b/src/core/ObjectFactory.cpp index 69d8f984..09bcdd40 100644 --- a/src/core/ObjectFactory.cpp +++ b/src/core/ObjectFactory.cpp @@ -25,7 +25,7 @@ #include "ObjectFactory.h" #include "PropertyManager.h" -#include "Configuration.h" +#include "ConfigFile.h" #include "Menu.h" #include "Validator.h" #include "ActionClipboard.h" diff --git a/src/core/ObjectFactory.h b/src/core/ObjectFactory.h index 7da1b1d4..d587270a 100644 --- a/src/core/ObjectFactory.h +++ b/src/core/ObjectFactory.h @@ -30,7 +30,7 @@ #include "Menu.h" #include "IAction.h" #include "Icon.h" -#include "Configuration.h" +#include "ConfigFile.h" #include "Validator.h" #include "DefaultSettings.h" #include "Plugin.h" diff --git a/src/core/Plugin.cpp b/src/core/Plugin.cpp index 870f179b..cfa7f0c4 100644 --- a/src/core/Plugin.cpp +++ b/src/core/Plugin.cpp @@ -59,7 +59,7 @@ namespace shellanything } Plugin::Plugin() : - mParentConfiguration(NULL), + mParentConfigFile(NULL), mLoaded(false), mEntryPoints(new Plugin::ENTRY_POINTS) { @@ -97,19 +97,19 @@ namespace shellanything return (*this); } - Configuration* Plugin::GetParentConfiguration() + ConfigFile* Plugin::GetParentConfigFile() { - return mParentConfiguration; + return mParentConfigFile; } - const Configuration* Plugin::GetParentConfiguration() const + const ConfigFile* Plugin::GetParentConfigFile() const { - return mParentConfiguration; + return mParentConfigFile; } - void Plugin::SetParentConfiguration(Configuration* configuration) + void Plugin::SetParentConfigFile(ConfigFile* config_file) { - mParentConfiguration = configuration; + mParentConfigFile = config_file; } const std::string& Plugin::GetPath() const diff --git a/src/core/Plugin.h b/src/core/Plugin.h index ff87bc5e..75875bcd 100644 --- a/src/core/Plugin.h +++ b/src/core/Plugin.h @@ -34,7 +34,7 @@ namespace shellanything { - class Configuration; // For Set/GetParentConfiguration() + class ConfigFile; // For Set/GetParentConfiguration() /// /// A Plugin class holds a list of plugin features. @@ -58,17 +58,17 @@ namespace shellanything virtual ~Plugin(); /// - /// Get the parent configuration. + /// Get the parent ConfigFile. /// - /// Returns a pointer to the parent configuration. Returns NULL if the object has no parent configuration. - virtual Configuration* GetParentConfiguration(); - virtual const Configuration* GetParentConfiguration() const; + /// Returns a pointer to the parent ConfigFile. Returns NULL if the object has no parent ConfigFile. + virtual ConfigFile* GetParentConfigFile(); + virtual const ConfigFile* GetParentConfigFile() const; /// - /// Set the parent configuration. + /// Set the parent ConfigFile. /// - /// The parent configuration of this object - virtual void SetParentConfiguration(Configuration* configuration); + /// The parent ConfigFile of this object + virtual void SetParentConfigFile(ConfigFile* config_file); /// /// Copy operator @@ -170,7 +170,7 @@ namespace shellanything static Plugin* FindPluginByActionName(const PluginPtrList& plugins, const std::string& name); private: - Configuration* mParentConfiguration; + ConfigFile* mParentConfigFile; std::string mPath; std::string mDescription; diff --git a/src/core/Validator.cpp b/src/core/Validator.cpp index 23b31898..e01c3998 100644 --- a/src/core/Validator.cpp +++ b/src/core/Validator.cpp @@ -27,7 +27,7 @@ #include #include "Validator.h" #include "PropertyManager.h" -#include "Configuration.h" +#include "ConfigFile.h" #include "DriveClass.h" #include "Wildcard.h" #include "LoggerHelper.h" @@ -410,8 +410,8 @@ namespace shellanything return false; } - //check if we are updating a Configuration. - Configuration* updating_config = Configuration::GetUpdatingConfiguration(); + //check if we are updating a ConfigFile. + ConfigFile* updating_config = ConfigFile::GetUpdatingConfigFile(); if (updating_config != NULL) { const Plugin::PluginPtrList& config_plugins = updating_config->GetPlugins(); diff --git a/src/shellextension/CContextMenu.cpp b/src/shellextension/CContextMenu.cpp index b40652fe..cc56e09f 100644 --- a/src/shellextension/CContextMenu.cpp +++ b/src/shellextension/CContextMenu.cpp @@ -271,11 +271,11 @@ void CContextMenu::BuildMenuTree(HMENU hMenu) //for each configuration shellanything::ConfigManager& cmgr = shellanything::ConfigManager::GetInstance(); - shellanything::Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + shellanything::ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); UINT insert_pos = 0; for (size_t i = 0; i < configs.size(); i++) { - shellanything::Configuration* config = configs[i]; + shellanything::ConfigFile* config = configs[i]; if (config) { //for each menu child diff --git a/src/tests/QuickLoader.cpp b/src/tests/QuickLoader.cpp index ccf657ed..2df0664d 100644 --- a/src/tests/QuickLoader.cpp +++ b/src/tests/QuickLoader.cpp @@ -77,7 +77,7 @@ namespace shellanything const std::string& file_path = files[i]; // Is that a Configuration File? - if (Configuration::IsValidConfigFile(file_path)) + if (ConfigFile::IsValidConfigFile(file_path)) { // Yes, delete it bool deleted = ra::filesystem::DeleteFileUtf8(file_path.c_str()); @@ -93,13 +93,13 @@ namespace shellanything cmgr.Refresh(); //Check that no files from the wprkspace are loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); size_t loaded_count = configs.size(); if (loaded_count > 0) { for (size_t i = 0; i < loaded_count; i++) { - Configuration* config = configs[i]; + ConfigFile* config = configs[i]; const std::string & config_file_path = config->GetFilePath(); if (config_file_path.find(workspace_dir) != std::string::npos) { @@ -147,7 +147,7 @@ namespace shellanything cmgr.Refresh(); //Check the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); size_t count = configs.size(); return (count == 1); diff --git a/src/tests/TestActionExecute.cpp b/src/tests/TestActionExecute.cpp index 6d76a2bb..d4c0375c 100644 --- a/src/tests/TestActionExecute.cpp +++ b/src/tests/TestActionExecute.cpp @@ -306,7 +306,7 @@ namespace shellanything ASSERT_TRUE(loader.LoadCurrentTestConfigurationFile()); //Get first menu. - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); Menu::MenuPtrList menus = configs[0]->GetMenus(); ASSERT_EQ(1, menus.size()); @@ -351,7 +351,7 @@ namespace shellanything ASSERT_TRUE(loader.LoadCurrentTestConfigurationFile()); //Get first menu. - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); Menu::MenuPtrList menus = configs[0]->GetMenus(); ASSERT_EQ(1, menus.size()); diff --git a/src/tests/TestActionProperty.cpp b/src/tests/TestActionProperty.cpp index ad14f5d5..9f078034 100644 --- a/src/tests/TestActionProperty.cpp +++ b/src/tests/TestActionProperty.cpp @@ -596,11 +596,11 @@ namespace shellanything ASSERT_TRUE(loader.LoadCurrentTestConfigurationFile()); //Get all menus. - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //ASSERT a single menu is available - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_GT(menus.size(), 1); //Clear properties diff --git a/src/tests/TestConfigManager.cpp b/src/tests/TestConfigManager.cpp index e6ef1a9a..2950c257 100644 --- a/src/tests/TestConfigManager.cpp +++ b/src/tests/TestConfigManager.cpp @@ -38,7 +38,7 @@ namespace shellanything { namespace test { - static const Configuration* INVALID_CONFIGURATION = NULL; + static const ConfigFile* INVALID_CONFIGURATION = NULL; const char* ToBooleanString(bool value) { @@ -90,7 +90,7 @@ namespace shellanything } } - void QueryAllMenusRecursive(Configuration* config, Menu::MenuPtrList& list) + void QueryAllMenusRecursive(ConfigFile* config, Menu::MenuPtrList& list) { if (config == NULL) return; @@ -116,7 +116,7 @@ namespace shellanything return m; } - Menu* QuerySubMenu(Configuration* config, size_t index) + Menu* QuerySubMenu(ConfigFile* config, size_t index) { if (config == NULL) return NULL; @@ -137,10 +137,10 @@ namespace shellanything cmgr.Refresh(); //Delete the source file of all remaining Configuration instance - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); for (size_t i = 0; i < configs.size(); i++) { - Configuration* config = configs[i]; + ConfigFile* config = configs[i]; if (config) { const std::string& file_path = config->GetFilePath(); @@ -152,7 +152,7 @@ namespace shellanything cmgr.Refresh(); //ASSERT that no files are loaded - ASSERT_EQ(0, cmgr.GetConfigurations().size()); + ASSERT_EQ(0, cmgr.GetConfigFiles().size()); } //-------------------------------------------------------------------------------------------------- void TestConfigManager::TearDown() @@ -182,11 +182,11 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //ASSERT a single menu is available - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(1, menus.size()); //Import another file into the workspace @@ -208,7 +208,7 @@ namespace shellanything cmgr.Refresh(); //ASSERT both file is loaded - configs = cmgr.GetConfigurations(); + configs = cmgr.GetConfigFiles(); ASSERT_EQ(2, configs.size()); //Cleanup @@ -238,11 +238,11 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //ASSERT a single menu is available - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(1, menus.size()); //Inject another menu in the loaded xml file @@ -272,11 +272,11 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - configs = cmgr.GetConfigurations(); + configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //ASSERT 2 menus is available - menus = cmgr.GetConfigurations()[0]->GetMenus(); + menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(2, menus.size()); //Cleanup @@ -309,7 +309,7 @@ namespace shellanything cmgr.Refresh(); //ASSERT the files are loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(2, configs.size()); //Assign unique command ids @@ -340,7 +340,7 @@ namespace shellanything const std::string path = "configurations/default.xml"; std::string error_message = ra::testing::GetTestQualifiedName(); //init error message to an unexpected string - Configuration* config = Configuration::LoadFile(path, error_message); + ConfigFile* config = ConfigFile::LoadFile(path, error_message); ASSERT_TRUE(error_message.empty()) << "error_message=" << error_message; ASSERT_NE(INVALID_CONFIGURATION, config); @@ -392,14 +392,14 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //act cmgr.Clear(); //ASSERT nothing is loaded - configs = cmgr.GetConfigurations(); + configs = cmgr.GetConfigFiles(); ASSERT_EQ(0, configs.size()); //Cleanup @@ -430,7 +430,7 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //Query first menu @@ -495,7 +495,7 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //Query all menus diff --git a/src/tests/TestConfiguration.cpp b/src/tests/TestConfiguration.cpp index f183a339..e8b1ec5a 100644 --- a/src/tests/TestConfiguration.cpp +++ b/src/tests/TestConfiguration.cpp @@ -25,7 +25,7 @@ #include "TestConfiguration.h" #include "Workspace.h" #include "ConfigManager.h" -#include "Configuration.h" +#include "ConfigFile.h" #include "Menu.h" #include "ActionExecute.h" @@ -39,7 +39,7 @@ namespace shellanything { namespace test { - static const Configuration* INVALID_CONFIGURATION = NULL; + static const ConfigFile* INVALID_CONFIGURATION = NULL; std::string BuildConfigurationFileWithEncoding(const std::string& encoding) { @@ -65,7 +65,7 @@ namespace shellanything TEST_F(TestConfiguration, testDefault) { //fake the implementation - Configuration* config = new Configuration(); + ConfigFile* config = new ConfigFile(); config->SetFilePath("C:\\Users\\MartyMcfly\\Documents\\ShellAnything\\default.xml"); // @@ -134,7 +134,7 @@ namespace shellanything { const std::string path = files[i]; ASSERT_TRUE(ra::filesystem::FileExists(path.c_str())) << "File '" << path.c_str() << "' is not found."; - ASSERT_TRUE(shellanything::Configuration::IsValidConfigFile(path)) << "The file '" << path.c_str() << "' is not a valid configuration file."; + ASSERT_TRUE(shellanything::ConfigFile::IsValidConfigFile(path)) << "The file '" << path.c_str() << "' is not a valid configuration file."; } } //-------------------------------------------------------------------------------------------------- @@ -148,14 +148,14 @@ namespace shellanything bool copied = ra::filesystem::CopyFileUtf8(source_path, target_path); ASSERT_TRUE(copied) << "Failed to copy file '" << source_path << "' to '" << target_path << "'."; - ASSERT_TRUE(shellanything::Configuration::IsValidConfigFile(target_path)) << "The file '" << target_path.c_str() << "' is not a valid configuration file."; + ASSERT_TRUE(shellanything::ConfigFile::IsValidConfigFile(target_path)) << "The file '" << target_path.c_str() << "' is not a valid configuration file."; } //-------------------------------------------------------------------------------------------------- TEST_F(TestConfiguration, testLoadFile) { const std::string path = "configurations/default.xml"; std::string error_message = ra::testing::GetTestQualifiedName(); //init error message to an unexpected string - Configuration* config = Configuration::LoadFile(path, error_message); + ConfigFile* config = ConfigFile::LoadFile(path, error_message); ASSERT_TRUE(error_message.empty()) << "error_message=" << error_message; ASSERT_NE(INVALID_CONFIGURATION, config); @@ -177,7 +177,7 @@ namespace shellanything ASSERT_TRUE(copied) << "Failed to copy file '" << source_path << "' to '" << target_path << "'."; std::string error_message = ra::testing::GetTestQualifiedName(); //init error message to an unexpected string - Configuration* config = Configuration::LoadFile(target_path, error_message); + ConfigFile* config = ConfigFile::LoadFile(target_path, error_message); ASSERT_TRUE(error_message.empty()) << "error_message=" << error_message; ASSERT_NE(INVALID_CONFIGURATION, config); @@ -213,7 +213,7 @@ namespace shellanything //load this config std::string error_message; - Configuration* config = Configuration::LoadFile(path, error_message); + ConfigFile* config = ConfigFile::LoadFile(path, error_message); //build error description message, if required std::string failure_desc; @@ -252,7 +252,7 @@ namespace shellanything //load this config std::string error_message; - Configuration* config = Configuration::LoadFile(path, error_message); + ConfigFile* config = ConfigFile::LoadFile(path, error_message); //build error description message, if required std::string failure_desc; @@ -294,7 +294,7 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //ASSERT that properties was applied diff --git a/src/tests/TestObjectFactory.cpp b/src/tests/TestObjectFactory.cpp index 3543c793..5b64f896 100644 --- a/src/tests/TestObjectFactory.cpp +++ b/src/tests/TestObjectFactory.cpp @@ -42,7 +42,7 @@ namespace shellanything { namespace test { - static const Configuration* INVALID_CONFIGURATION = NULL; + static const ConfigFile* INVALID_CONFIGURATION = NULL; //-------------------------------------------------------------------------------------------------- Menu* GetSafeSubMenu(Menu* menu, size_t index) @@ -176,10 +176,10 @@ namespace shellanything cmgr.Refresh(); //Delete the source file of all remaining Configuration instance - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); for (size_t i = 0; i < configs.size(); i++) { - Configuration* config = configs[i]; + ConfigFile* config = configs[i]; if (config) { const std::string& file_path = config->GetFilePath(); @@ -191,7 +191,7 @@ namespace shellanything cmgr.Refresh(); //ASSERT that no files are loaded - ASSERT_EQ(0, cmgr.GetConfigurations().size()); + ASSERT_EQ(0, cmgr.GetConfigFiles().size()); } //-------------------------------------------------------------------------------------------------- void TestObjectFactory::TearDown() @@ -222,11 +222,11 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //ASSERT all menus are available - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(15, menus.size()); //Assert tag properly parsed @@ -315,11 +315,11 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //ASSERT all 3 menus are available - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(3, menus.size()); //Assert all icons are valid @@ -369,11 +369,11 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //ASSERT all 5 menus are available - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(5, menus.size()); //Assert maxlength properly value for each menus @@ -411,11 +411,11 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //ASSERT all menus are available - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(6, menus.size()); //Assert all menus have a file element as the first action @@ -486,11 +486,11 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //ASSERT a 13 menus are available - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(13, menus.size()); //Assert all menus have a file element as the first action @@ -555,11 +555,11 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //ASSERT a 3 menus are available - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(4, menus.size()); //Assert all menus have a file element as the first action @@ -614,11 +614,11 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //ASSERT a multiple menus are available - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(5, menus.size()); //Assert all menus have a prompt element as the first action @@ -691,11 +691,11 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //ASSERT a multiple menus are available - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(6, menus.size()); //Assert all menus have a property element as the first action @@ -770,11 +770,11 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //ASSERT a multiple menus are available - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(4, menus.size()); //Assert all menus have a message element as the first action @@ -837,11 +837,11 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //ASSERT a DefaultSettings section is available - const DefaultSettings* defaults = cmgr.GetConfigurations()[0]->GetDefaultSettings(); + const DefaultSettings* defaults = cmgr.GetConfigFiles()[0]->GetDefaultSettings(); ASSERT_TRUE(defaults != NULL); //Assert 2 properties parsed @@ -885,11 +885,11 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //ASSERT 2 plugins parsed - const Plugin::PluginPtrList& plugins = cmgr.GetConfigurations()[0]->GetPlugins(); + const Plugin::PluginPtrList& plugins = cmgr.GetConfigFiles()[0]->GetPlugins(); ASSERT_EQ(3, plugins.size()); const Plugin* plugin1 = plugins[0]; @@ -909,7 +909,7 @@ namespace shellanything ASSERT_EQ(std::string("email"), plugin3->GetActions()); //Get first visibility. - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(1, menus.size()); Menu* menu0 = menus[0]; ASSERT_TRUE(menu0 != NULL); @@ -951,11 +951,11 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //ASSERT a multiple menus are available - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(6, menus.size()); //Assert the following menus are separators @@ -1002,11 +1002,11 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); //ASSERT a root menus are available - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(2, menus.size()); Menu* menu_opt1 = menus[0]; @@ -1041,9 +1041,9 @@ namespace shellanything ASSERT_TRUE(action1 != NULL); //ASSERT expected parent objects - ASSERT_EQ(NULL, menu_opt1_2_1_1->GetParentConfiguration()); + ASSERT_EQ(NULL, menu_opt1_2_1_1->GetParentConfigFile()); ASSERT_EQ(menu_opt1_2_1, menu_opt1_2_1_1->GetParentMenu()); - ASSERT_EQ(NULL, menu_opt1_2_1->GetParentConfiguration()); + ASSERT_EQ(NULL, menu_opt1_2_1->GetParentConfigFile()); ASSERT_EQ(menu_opt1_2, menu_opt1_2_1->GetParentMenu()); ASSERT_EQ(menu_opt1_2_1_1, validity0->GetParentMenu()); diff --git a/src/tests/TestPlugins.cpp b/src/tests/TestPlugins.cpp index 0ea82725..8104395b 100644 --- a/src/tests/TestPlugins.cpp +++ b/src/tests/TestPlugins.cpp @@ -39,7 +39,7 @@ namespace shellanything { namespace test { - static const Configuration* INVALID_CONFIGURATION = NULL; + static const ConfigFile* INVALID_CONFIGURATION = NULL; //-------------------------------------------------------------------------------------------------- void TestPlugins::SetUp() @@ -49,10 +49,10 @@ namespace shellanything cmgr.Refresh(); //Delete the source file of all remaining Configuration instance - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); for (size_t i = 0; i < configs.size(); i++) { - Configuration* config = configs[i]; + ConfigFile* config = configs[i]; if (config) { const std::string& file_path = config->GetFilePath(); @@ -64,7 +64,7 @@ namespace shellanything cmgr.Refresh(); //ASSERT that no files are loaded - ASSERT_EQ(0, cmgr.GetConfigurations().size()); + ASSERT_EQ(0, cmgr.GetConfigFiles().size()); } //-------------------------------------------------------------------------------------------------- void TestPlugins::TearDown() @@ -74,10 +74,10 @@ namespace shellanything cmgr.Refresh(); //Delete the source file of all remaining Configuration instance - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); for (size_t i = 0; i < configs.size(); i++) { - Configuration* config = configs[i]; + ConfigFile* config = configs[i]; if (config) { const std::string& file_path = config->GetFilePath(); @@ -90,7 +90,7 @@ namespace shellanything cmgr.Refresh(); //ASSERT that no files are loaded - ASSERT_EQ(0, cmgr.GetConfigurations().size()); + ASSERT_EQ(0, cmgr.GetConfigFiles().size()); } //-------------------------------------------------------------------------------------------------- TEST_F(TestPlugins, testProcess) @@ -117,10 +117,10 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); - Configuration* config0 = cmgr.GetConfigurations()[0]; + ConfigFile* config0 = cmgr.GetConfigFiles()[0]; //ASSERT all plugins were loaded for (size_t i = 0; i < config0->GetPlugins().size(); i++) @@ -130,7 +130,7 @@ namespace shellanything } //Get menus - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(4, menus.size()); Menu* menu0 = menus[0]; Menu* menu1 = menus[1]; @@ -264,10 +264,10 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); - Configuration* config0 = cmgr.GetConfigurations()[0]; + ConfigFile* config0 = cmgr.GetConfigFiles()[0]; //ASSERT all plugins were loaded for (size_t i = 0; i < config0->GetPlugins().size(); i++) @@ -277,7 +277,7 @@ namespace shellanything } //Get menus - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(1, menus.size()); Menu* menu0 = menus[0]; ASSERT_TRUE(menu0 != NULL); @@ -365,10 +365,10 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); - Configuration* config0 = cmgr.GetConfigurations()[0]; + ConfigFile* config0 = cmgr.GetConfigFiles()[0]; //ASSERT all plugins were loaded for (size_t i = 0; i < config0->GetPlugins().size(); i++) @@ -378,7 +378,7 @@ namespace shellanything } //Get menus - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(1, menus.size()); Menu* menu0 = menus[0]; ASSERT_TRUE(menu0 != NULL); @@ -495,10 +495,10 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); - Configuration* config0 = cmgr.GetConfigurations()[0]; + ConfigFile* config0 = cmgr.GetConfigFiles()[0]; //ASSERT all plugins were loaded for (size_t i = 0; i < config0->GetPlugins().size(); i++) @@ -508,7 +508,7 @@ namespace shellanything } //Get menus - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(4, menus.size()); Menu* menu0 = menus[0]; Menu* menu1 = menus[1]; @@ -580,10 +580,10 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); - Configuration* config0 = cmgr.GetConfigurations()[0]; + ConfigFile* config0 = cmgr.GetConfigFiles()[0]; //ASSERT all plugins were loaded for (size_t i = 0; i < config0->GetPlugins().size(); i++) @@ -593,7 +593,7 @@ namespace shellanything } //Get menus - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(1, menus.size()); Menu* menu0 = menus[0]; ASSERT_TRUE(menu0 != NULL); @@ -608,7 +608,7 @@ namespace shellanything cmgr.Refresh(); //ASSERT the configuration is unloaded - configs = cmgr.GetConfigurations(); + configs = cmgr.GetConfigFiles(); ASSERT_EQ(0, configs.size()); //ASSERT that plugin's property status was removed (during termination) @@ -657,10 +657,10 @@ namespace shellanything cmgr.Refresh(); //ASSERT the file is loaded - Configuration::ConfigurationPtrList configs = cmgr.GetConfigurations(); + ConfigFile::ConfigFilePtrList configs = cmgr.GetConfigFiles(); ASSERT_EQ(1, configs.size()); - Configuration* config0 = cmgr.GetConfigurations()[0]; + ConfigFile* config0 = cmgr.GetConfigFiles()[0]; //ASSERT all plugins were loaded for (size_t i = 0; i < config0->GetPlugins().size(); i++) @@ -670,7 +670,7 @@ namespace shellanything } //Get menus - Menu::MenuPtrList menus = cmgr.GetConfigurations()[0]->GetMenus(); + Menu::MenuPtrList menus = cmgr.GetConfigFiles()[0]->GetMenus(); ASSERT_EQ(1, menus.size()); Menu* menu0 = menus[0]; ASSERT_TRUE(menu0 != NULL); @@ -738,7 +738,7 @@ namespace shellanything cmgr.Refresh(); //assert the configuration is unloaded - configs = cmgr.GetConfigurations(); + configs = cmgr.GetConfigFiles(); ASSERT_EQ(0, configs.size()); //assert that all actions were "destroyed"