Update ParserClass
This commit is contained in:
parent
8a14c38655
commit
6fcf2131d3
4 changed files with 60 additions and 48 deletions
|
@ -1,39 +1,30 @@
|
|||
/**
|
||||
* @file AbstractFileContainer.hpp
|
||||
* @brief FileManContainer class definitions
|
||||
* @file AbstractIDManager.cpp
|
||||
* @brief AbstractIDManager class definitions
|
||||
* @author manzerbredes
|
||||
* @date 11 Mars 2015
|
||||
*
|
||||
* Contain all definitions of FileManContainer class.
|
||||
* Contain all implémentations of AbstractIDManager class.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __FileManContainer__
|
||||
#define __FileManContainer__
|
||||
#include "AbstractIDManager.hpp"
|
||||
|
||||
AbstractIDManager::AbstractIDManager(){
|
||||
this->id=this->generateId();
|
||||
}
|
||||
|
||||
void AbstractIDManager::setId(std::string id){
|
||||
this->id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @class Website Website.hpp "/ParserClass/FileManContainer/Website.hpp"
|
||||
* @brief Class for manager all FileMan container (websites etc...)
|
||||
* @author manzerbredes
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
std::string AbstractIDManager::generateId(){
|
||||
boost::uuids::uuid uuid = boost::uuids::random_generator()();
|
||||
std::stringstream ss;
|
||||
ss << uuid;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
class FileManContainer{
|
||||
|
||||
public:
|
||||
FileManContainer();
|
||||
|
||||
void addWebsite(Website website);
|
||||
std::vector<Website> getWebsites();
|
||||
|
||||
private:
|
||||
|
||||
std::vector<Website> websites;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
std::string AbstractIDManager::getId(){
|
||||
return this->id;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* @file AbstractIDManager.cpp
|
||||
* @brief AbstractIDManager class definitions
|
||||
* @author manzerbredes
|
||||
* @date 11 Mars 2015
|
||||
*
|
||||
* Contain all definitions of AbstractIDManager class.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <boost/uuid/uuid.hpp> // uuid class
|
||||
#include <boost/uuid/uuid_generators.hpp> // generators
|
||||
#include <boost/uuid/uuid_io.hpp> // streaming operators etc.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class AbstractIDManager{
|
||||
|
||||
|
||||
public:
|
||||
AbstractIDManager();
|
||||
|
||||
std::string getId();
|
||||
void setId(std::string id);
|
||||
|
||||
std::string generateId();
|
||||
|
||||
private:
|
||||
|
||||
std::string id;
|
||||
|
||||
};
|
|
@ -13,18 +13,13 @@
|
|||
|
||||
|
||||
Website::Website(){
|
||||
boost::uuids::uuid uuid = boost::uuids::random_generator()();
|
||||
std::stringstream ss;
|
||||
ss << uuid;
|
||||
this->id=ss.str();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
std::string Website::getId(){
|
||||
return this->id;
|
||||
}
|
||||
|
||||
std::string Website::getTitle(){
|
||||
return this->title;
|
||||
}
|
||||
|
@ -43,9 +38,7 @@ std::string Website::getDescription(){
|
|||
|
||||
|
||||
|
||||
void Website::setId(std::string id){
|
||||
this->id = id;
|
||||
}
|
||||
|
||||
void Website::setTitle(std::string title){
|
||||
this->title = title;
|
||||
}
|
||||
|
|
|
@ -27,12 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <boost/uuid/uuid.hpp> // uuid class
|
||||
#include <boost/uuid/uuid_generators.hpp> // generators
|
||||
#include <boost/uuid/uuid_io.hpp> // streaming operators etc.
|
||||
|
||||
|
||||
#include "AbstractIDManager.hpp"
|
||||
|
||||
/**
|
||||
* @class Website Website.hpp "/ParserClass/FileManContainer/Website.hpp"
|
||||
|
@ -42,7 +37,7 @@
|
|||
* Container for website data.
|
||||
*
|
||||
*/
|
||||
class Website{
|
||||
class Website : public AbstractIDManager {
|
||||
|
||||
|
||||
public:
|
||||
|
@ -53,7 +48,6 @@ class Website{
|
|||
* @brief Containner getters.
|
||||
*/
|
||||
|
||||
std::string getId();
|
||||
std::string getTitle();
|
||||
std::string getUrl();
|
||||
std::string getUsername();
|
||||
|
@ -64,7 +58,6 @@ class Website{
|
|||
/**
|
||||
* @brief Containner setters.
|
||||
*/
|
||||
void setId(std::string title);
|
||||
void setTitle(std::string title);
|
||||
void setUrl(std::string url);
|
||||
void setUsername(std::string username);
|
||||
|
@ -74,7 +67,6 @@ class Website{
|
|||
|
||||
private:
|
||||
|
||||
std::string id; ///< id of the website
|
||||
std::string title; ///< Title of the website
|
||||
std::string url; ///< Url of the website
|
||||
std::string username; ///< username of the account
|
||||
|
|
Loading…
Add table
Reference in a new issue