2014-05-16 18:51:01 +08:00
|
|
|
//===-- MICmdInterpreter.h --------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// In-house headers:
|
|
|
|
#include "MICmnBase.h"
|
|
|
|
#include "MICmdData.h"
|
|
|
|
#include "MIUtilSingletonBase.h"
|
|
|
|
|
|
|
|
// Declarations:
|
|
|
|
class CMICmdFactory;
|
|
|
|
|
|
|
|
//++ ============================================================================
|
2014-11-18 02:06:21 +08:00
|
|
|
// Details: MI command interpreter. It takes text data from the MI driver
|
|
|
|
// (which got it from Stdin singleton) and validate the text to see if
|
|
|
|
// matches Machine Interface (MI) format and commands defined in the
|
|
|
|
// MI application.
|
|
|
|
// A singleton class.
|
2014-05-16 18:51:01 +08:00
|
|
|
//--
|
2014-11-18 02:06:21 +08:00
|
|
|
class CMICmdInterpreter : public CMICmnBase, public MI::ISingleton<CMICmdInterpreter>
|
2014-05-16 18:51:01 +08:00
|
|
|
{
|
2014-11-18 02:06:21 +08:00
|
|
|
friend MI::ISingleton<CMICmdInterpreter>;
|
2014-05-16 18:51:01 +08:00
|
|
|
|
2014-11-18 02:06:21 +08:00
|
|
|
// Methods:
|
|
|
|
public:
|
|
|
|
// Methods:
|
|
|
|
public:
|
2015-08-04 18:24:20 +08:00
|
|
|
bool Initialize() override;
|
|
|
|
bool Shutdown() override;
|
2014-11-18 02:06:21 +08:00
|
|
|
bool ValidateIsMi(const CMIUtilString &vTextLine, bool &vwbYesValid, bool &vwbCmdNotInCmdFactor, SMICmdData &rwCmdData);
|
2014-05-16 18:51:01 +08:00
|
|
|
|
2014-11-18 02:06:21 +08:00
|
|
|
// Methods:
|
|
|
|
private:
|
2015-08-04 18:24:20 +08:00
|
|
|
/* ctor */ CMICmdInterpreter();
|
2014-11-18 02:06:21 +08:00
|
|
|
/* ctor */ CMICmdInterpreter(const CMICmdInterpreter &);
|
|
|
|
void operator=(const CMICmdInterpreter &);
|
2014-06-25 00:35:50 +08:00
|
|
|
|
2014-11-18 02:06:21 +08:00
|
|
|
bool HasCmdFactoryGotMiCmd(const SMICmdData &vCmdData) const;
|
2015-06-18 13:27:05 +08:00
|
|
|
bool MiHasCmdTokenEndingHyphen(const CMIUtilString &vTextLine);
|
2014-11-18 02:06:21 +08:00
|
|
|
bool MiHasCmdTokenEndingAlpha(const CMIUtilString &vTextLine);
|
|
|
|
bool MiHasCmd(const CMIUtilString &vTextLine);
|
|
|
|
bool MiHasCmdTokenPresent(const CMIUtilString &vTextLine);
|
|
|
|
const SMICmdData &MiGetCmdData() const;
|
2014-05-16 18:51:01 +08:00
|
|
|
|
2014-11-18 02:06:21 +08:00
|
|
|
// Overridden:
|
|
|
|
private:
|
|
|
|
// From CMICmnBase
|
2015-08-04 18:24:20 +08:00
|
|
|
/* dtor */ ~CMICmdInterpreter() override;
|
2014-11-18 02:06:21 +08:00
|
|
|
|
|
|
|
// Attributes:
|
|
|
|
private:
|
|
|
|
SMICmdData m_miCmdData; // Filled in on each new line being interpreted
|
|
|
|
CMICmdFactory &m_rCmdFactory;
|
2014-05-16 18:51:01 +08:00
|
|
|
};
|