63 lines
1.7 KiB
C
63 lines
1.7 KiB
C
|
#pragma once
|
|||
|
|
|||
|
#include <string>
|
|||
|
#include <vector>
|
|||
|
#include <memory>
|
|||
|
#include "DataManagerGlobal.h"
|
|||
|
|
|||
|
class DATAMANAGER_DLL_API_EXPORTS InterpreterBase
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 整理过后的命令行
|
|||
|
/// </summary>
|
|||
|
public:
|
|||
|
std::string cmd;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 输出字符串
|
|||
|
/// </summary>
|
|||
|
std::string Output; // 新增 by czb 20170106
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 重定向命令,
|
|||
|
/// </summary>
|
|||
|
std::string RedirectCmd; // 新增 by czb 20170501
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 上一命令行
|
|||
|
/// </summary>
|
|||
|
std::string PrevCommandLine = ""; // 20180101 modified by czb, curStr修改为PrevCommandLine(上一命令行),当前命令行用commandLines[0]获得
|
|||
|
/// <summary>
|
|||
|
/// 当不执行AddObj但需要重绘图形区时,此项须设为true.
|
|||
|
/// </summary>
|
|||
|
bool Update3D = false;
|
|||
|
bool Fit3D = false;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 最终执行的Interpreter(命令解析过程中可能重定向到新的Interpreter)
|
|||
|
/// </summary>
|
|||
|
std::shared_ptr<InterpreterBase> ReturnInterpreter = nullptr;
|
|||
|
|
|||
|
InterpreterBase();
|
|||
|
|
|||
|
virtual void ExecuteCommand(std::vector<std::string> &commandLines);
|
|||
|
|
|||
|
protected:
|
|||
|
// template <typename T>
|
|||
|
// void RedirectExecuteCommand(std::vector<std::string> &commandLines)
|
|||
|
// {
|
|||
|
// // protected List<string> RedirectExecuteCommand<T>(string data) where T : InterpreterBase
|
|||
|
// std::shared_ptr<InterpreterBase> intp = std::dynamic_pointer_cast<InterpreterBase>(Activator::CreateInstance(typeid(T)));
|
|||
|
// this->ReturnInterpreter = intp;
|
|||
|
// intp->ExecuteCommand(commandLines);
|
|||
|
// }
|
|||
|
|
|||
|
void LineDone(std::vector<std::string> &commandLines);
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 输出到Output成员
|
|||
|
/// </summary>
|
|||
|
/// <param name="text"></param>
|
|||
|
void OnOutput(const std::string &text); // 20170106 by czb
|
|||
|
};
|