added ModDescription class
This commit is contained in:
parent
d6cc40453b
commit
4fcfd6787d
88
ModDescription.cpp
Normal file
88
ModDescription.cpp
Normal file
@ -0,0 +1,88 @@
|
||||
#include "ModDescription.h"
|
||||
using namespace mmm;
|
||||
|
||||
ModDescription::ModDescription() {
|
||||
_name = "";
|
||||
_description = "";
|
||||
_release = 0;
|
||||
_depsIterator = -1;
|
||||
_depsAtEnd = true;
|
||||
_repotype = "";
|
||||
_repoaddr = "";
|
||||
}
|
||||
|
||||
ModDescription::~ModDescription() {
|
||||
_name = "";
|
||||
_description = "";
|
||||
_release = 0;
|
||||
_deps.clear();
|
||||
_depsIterator = -1;
|
||||
_depsAtEnd = true;
|
||||
_repotype = "";
|
||||
_repoaddr = "";
|
||||
}
|
||||
|
||||
std::string ModDescription::getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
std::string ModDescription::getDescription() {
|
||||
return _description;
|
||||
}
|
||||
|
||||
int ModDescription::getReleaseNr() {
|
||||
return _release;
|
||||
}
|
||||
|
||||
std::string ModDescription::getNextDependency() {
|
||||
if(_depsIterator + 2 < _deps.size()) {
|
||||
_depsIterator++;
|
||||
return _deps[_depsIterator];
|
||||
} else {
|
||||
_depsAtEnd = true;
|
||||
return "getNextDependency failed...";
|
||||
}
|
||||
}
|
||||
|
||||
std::string ModDescription::getRepositoryType() {
|
||||
return _repotype;
|
||||
}
|
||||
|
||||
std::string ModDescription::getRepositoryAddress() {
|
||||
return _repoaddr;
|
||||
}
|
||||
|
||||
void ModDescription::setName(std::string name) {
|
||||
_name = name;
|
||||
}
|
||||
|
||||
void ModDescription::setDescription(std::string description) {
|
||||
_description = description;
|
||||
}
|
||||
|
||||
void ModDescription::setReleaseNr(int release) {
|
||||
_release = release;
|
||||
}
|
||||
|
||||
void ModDescription::insertDependency(std::string dep) {
|
||||
_deps.push_back(dep);
|
||||
if(_depsAtEnd == true) {
|
||||
_depsAtEnd = false;
|
||||
}
|
||||
}
|
||||
|
||||
void ModDescription::setRepositoryType(std::string repotype) {
|
||||
_repotype = repotype;
|
||||
}
|
||||
|
||||
void ModDescription::setRepositoryAddress(std::string repoaddr) {
|
||||
_repoaddr = repoaddr;
|
||||
}
|
||||
|
||||
void resetDependencyIterator() {
|
||||
_depsIterator = -1;
|
||||
}
|
||||
|
||||
bool dependenciesEnd() {
|
||||
return _depsAtEnd;
|
||||
}
|
58
ModDescription.h
Normal file
58
ModDescription.h
Normal file
@ -0,0 +1,58 @@
|
||||
#ifndef _MODDESCRIPTION_H
|
||||
#define _MODDESCRIPTION_H
|
||||
#include <string>
|
||||
#include <vector>
|
||||
/// \file ModDescription.h
|
||||
/// \brief A class describing a mod.
|
||||
/// \author Phitherek_
|
||||
/// \date 2013
|
||||
/// \version 0.1-pre
|
||||
|
||||
/// \namespace mmm
|
||||
/// \brief A global namespace for 3m
|
||||
namespace mmm }
|
||||
/// \class ModDescription
|
||||
/// \brief A class describing a mod.
|
||||
class ModDescription {
|
||||
protected:
|
||||
std::string _name; ///< A short name (ID) of the mod.
|
||||
std::string _description; ///< A short description of the mod.
|
||||
int _release; ///< Release of the 3m package.
|
||||
std::vector<std::string> _deps; ///< Mod dependency list.
|
||||
int _depsIterator; ///< Iterator for dependency list;
|
||||
bool _depsAtEnd; ///< A boolean indicating if depsIterator is at the end of the dependency list.
|
||||
std::string _repotype; ///< Mod repository type.
|
||||
std::string _repoaddr; ///< Mod repository address.
|
||||
public:
|
||||
ModDescription(); ///< A constructor.
|
||||
~ModDescription(); ///< A destructor.
|
||||
std::string getName(); ///< \brief A function returning mod name.
|
||||
///< \return Mod name.
|
||||
std::string getDescription(); ///< \brief A function returning mod description.
|
||||
///< \return Mod description.
|
||||
std::string getReleaseNr(); ///< \brief A function returning 3m package release number.
|
||||
///< \return 3m package release number.
|
||||
std::string getNextDependency(); ///< \brief A function returning next dependency from the dependency list.
|
||||
///< \return Next dependency from the dependency list.
|
||||
std::string getRepositoryType(); ///< \brief A function returning mod repository type.
|
||||
///< \return Mod repository type.
|
||||
std::string getRepositoryAddress(); ///< \brief A function returning mod repository address.
|
||||
///< \return Mod repository address.
|
||||
void setName(std::string name); ///< \brief Function setting mod name.
|
||||
///< \param name Mod name.
|
||||
void setDescription(std::string desc); ///< \brief Function setting mod description.
|
||||
///< \param desc Mod description.
|
||||
void setReleaseNr(int release); ///< \brief Function setting 3m package release number.
|
||||
///< \param release 3m package release number.
|
||||
void insertDependency(std::string dep); ///< \brief Function inserting a dependency to the dependency list.
|
||||
/// \param dep A dependency.
|
||||
void setRepositoryType(std::string repotype); ///< \brief Function setting mod repository type.
|
||||
///< \param repotype Mod repository type.
|
||||
void setRepositoryAddress(std::string repoaddr); ///< \brief Function setting mod repository address.
|
||||
///< \param repoaddr Mod repository address.
|
||||
void resetDependencyIterator(); ///< A function resetting the iterator of the dependency list.
|
||||
bool dependenciesEnd(); ///< \brief A function returning if dependency list is at its end.
|
||||
///< \return True if dependency list iterator reached its end, false otherwise.
|
||||
};
|
||||
}
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user