DesignPattern/19.MementoPattern/2.Code/main.cpp

50 lines
1.1 KiB
C++
Raw Normal View History

2019-11-05 14:47:55 +00:00
#include "Originator.h"
#include "Memento.h"
#include "CodeManager.h"
int main()
{
CodeManager *Jungle = new CodeManager();
CodeVersion* codeVer = new CodeVersion(1001, "2019-11-03", "Initial version");
// <20><EFBFBD><E1BDBB>ʼ<EFBFBD>
printf("<EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>汾:\n");
Jungle->commit(codeVer->save());
// <20>޸<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><E6B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD>
printf("\n<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
codeVer->setVersion(1002);
codeVer->setDate("2019-11-04");
codeVer->setLabel("Add log funciton");
Jungle->commit(codeVer->save());
// <20>޸<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><E6B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>QtͼƬ<CDBC><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
printf("\n<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>QtͼƬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
codeVer->setVersion(1003);
codeVer->setDate("2019-11-05");
codeVer->setLabel("Add Qt Image Browser");
Jungle->commit(codeVer->save());
// <20><EFBFBD><EFBFBD><E1BDBB>ʷ
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ\n");
Jungle->codeLog();
// <20><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>
printf("\n<EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>\n");
codeVer->restore(Jungle->switchToPointedVersion(1));
// <20><EFBFBD><EFBFBD><E1BDBB>ʷ
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ\n");
Jungle->codeLog();
printf("\n\n");
system("pause");
2020-11-29 03:17:40 +00:00
delete Jungle;
delete codeVer;
2022-03-09 23:53:38 +00:00
Jungle = nullptr;
codeVer = nullptr;
2020-11-29 03:17:40 +00:00
2019-11-05 14:47:55 +00:00
return 0;
}