added LocalModDescription class and tests
This commit is contained in:
parent
c67a856284
commit
d752c322e1
18
LocalModDescription.cpp
Normal file
18
LocalModDescription.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "LocalModDescription.h"
|
||||
using namespace mmm;
|
||||
|
||||
LocalModDescription::LocalModDescription() {
|
||||
_remoteModlist = "";
|
||||
}
|
||||
|
||||
LocalModDescription::~LocalModDescription() {
|
||||
_remoteModlist = "";
|
||||
}
|
||||
|
||||
std::string LocalModDescription::getRemoteModlistName() {
|
||||
return _remoteModlist;
|
||||
}
|
||||
|
||||
void LocalModDescription::setRemoteModlistName(std::string remoteModlist) {
|
||||
_remoteModlist = remoteModlist;
|
||||
}
|
27
LocalModDescription.h
Normal file
27
LocalModDescription.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef _LOCALMODDESCRIPTION_H
|
||||
#define _LOCALMODDESCRIPTION_H
|
||||
#include "ModDescription.h"
|
||||
/// \file LocalModDescription.h
|
||||
/// \brief A class describing a mod in a local modlist.
|
||||
/// \author Phitherek_
|
||||
/// \date 2013
|
||||
/// \version 0.1-pre
|
||||
|
||||
/// \namespace mmm
|
||||
/// \brief A global namespace for 3m
|
||||
namespace mmm {
|
||||
/// \class LocalModDescription
|
||||
/// \brief A class describing a mod in a local modlist.
|
||||
class LocalModDescription: public ModDescription {
|
||||
private:
|
||||
std::string _remoteModlist;
|
||||
public:
|
||||
LocalModDescription(); ///< A constructor.
|
||||
~LocalModDescription(); ///< A destructor.
|
||||
std::string getRemoteModlistName(); ///< \brief A function returning remote modlist name.
|
||||
///< \return Remote modlist name.
|
||||
void setRemoteModlistName(std::string remoteModlist); ///< \brief A function setting remote modlist name.
|
||||
///< \param remoteModlist Remote modlist name
|
||||
};
|
||||
}
|
||||
#endif
|
8
OBJECTS
8
OBJECTS
@ -6,4 +6,10 @@ RepositoryModDescription: ModDescription + path (inheritance)
|
||||
RepositoryInfo: vector<RepositoryModDescription>
|
||||
ModListDescription: name, server, modlistPath
|
||||
ModInfoDescription: name, server, modinfoPath
|
||||
ModInfo: ModInfoDescription, vector<ModDescription>
|
||||
ModInfo: ModInfoDescription, vector<ModDescription>
|
||||
ParameterParser: actionList, argc, argv
|
||||
SyncAction
|
||||
InstallAction
|
||||
UpdateAction
|
||||
RemoveAction
|
||||
InfoAction
|
27
tests/LocalModDescriptionTest.cpp
Normal file
27
tests/LocalModDescriptionTest.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include "../LocalModDescription.h"
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
mmm::LocalModDescription md;
|
||||
md.setName("test");
|
||||
md.setDescription("Test ModDescription entry");
|
||||
md.setReleaseNr(1);
|
||||
md.setRemoteModlistName("test");
|
||||
md.setRepositoryType("archive");
|
||||
md.setRepositoryAddress("http://example.tld/mod.zip");
|
||||
md.insertDependency("test2");
|
||||
md.insertDependency("test3");
|
||||
cout << "Remote modlist name: " << md.getRemoteModlistName() << endl << "Name: " << md.getName() << endl << "Description: " << md.getDescription() << endl << "Release number: " << md.getReleaseNr() << endl << "Depends on: ";
|
||||
while(!md.dependenciesEnd()) {
|
||||
cout << md.getNextDependency() << " ";
|
||||
}
|
||||
cout << endl << "Dependencies again: ";
|
||||
md.resetDependencyIterator();
|
||||
while(!md.dependenciesEnd()) {
|
||||
cout << md.getNextDependency() << " ";
|
||||
}
|
||||
cout << endl << "Repository type: " << md.getRepositoryType() << endl << "Repository address: " << md.getRepositoryAddress() << endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -2,8 +2,10 @@ CXXFLAGS=-Wall
|
||||
all:
|
||||
${CXX} ${CXXFLAGS} -o ConfigFileTest ConfigFileTest.cpp ../ConfigFile.cpp ../3mExceptions.cpp
|
||||
${CXX} ${CXXFLAGS} -o ModDescriptionTest ModDescriptionTest.cpp ../ModDescription.cpp
|
||||
${CXX} ${CXXFLAGS} -o LocalModDescriptionTest LocalModDescriptionTest.cpp ../LocalModDescription.cpp ../ModDescription.cpp
|
||||
debug:
|
||||
${CXX} ${CXXFLAGS} -o ConfigFileTest ConfigFileTest.cpp ../ConfigFile.cpp ../3mExceptions.cpp -g
|
||||
${CXX} ${CXXFLAGS} -o ModDescriptionTest ModDescriptionTest.cpp ../ModDescription.cpp -g
|
||||
${CXX} ${CXXFLAGS} -o LocalModDescriptionTest LocalModDescriptionTest.cpp ../LocalModDescription.cpp ../ModDescription.cpp
|
||||
clean:
|
||||
rm -rf ConfigFileTest ModDescriptionTest
|
||||
rm -rf ConfigFileTest ModDescriptionTest LocalModDescriptionTest
|
||||
|
Loading…
x
Reference in New Issue
Block a user