中山大学2018年ソフトウェアエンジニアリング専門初級実訓

26858 ワード

以下は実訓コードで、AgendaServiceクラスまでです.UIに問題がありますが、通過したらもうやりません.
以下のコードは、2018年のソフトウェアエンジニアリング初級実習でMatrixの機械テストに合格できることを親測しています.
Userクラス
#include
#include"User.hpp"
using namespace std;

User::User(const std::string &t_userName, const std::string &t_userPassword,const std::string &t_userEmail, const std::string &t_userPhone){
	this->m_name=t_userName;
	this->m_password=t_userPassword;
	this->m_email=t_userEmail;
	this->m_phone=t_userPhone;
}
User::User(const User &t_user){
	this->m_name=t_user.m_name;
	this->m_password=t_user.m_password;
	this->m_email=t_user.m_email;
	this->m_phone=t_user.m_phone;
}
std::string User::getName()const{
	return this->m_name;
}
void User::setName(const std::string &t_name){
	this->m_name=t_name;
}
std::string User::getPassword() const{
	return this->m_password;
}
void User::setPassword(const std::string &t_password){
	this->m_password=t_password;
}
std::string User::getEmail() const{
	return this->m_email;
}
void User::setEmail(const std::string &t_email){
	this->m_email=t_email;
}
std::string User::getPhone() const{
	return this->m_phone;
}
void User::setPhone(const std::string &t_phone){
	this->m_phone=t_phone;
}

Dateクラス
#include
#include"Date.hpp"
using namespace std;
Date::Date(){
	this->m_year=0;
	this->m_month=0;
	this->m_day=0;
	this->m_hour=0;
	this->m_minute=0;
}
Date::Date(int t_year, int t_month, int t_day, int t_hour, int t_minute){
	this->m_year=t_year;
	this->m_month=t_month;
	this->m_day=t_day;
	this->m_hour=t_hour;
	this->m_minute=t_minute;
}
Date::Date(const std::string &dateString){
	int year=0;
	int month=0;
	int day=0;
	int hour=0;
	int minute=0;
	bool v=true;
	if(dateString.size()!=16){
		this->m_year=0;
		this->m_month=0;
		this->m_day=0;
		this->m_hour=0;
		this->m_minute=0;
		v=false;
	}
	if(dateString[4]!='-'||dateString[7]!='-'||dateString[10]!='/'||dateString[13]!=':'){
		this->m_year=0;
		this->m_month=0;
		this->m_day=0;
		this->m_hour=0;
		this->m_minute=0;
		v=false;
	}
	for(int i=0;i<16;i++){
  		if(i==4||i==7||i==10||i==13){
  			
		}	
		else{
			if(dateString[i]'9'){
				this->m_year=0;
				this->m_month=0;
				this->m_day=0;
				this->m_hour=0;
				this->m_minute=0;
				v=false;
			}
		}
	}
	if(v){
		for(int i=0;i<4;i++){
			year=year*10+dateString[i]-'0';
		}
		for(int i=5;i<=6;i++){
			month=month*10+dateString[i]-'0';
		}
		for(int i=8;i<=9;i++){
			day=day*10+dateString[i]-'0';
		}
		for(int i=11;i<=12;i++){
			hour=hour*10+dateString[i]-'0';
		}
		for(int i=14;i<=15;i++){
			minute=minute*10+dateString[i]-'0';
		}
		this->m_year=year;
		this->m_month=month;
		this->m_day=day;
		this->m_hour=hour;
		this->m_minute=minute;
	}
}
int Date::getYear(void) const{
	return this->m_year;
}
void Date::setYear(const int t_year){
	this->m_year=t_year;
}
int Date::getMonth(void) const{
	return this->m_month;
}
void Date::setMonth(const int t_month){
	this->m_month=t_month;
}
int Date::getDay(void) const{
	return this->m_day;
}
void Date::setDay(const int t_day){
	this->m_day=t_day;
}
int Date::getHour(void) const{
	return this->m_hour;
}
void Date::setHour(const int t_hour){
	this->m_hour=t_hour;
}
int Date::getMinute(void) const{
	return this->m_minute;
}
void Date::setMinute(const int t_minute){
	this->m_minute=t_minute;
}
bool Date::isValid(const Date &t_date){
	if(t_date.getYear()<1000||t_date.getYear()>9999){
		return false;
	}
	if(t_date.getMonth()<1||t_date.getMonth()>12){
		return false;
	}
	if(t_date.getMonth()==1||t_date.getMonth()==3||t_date.getMonth()==5||t_date.getMonth()==7||t_date.getMonth()==8||t_date.getMonth()==10||t_date.getMonth()==12){
		if(t_date.getDay()<1||t_date.getDay()>31){
			return false;
		}
	}
	if(t_date.getMonth()==4||t_date.getMonth()==6||t_date.getMonth()==9||t_date.getMonth()==11){
		if(t_date.getDay()<1||t_date.getDay()>30){
			return false;
		}
	}
	if(t_date.getMonth()==2){
		if(t_date.getYear()%400==0||(t_date.getYear()%4==0&&t_date.getYear()%100!=0)){
			if(t_date.getDay()<1||t_date.getDay()>29){
				return false;
			}
		}
		else{
			if(t_date.getDay()<1||t_date.getDay()>28){
				return false;
			}
		}
	}
	if(t_date.getHour()<0||t_date.getHour()>23){
		return false;
	}
	if(t_date.getMinute()<0||t_date.getMinute()>59){
		return false;
	}
	return true;
}
 Date Date::stringToDate(const std::string &t_dateString){
	Date d=Date(0,0,0,0,0);
	int year=0;
	int month=0;
	int day=0;
	int hour=0;
	int minute=0;
	if(t_dateString.size()!=16){
		return d;
	}
	if(t_dateString[4]!='-'||t_dateString[7]!='-'||t_dateString[10]!='/'||t_dateString[13]!=':'){
		return d;
	}
	for(int i=0;i<16;i++){
		if(i==4||i==7||i==10||i==13){
			
		}
		else{
			if(t_dateString[i]'9'){
				return d;
			}
		}
	}
	Date d1(t_dateString);
	return d1;
}
string Date::dateToString(const Date& t_date){ 
	if(t_date.isValid(t_date) ==false){
    	string str1 = "0000-00-00/00:00";
    	return str1;
  	}
  	int year;
  	int month;
  	int day;
  	int hour;
  	int minute;
  	year=t_date.m_year;
  	month=t_date.m_month;
  	day=t_date.m_day;
  	hour=t_date.m_hour;
  	minute=t_date.m_minute;
  	string str;
  	str.push_back(year/1000+'0');
  	int three=year-(year/1000)*1000;
  	str.push_back(three/100+'0');
  	int two=three-(three/100)*100;
  	str.push_back(two/10+'0');
  	str.push_back(two%10+'0');
  	str.push_back('-');
  	str.push_back(month/10+'0');
  	str.push_back(month%10+'0');
  	str.push_back('-');
  	str.push_back(day/10+'0');
  	str.push_back(day%10+'0');
  	str.push_back('/');
  	str.push_back(hour/10+'0');
  	str.push_back(hour%10+'0');
  	str.push_back(':');
  	str.push_back(minute/10+'0');
 	str.push_back(minute%10+'0');
  	return str;
}
Date & Date::operator=(const Date &t_date){
	this->m_year=t_date.m_year;
	this->m_month=t_date.m_month;
	this->m_day=t_date.m_day;
	this->m_hour=t_date.m_hour;
	this->m_minute=t_date.m_minute;
	return (*this);
}
bool Date::operator==(const Date &t_date) const{
	if(this->m_year==t_date.m_year&&this->m_month==t_date.m_month&&this->m_day==t_date.m_day&&this->m_hour==t_date.m_hour&&this->m_minute==t_date.m_minute){
		return true;
	}
	else{
		return false;
	}
}
bool Date::operator>(const Date &t_date) const{
	if(this->m_year>t_date.m_year){
		return true;
	}
	else if(this->m_yearm_month>t_date.m_month){
			return true;
		}
		else if(this->m_monthm_day>t_date.m_day){
				return true;
			}
			else if(this->m_daym_hour>t_date.m_hour){
					return true;
				}
				else if(this->m_hourm_minute>t_date.m_minute){
						return true;
					}
					else if(this->m_minute<=t_date.m_minute){
						return false;
					}
				}
			}
		}
	}
}
bool Date::operatorm_yearm_year>t_date.m_year){
		return false;
	}
	else{
		if(this->m_monthm_month>t_date.m_month){
			return false;
		}
		else{
			if(this->m_daym_day>t_date.m_day){
				return false;
			}
			else{
				if(this->m_hourm_hour>t_date.m_hour){
					return false;
				}
				else{
					if(this->m_minutem_minute>=t_date.m_minute){
						return false;
					}
				}
			}
		}
	}
}

bool Date::operator>=(const Date &t_date) const{
	if((*this)>t_date||(*this)==t_date){
		return true;
	}
	else{
		return false;
	}
}
bool Date::operator<=(const Date &t_date) const{
	if((*this)

Meetingクラス
#include"Meeting.hpp"
using namespace std;
  Meeting::Meeting(const std::string &t_sponsor,const std::vector<:string> &t_participator, const Date &t_startTime,const Date &t_endTime, const std::string &t_title){
  	this->m_sponsor=t_sponsor;
  	this->m_participators=t_participator;
  	this->m_startDate=t_startTime;
  	this->m_endDate=t_endTime;
  	this->m_title=t_title;
  }
  Meeting::Meeting(const Meeting &t_meeting){
	this->m_sponsor=t_meeting.getSponsor();
  	this->m_participators=t_meeting.getParticipator();
  	this->m_startDate=t_meeting.getStartDate();
  	this->m_endDate=t_meeting.getEndDate();
  	this->m_title=t_meeting.getTitle();
  }
  std::string Meeting::getSponsor(void) const{
  		return this->m_sponsor;
  }
  void Meeting::setSponsor(const std::string &t_sponsor){
		this->m_sponsor=t_sponsor;
  }
  std::vector<:string> Meeting::getParticipator(void) const{
		return this->m_participators;
  }
  void Meeting::setParticipator(const std::vector<:string> &t_participators){
	  	this->m_participators=t_participators;
  }
  Date Meeting::getStartDate(void) const{
		return this->m_startDate;
  }
  void Meeting::setStartDate(const Date &t_startTime){
  		this->m_startDate=t_startTime;
  }
  Date Meeting::getEndDate(void) const{
		return this->m_endDate;
  }
  void Meeting::setEndDate(const Date &t_endTime){
		this->m_endDate=t_endTime;
  }
  std::string Meeting::getTitle(void) const{
		return this->m_title;
  }
  void Meeting::setTitle(const std::string &t_title){
  		this->m_title=t_title;
  }
  bool Meeting::isParticipator(const std::string &t_username) const{
  		int size=this->m_participators.size();
  		for(int i=0;im_participators[i]){
  				return true;
  			}
  		}
  		return false;
  }
  void Meeting::addParticipator(const std::string &t_participator){
     m_participators.push_back(t_participator);
  }

  void Meeting::removeParticipator(const std::string &t_participator){
    std::vector<:string> temp;
    int size=m_participators.size();
    for(int i=0;i

Storageクラス
#include "Storage.hpp"
#include "Path.hpp"
#include 
using namespace std;
std::shared_ptr Storage::m_instance = nullptr;
Storage::Storage() {
	m_dirty = false;
	readFromFile();
};
bool Storage::readFromFile(void) {
	ifstream fusers(Path::userPath);
	ifstream fmeetings(Path::meetingPath);
	if (!(fusers.is_open() && fmeetings.is_open())){
		return false;
	}
	string str1;
	while (getline(fusers, str1)) {
		string name, password, email, phone;
		if(str1.size() == 0) {
            continue;
        }
        int len=str1.size();
        vectorpos;
		for(int i = 0; i < len ; i++){
    		if(str1[i] == '"')
    		pos.push_back(i);
  		}
		for(int i = pos[0]+1 ; i < pos[1] ; i++){
			name.push_back(str1[i]);
		}	
   		for(int i = pos[2]+1 ; i < pos[3] ; i++){
   			password.push_back(str1[i]);
		}
   		for(int i = pos[4]+1 ; i < pos[5] ; i++){
   			email.push_back(str1[i]);
		}
   		for(int i = pos[6]+1 ; i < pos[7] ; i++){
   			phone.push_back(str1[i]);
		}
		User u(name, password, email, phone);
		m_userList.push_back(u);
	}
	fusers.close();
	string str2;
	while (getline(fmeetings, str2)) {
		string sponsor, participators, startDate, endDate, title;
		if(str2.size() == 0) {
                continue;
        }
		int len=str2.size();
		vector pos;
		for(int i = 0; i < len ; i++){
    		if(str2[i] == '"')
    		pos.push_back(i);
  		}
  			for(int i = pos[0]+1 ; i < pos[1] ; i++){
				sponsor.push_back(str2[i]);
			}
			for(int i = pos[2]+1 ; i < pos[3] ; i++){
				participators.push_back(str2[i]);
			}
    		for(int i = pos[4]+1 ; i < pos[5] ; i++){
				startDate.push_back(str2[i]);
			}	
    		for(int i = pos[6]+1 ; i < pos[7] ; i++){
				endDate.push_back(str2[i]);
			}
    		for(int i = pos[8]+1 ; i < pos[9] ; i++){
				title.push_back(str2[i]);
			}
		vector v_participators;
		int len2=participators.size();
		string parti;
		for(int i=0;i par = (*it).getParticipator();
       int len = par.size();
       for(int i = 0 ; i < len-1 ; i++){
         	fmeetings< Storage::getInstance(void) {
	if (m_instance == nullptr) {
		m_instance = shared_ptr(new Storage());
	}
	return m_instance;
};
Storage::~Storage() {
	sync();
};
void Storage::createUser(const User &t_user) {
	m_userList.push_back(t_user);
	m_dirty = true;
};
std::list Storage::queryUser(std::function filter) const {
	std::list result;
	for (auto it = m_userList.begin();it != m_userList.end();it++) {
		if (filter(*it)){
			result.push_back(*it);
		}
	}
	return result;
};
int Storage::updateUser(std::function filter,
             std::function switcher) {
	int num = 0;
	for (auto it = m_userList.begin();it != m_userList.end();it++) {
		if (filter(*it)) {
			switcher(*it);
			num++;
		}
	}
	if(num > 0){
		m_dirty = true;
	}
	return num;
};
int Storage::deleteUser(std::function filter) {
	int num = 0;
	for (auto it = m_userList.begin();it != m_userList.end();) {
		if (filter(*it)) {
			it = m_userList.erase(it);
			num++;
		}
		else{
			it++;
		}
	}
	if (num > 0){
		m_dirty = true;
	}
	return num;
};
void Storage::createMeeting(const Meeting &t_meeting) {
	m_meetingList.push_back(t_meeting);
	m_dirty = true;
};
std::list Storage::queryMeeting(
  std::function filter) const {
	list meeting;
	for (auto it = m_meetingList.begin();it != m_meetingList.end();it++) {
		if (filter(*it))
			meeting.push_back(*it);
	}
	return meeting;
};
int Storage::updateMeeting(std::function filter,
                std::function switcher) {
	int num = 0;
	for (auto it = m_meetingList.begin();it != m_meetingList.end();it++) {
		if (filter(*it)) {
			switcher(*it);
			num++;
		}
	}
	if (num > 0){
		m_dirty = true;
	}
	return num;
};
int Storage::deleteMeeting(std::function filter) {
	int num = 0;
	for (auto it = m_meetingList.begin();it != m_meetingList.end();) {
		if (filter(*it)) {
			it = m_meetingList.erase(it);
			num++;
		}
		else
			it++;
	}
	if (num > 0){
		m_dirty = true;
	}
	return num;
};
bool Storage::sync(void) {
	m_dirty = false;
	return writeToFile();
};

AgendaServiceクラス
#include
#include
#include
#include
#include"User.hpp"
#include"Date.hpp"
#include"Meeting.hpp"
#include"Storage.hpp"
#include"AgendaService.hpp" 
using namespace std;
AgendaService::AgendaService(){
	startAgenda();
}
AgendaService::~AgendaService(){
	quitAgenda();
}
bool AgendaService::userLogIn(const std::string &userName, const std::string &password){
	auto filter=[userName, password](const User &user) {//
        if(userName==user.getName()&&password==user.getPassword()){
        	return true;
		}
		else{
			return false;
		}
    };
    listtemp=m_storage->queryUser(filter);
    int size=temp.size();
    if(size>0){
    	return true;
	}
	else{
		return false;
	}
}
bool AgendaService::userRegister(const std::string &userName, const std::string &password,const std::string &email, const std::string &phone){
	User U(userName, password, email, phone);
	auto filter=[userName](const User &user) {
       if(user.getName()==userName){
       		return true;
	   }
	   else{
	   	return false;
	   }
    };
    list temp=m_storage->queryUser(filter);
    if(temp.empty()){
    	m_storage->createUser(U);
    	return true;
	}
	else{
		return false;
	}
}
bool AgendaService::deleteUser(const std::string &userName, const std::string &password){
	auto filter=[userName, password](const User &user) {
        if(userName==user.getName()&&password==user.getPassword()){
        	return true;
		}
		else{
			return false;
		}
    };
    deleteAllMeetings(userName);
     auto parlist=listAllParticipateMeetings(userName);
     for(auto it=parlist.begin();it!=parlist.end();it++){
     	quitMeeting(userName, it->getTitle());
	 }
    int num=m_storage->deleteUser(filter);
   	if(num>0){
   		return true;
	}
	else{
		return false;
	} 
}
std::list AgendaService::listAllUsers(void) const{
	auto filter=[](const User &user) {return true;};
	listtemp=m_storage->queryUser(filter);
    return temp;
}
bool AgendaService::addMeetingParticipator(const std::string &userName,const std::string &title,const std::string &participator){
    auto filter = [participator](const User& user) {
        if(user.getName()==participator){
           return true;
        }
        return false;
    };
    std::listU=m_storage->queryUser(filter);
    if(U.size()!=1){
   		return false;
    }
    auto filter1=[&](const Meeting & meeting){
        if(meeting.getSponsor()==userName&&meeting.getTitle()==title){
			std::listl=m_storage->queryMeeting( [&](const Meeting&meeting1){
        	if(meeting1.getSponsor()==participator||meeting1.isParticipator(participator)){
        		if(meeting.getStartDate()>=meeting1.getEndDate()||meeting.getEndDate()<=meeting1.getStartDate()){
        	   		return false;
       			}
       			else{
       				return true;
				}
      	  	}
      		return false;
        	});
			if(l.empty()){
        	   return true;
       		}
       		return false;
        }
        return false;
    };
    auto switcher=[participator](Meeting &meeting) {
        meeting.addParticipator(participator);	
    };
    int num=m_storage->updateMeeting(filter1, switcher);
    if(num>0){
     	return true;
	}
	else{
	 	return false;
	}
}
bool AgendaService::createMeeting(const std::string &userName, const std::string &title,const std::string &startDate, const std::string &endDate,const std::vector<:string> &participator){
	Date start(startDate);
	Date end(endDate);
	Meeting meeting(userName,participator,start,end,title);
	if (participator.empty()){
		return false;
	}
	if(start.isValid(start)==false||end.isValid(end)==false||start>=end){//
		return false;
	}
    bool have=false;
    listtemp=listAllUsers();
    for(auto it=temp.begin();it!=temp.end();it++){
    	if(userName==it->getName()){
    		have=true;
    		break;
		}
	}
	if(have==false){
		return false;
	}
	if (participator.empty()){
		return false;
	}
    auto filter=[title](const Meeting &meeting) {
        if(meeting.getTitle()==title){
        	return true;
		}
		else{
			return false;
		}
    };
    listtemp1=m_storage->queryMeeting(filter);
    if(temp1.empty()==false){
    	return false;
	}
    auto filter1=[userName](const Meeting &meeting) {
        if(userName==meeting.getSponsor()){
        	return true;
		}
		else{
			return false;
		}
    };
    listm=listAllMeetings(userName);
    for(auto it=m.begin();it!=m.end();it++){
		if(!(it->getEndDate()<=start||it->getStartDate()>= end)){
			 return false;
		}
	}
	vectorpar;
    Meeting meet(userName,par,start,end,title);
    m_storage->createMeeting(meet);
	for (auto it=participator.begin();it!=participator.end();it++){
		bool suc;
		suc=addMeetingParticipator(userName, title, *it);
    	if(suc==true){
    		par.push_back(*it);
		}
		else{
			m_storage->deleteMeeting(filter);
			return false;
		}
	}
	return true;
}
bool AgendaService::removeMeetingParticipator(const std::string &userName,const std::string &title,const std::string &participator){
	 if(userName==participator){
    	return false;
	} 
	auto filter=[userName](const User &u){
		if(u.getName()==userName){
			return true;
		}
		else{
			return false;
		}
	};
	auto filter1=[participator](const User &u){
		if(u.getName()==participator){
			return true;
		}
		else{
			return false;
		}
	};
	listu1=m_storage->queryUser(filter);
	listu2=m_storage->queryUser(filter1);
	if(u1.empty()||u2.empty()){
		return false;
	}
	auto filter2 = [userName, title](const Meeting &meeting) {
        if (meeting.getSponsor()==userName&&meeting.getTitle()==title){
        	return true;
		}
        else{
        	return false;
		}
    };
    listl=m_storage->queryMeeting(filter2);
    if(l.size()!=1){
    	return false;
	}
	Meeting m=*(l.begin());
	if(!m.isParticipator(participator)){
		return false;
	}
    auto switcher=[participator](Meeting &meeting) {
    	meeting.removeParticipator(participator);
    };
    
    int num=m_storage->updateMeeting(filter2, switcher);
    m_storage->deleteMeeting([](const Meeting &meeting){
    	return meeting.getParticipator().empty();
	});
    if(num>0){
   		return true;
    }
    else{
   		return false;
    }
}
bool AgendaService::quitMeeting(const std::string &userName, const std::string &title){
	auto filter=[userName, title](const Meeting &meeting){
     	if(meeting.isParticipator(userName)&&meeting.getTitle()==title){
     		return true;
	 	}
	 	else{
	 		return false;
	 	}
	};
	auto switcher=[userName](Meeting &meeting) {
        meeting.removeParticipator(userName);
    };
    int num=m_storage->updateMeeting(filter, switcher);
    auto filter1=[](const Meeting &meeting) {
        if(meeting.getParticipator().empty()){
        	return true;
		}
		else{
			return false;
		}
    };
    m_storage->deleteMeeting(filter1);
    if(num>0){
    	return true;
	}
	else{
		return false;
	}
}
std::list AgendaService::meetingQuery(const std::string &userName,const std::string &title) const{
	listl;
	listU=m_storage->queryUser([userName](const User&u){
		if(u.getName()==userName){
			return true;
		}
		else{
			return false;
		}
	});
	if(U.empty()){
		return l;
	}
	auto filter=[userName, title](const Meeting &meeting){
    	if((userName==meeting.getSponsor()||meeting.isParticipator(userName))&&title==meeting.getTitle()){
    		return true;
		}
		else{
			return false;
		}
	};
	listtemp=m_storage->queryMeeting(filter);
	return temp;
}
std::list AgendaService::meetingQuery(const std::string &userName,const std::string &startDate,const std::string &endDate) const{
	Date start(startDate);
	Date end(endDate);
	list temp;
	listl;
	if(start.isValid(start)==false||end.isValid(end)==false||start>end){//
		return temp;
	}
	listU=m_storage->queryUser([userName](const User&u){
		if(u.getName()==userName){
			return true;
		}
		else{
			return false;
		}
	});
	if(U.empty()){
		return l;
	}
	auto filter=[userName, start, end](const Meeting &meeting){
		if((meeting.getSponsor()==userName||meeting.isParticipator(userName))&&meeting.getEndDate()>=start&&meeting.getStartDate()<=end){
			return true;
		}
	 	else{
	 		return false;
	 	}
	};
	temp=m_storage->queryMeeting(filter);
	return temp;
}
std::list AgendaService::listAllMeetings(const std::string &userName) const{
	auto filter = [userName](const Meeting &meeting) {
        if(userName==meeting.getSponsor()||meeting.isParticipator(userName)){
        	return true;
		}
		else{
			return false;
		}
    };
    listtemp=m_storage->queryMeeting(filter);
    return temp;
}
std::list AgendaService::listAllSponsorMeetings(const std::string &userName) const{
 	auto filter=[userName](const Meeting &meeting) {
 			if(userName==meeting.getSponsor()){
 				return true;
			}
			else{
			 	return false;
			}
    };
    listtemp=m_storage->queryMeeting(filter);
    return temp;
}
std::list AgendaService::listAllParticipateMeetings(const std::string &userName) const{
	auto filter=[userName](const Meeting &meeting){
		if(meeting.isParticipator(userName)){
			return true;
		}
		else{
			return false;
		}
	};
	listtemp=m_storage->queryMeeting(filter);
    return temp;
}
bool AgendaService::deleteMeeting(const std::string &userName, const std::string &title){
	auto filter=[userName, title](const Meeting &meeting) {
       if(userName==meeting.getSponsor()&&title==meeting.getTitle()){
       		return true;
	   	}
	   	else{
	   		return false;	
		}
    };
    int num=m_storage->deleteMeeting(filter);
    if(num>0){
    	return true;
	}
	else{
		return false;
	}
}
bool AgendaService::deleteAllMeetings(const std::string &userName){
	auto filter=[userName](const Meeting &meeting) {
        if(userName==meeting.getSponsor()){
        	return true;
		}
		else{
			return false;
		}
    };
    int num=m_storage->deleteMeeting(filter);
    if(num>0){
    	return true;
	}
	else{
		return false;
	}
}
void AgendaService::startAgenda(void){
	m_storage=Storage::getInstance();
}
void AgendaService::quitAgenda(void){
	m_storage->sync();
}