started to write new 3m! First header file - ConfigFile.h

master
Phitherek 2013-03-18 22:10:48 +01:00
parent 215862779c
commit 899fc23801
2 changed files with 70 additions and 0 deletions

33
ConfigFile.h Normal file
View File

@ -0,0 +1,33 @@
#ifndef _CONFIGFILE_H
#define _CONFIGFILE_H
#include <string>
/// \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.
};
}

37
IDEAS
View File

@ -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.