From 899fc23801d2e6539c2ebff4c46aa18bb83d2880 Mon Sep 17 00:00:00 2001 From: Phitherek Date: Mon, 18 Mar 2013 22:10:48 +0100 Subject: [PATCH] started to write new 3m! First header file - ConfigFile.h --- ConfigFile.h | 33 +++++++++++++++++++++++++++++++++ IDEAS | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 ConfigFile.h diff --git a/ConfigFile.h b/ConfigFile.h new file mode 100644 index 0000000..00d034d --- /dev/null +++ b/ConfigFile.h @@ -0,0 +1,33 @@ +#ifndef _CONFIGFILE_H +#define _CONFIGFILE_H +#include +/// \file ConfigFile.h +/// \brief A class that parses and stores 3m configuration. +/// \author Phitherek_ +/// \date 2013 +/// \version 0.1-pre + +/// \namespace 3m +/// \brief A global namespace for 3m + +/// \class ConfigFile +/// \brief A class that parses and stores 3m configuration. +class ConfigFile { +private: + std::string _path; + std::string _localpath; + std::string _modlist; + std::string _repoinfo; +public: + ConfigFile(std::string path); ///< \brief A constructor from file path. + ///< Tries to open the config file and parse it. It throws FileException or ParseException. + /// \param path Path to the config file. + std::string& getLocalPath(); ///< \brief A function returning a reference to local 3m repository path (e. g. path to the Minetest mod directory) + /// \return Local 3m repository path. + std::string& getModList(); ///< \brief A function returning a reference to local modlist file path. + ///< \return A reference to local modlist file path. + std::string& getRepoInfo(); ///< \brief A function returning a reference to local repoinfo file path. + ///< \return A reference to local repoinfo file path + void write(); ///< A function that writes the changes to config file. +}; +} diff --git a/IDEAS b/IDEAS index 7a55901..7d7b934 100644 --- a/IDEAS +++ b/IDEAS @@ -57,3 +57,40 @@ Settings: path_to_local_minetest_mods_repo [modlist] path_to_modlist_3mml +--- +NEW 3m: +1. Use my NetSocket++ library: +https://github.com/Phitherek/NetSocket-- +http://www.phitherek.mooo.com/doxy/libnetsocketpp +This will spare a lot of socket code and shrink the code. +2. Classes: +ModListData +LocalModListData +RemoteModListData +RepoInfoData +RemoteModInfo +ModList +ActionList +And every one of these in separate .cpp and .h file. +Content of the classes like in structs. ++ methods: +clear() +parse() (for some) +get() (for some) +3. Untouched functions: +strip_endl(); +4. Exceptions: +Handlers for NetSocket++ exceptions. ++ +ParseException +ExtractException +DownloadException +FileException +... and everything that somehow will be needed in the process. +5. APIs rather than external programs: +There are so many C++ libraries that I think I should find ones for 7z (p7zip) and wget (or something similar) - it is always better than executing programs by "system". +6. Rewrite +3m must be rewritten in separate branch with the use of existing code. +7. Finish it finally +3m is not complete. Missing actions must be programmed. +