/**
// C++ Implementation: StringDate
//
// Description: 
//
//
// Author: Muylkens Toon <toon.muylkens@student.kuleuven.be>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
*/

#include "QStringDates.h"
// #include <stdio.h>
// #include <iostream>
// using namespace std;


StringDate::StringDate()
{
// 	this->datevalue = date;
// 	this->stringvalue= date.toString("dd.MM.yyyy");
}


StringDate::StringDate(QDate date)
{
	this->datevalue = date;
	this->stringvalue= date.toString("dd.MM.yyyy");
}

StringDate::StringDate(QString date)
{
	this->datevalue = QDate(getyear(date), getmonth(date), getday(date));
	this->stringvalue= date;
}
 
QString StringDate::getQString() const{
	return this->stringvalue;
}

QDate StringDate::getQDate() const{
	return this->datevalue;
}

void StringDate::addDays(int value){
	this->datevalue=datevalue.addDays(value);
	this->stringvalue=datevalue.toString("dd.MM.yyyy");
}

int StringDate::getday(QString date)
{
QStringList list = date.split(".");
return list.at(0).toInt();
}

int StringDate::getmonth(QString date)
{
QStringList list = date.split(".");
return list.at(1).toInt();
}

int StringDate::getyear(QString date)
{
QStringList list = date.split(".");
return list.at(2).toInt();
}


bool StringDate::operator<( const StringDate &s1 ) const{
return getQDate()<s1.getQDate();
}

bool StringDate::operator>( const StringDate &s1 ) const{
return getQDate()>s1.getQDate();
}


bool StringDate::operator<=( const StringDate &s1 ) const{
return getQDate()<=s1.getQDate();
}

bool StringDate::operator==( const StringDate &s1 ) const{
return getQDate()==s1.getQDate();
}