解释器模式
其他二十三种设计模式
#include<iostream>
#include<vector>
#include<sstream>
using namespace std;
class PlayContext {
public:
void SetPlayText(string _text) {
this->text = _text;
}
string GetPlayText() {
return text;
}
private:
string text;
};
class Expression {
public:
virtual void Excute(string _key, string _value) = 0;
void Interpret(PlayContext* _context) {
if (_context->GetPlayText().length() == 0)
return;
else {
vector<string> vs;
stringstream ss(_context->GetPlayText());
string buf;
string s;
while(ss >><