2019-11-05 14:47:55 +00:00
|
|
|
|
#ifndef __CODEVERSION_H__
|
|
|
|
|
#define __CODEVERSION_H__
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
#include "Memento.h"
|
|
|
|
|
|
2021-10-30 02:45:26 +00:00
|
|
|
|
// ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CodeVersion
|
2019-11-05 14:47:55 +00:00
|
|
|
|
class CodeVersion
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
CodeVersion(){
|
|
|
|
|
version = 0;
|
|
|
|
|
date = "1900-01-01";
|
|
|
|
|
label = "none";
|
|
|
|
|
}
|
|
|
|
|
CodeVersion(int iVersion, string iDate, string iLabel){
|
|
|
|
|
version = iVersion;
|
|
|
|
|
date = iDate;
|
|
|
|
|
label = iLabel;
|
|
|
|
|
}
|
2021-10-30 02:45:26 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2019-11-05 14:47:55 +00:00
|
|
|
|
Memento* save(){
|
|
|
|
|
return new Memento(this->version, this->date, this->label);
|
|
|
|
|
}
|
2021-10-30 02:45:26 +00:00
|
|
|
|
Memento *commit()
|
|
|
|
|
{
|
|
|
|
|
return new Memento(this->version, this->date, this->label);
|
|
|
|
|
}
|
|
|
|
|
// <20><><EFBFBD>˰汾
|
2019-11-05 14:47:55 +00:00
|
|
|
|
void restore(Memento* memento){
|
|
|
|
|
setVersion(memento->getVersion());
|
|
|
|
|
setDate(memento->getDate());
|
|
|
|
|
setLabel(memento->getLabel());
|
|
|
|
|
}
|
|
|
|
|
void setVersion(int iVersion){
|
|
|
|
|
version = iVersion;
|
|
|
|
|
}
|
|
|
|
|
int getVersion(){
|
|
|
|
|
return version;
|
|
|
|
|
}
|
|
|
|
|
void setLabel(string iLabel){
|
|
|
|
|
label = iLabel;
|
|
|
|
|
}
|
|
|
|
|
string getLabel(){
|
|
|
|
|
return label;
|
|
|
|
|
}
|
|
|
|
|
void setDate(string iDate){
|
|
|
|
|
date = iDate;
|
|
|
|
|
}
|
|
|
|
|
string getDate(){
|
|
|
|
|
return date;
|
|
|
|
|
}
|
|
|
|
|
private:
|
2021-10-30 02:45:26 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD>汾
|
2019-11-05 14:47:55 +00:00
|
|
|
|
int version;
|
2021-10-30 02:45:26 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD>
|
2019-11-05 14:47:55 +00:00
|
|
|
|
string date;
|
2021-10-30 02:45:26 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ǩ
|
2019-11-05 14:47:55 +00:00
|
|
|
|
string label;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|