Files | |
| file | CCommand.cpp |
| This file contains the implementation of the CCommand class. | |
| file | CCommand.h |
| This file contains the declaration of the CCommand class. | |
| file | CCommandExecutor.cpp |
| This file contains the implementation of the CCommandExecuter class. | |
| file | CCommandExecutor.h |
| This file contains the declaration of the CCommandExecutor class. | |
| file | CCommandParser.cpp |
| This file contains the implementation of the CCommandParser class. | |
| file | CCommandParser.h |
| This file contains the declaration of the CCommandParser class. | |
| file | CSingletonHandler.cpp |
| This file contains the implementation of the CSingletonHandler. | |
Classes | |
| class | CCommand |
| This class represents a command to execute with the parameters. More... | |
| class | CCommandExecutor |
| This class executes a certain command. More... | |
| class | CCommandParser |
| This class parses the command and give tokens to the CCommandExecutor class. More... | |
| class | CSingletonHandler |
| This is the class that takes care of the singletons used by the console interface. More... | |
Functions | |
| void | GetLine (std::istream &i, std::string &s) |
| This function gets a line from a stream. | |
| TYPE_PARAMETERTYPE | CCommand::GetParameterType () const |
| This function returns the type of parameter needed by the command. | |
| void | CCommandExecutor::Execute (const CCommand &command, CRenderObj &surfaceobj) const |
| This function executes a command that is passed in a CCommand class. | |
| static bool | CCommandParser::StringToFloat (const std::string &StringNumber, float *pFloat) |
| This function converts a string into a floating point value. | |
| static bool | CCommandParser::StringToInt (const std::string &StringNumber, int *pInt) |
| This function converts a string into a integer value. | |
| CCommand | CCommandParser::Parse (std::string StrCommand) const |
| This function parses a command and fills a CCommand structure to be executed. | |
Variables | |
| const std::string | HelpMessages [CCommand::PARAMETER_END+1] |
| static CSingletonHandler | singletonHandler |
| Static instance of the CSingletonHandler so that the destructor will be called at the end of the program. | |
| static const std::string | CCommand::s_CommandString [COMMAND_END] |
| static const std::string | CCommand::s_ParameterString [PARAMETER_END] |
| static CCommandExecutor * | CCommandExecutor::s_pInstance = NULL |
| static CCommandParser * | CCommandParser::s_pInstance = NULL |
| void CCommandExecutor::Execute | ( | const CCommand & | command, | |
| CRenderObj & | surfaceobj | |||
| ) | const [inherited] |
This function executes a command that is passed in a CCommand class.
It simply opens the file for reading. If it succeeds, the file exists. It takes care of the action that is to be done by the command.
Definition at line 196 of file CCommandExecutor.cpp.
References CColor::Clamp(), CCommand::DataUnion::Color, CCommand::COMMAND_END, CCommand::COMMAND_HELP, CCommand::COMMAND_PRINT, CCommand::COMMAND_QUIT, CCommand::COMMAND_RUN, CCommand::COMMAND_SET, CCommandExecutor::FileExist(), CCommand::DataUnion::Float, GetLine(), CRenderObj::GetPixelColor(), HelpMessages, CCommand::DataUnion::Int, CRenderObj::m_BackgroundColor, CRenderObj::m_BoxAmbientColor, CRenderObj::m_BoxDiffuseColor, CRenderObj::m_BoxSpecularColor, CRenderObj::m_BoxSpecularExponent, CCommand::m_CommandID, CRenderObj::m_FormulaString, CRenderObj::m_Height, CRenderObj::m_LightDirection, CRenderObj::m_MaxVector, CRenderObj::m_MinVector, CRenderObj::m_NoSignIncrement, CRenderObj::m_NoSignPrecision, CRenderObj::m_Options, CCommand::m_ParameterID, CCommand::m_pData, CRenderObj::m_SignIncrement, CRenderObj::m_SurfaceAmbientColor, CRenderObj::m_SurfaceDiffuseColor, CRenderObj::m_SurfaceSpecularColor, CRenderObj::m_SurfaceSpecularExponent, CRenderObj::m_ViewerPos, CRenderObj::m_Width, CRenderObj::m_Zoom, OPTION_BOUNDINGBOX, OPTION_OPENGLSPECULAR, OPTION_PERSPECTIVE, OPTION_SIGN, CCommand::PARAMETER_BACKGROUNDCOLOR, CCommand::PARAMETER_BOUNDINGBOX, CCommand::PARAMETER_BOXAMBIENTCOLOR, CCommand::PARAMETER_BOXDIFFUSECOLOR, CCommand::PARAMETER_BOXSPECULARCOLOR, CCommand::PARAMETER_BOXSPECULAREXPONENT, CCommand::PARAMETER_END, CCommand::PARAMETER_FORMULASTRING, CCommand::PARAMETER_HEIGHT, CCommand::PARAMETER_LIGHTDIRECTION, CCommand::PARAMETER_MAXVECTOR, CCommand::PARAMETER_MINVECTOR, CCommand::PARAMETER_NOSIGNINCREMENT, CCommand::PARAMETER_NOSIGNPRECISION, CCommand::PARAMETER_OPENGLSPECULAR, CCommand::PARAMETER_PERSPECTIVE, CCommand::PARAMETER_SIGN, CCommand::PARAMETER_SIGNINCREMENT, CCommand::PARAMETER_SURFACEAMBIENTCOLOR, CCommand::PARAMETER_SURFACEDIFFUSECOLOR, CCommand::PARAMETER_SURFACESPECULARCOLOR, CCommand::PARAMETER_SURFACESPECULAREXPONENT, CCommand::PARAMETER_VIEWERPOS, CCommand::PARAMETER_WIDTH, CCommand::PARAMETER_ZOOM, CCommand::s_ParameterString, CCommand::DataUnion::String, CRenderObj::Update(), CRenderObj::Validate(), CCommand::DataUnion::Vector, and CImage::WriteBmpFile().
Referenced by main().
| void GetLine | ( | std::istream & | i, | |
| std::string & | s | |||
| ) | [inline] |
This function gets a line from a stream.
Definition at line 20 of file CCommandParser.h.
Referenced by CCommandExecutor::Execute(), and main().
| CCommand::TYPE_PARAMETERTYPE CCommand::GetParameterType | ( | ) | const [inherited] |
This function returns the type of parameter needed by the command.
Definition at line 62 of file CCommand.cpp.
References CCommand::COMMAND_END, CCommand::m_CommandID, CCommand::m_ParameterID, CCommand::PARAMETER_BACKGROUNDCOLOR, CCommand::PARAMETER_BOUNDINGBOX, CCommand::PARAMETER_BOXAMBIENTCOLOR, CCommand::PARAMETER_BOXDIFFUSECOLOR, CCommand::PARAMETER_BOXSPECULARCOLOR, CCommand::PARAMETER_BOXSPECULAREXPONENT, CCommand::PARAMETER_FORMULASTRING, CCommand::PARAMETER_HEIGHT, CCommand::PARAMETER_LIGHTDIRECTION, CCommand::PARAMETER_MAXVECTOR, CCommand::PARAMETER_MINVECTOR, CCommand::PARAMETER_NOSIGNINCREMENT, CCommand::PARAMETER_NOSIGNPRECISION, CCommand::PARAMETER_OPENGLSPECULAR, CCommand::PARAMETER_PERSPECTIVE, CCommand::PARAMETER_SIGN, CCommand::PARAMETER_SIGNINCREMENT, CCommand::PARAMETER_SURFACEAMBIENTCOLOR, CCommand::PARAMETER_SURFACEDIFFUSECOLOR, CCommand::PARAMETER_SURFACESPECULARCOLOR, CCommand::PARAMETER_SURFACESPECULAREXPONENT, CCommand::PARAMETER_VIEWERPOS, CCommand::PARAMETER_WIDTH, CCommand::PARAMETER_ZOOM, CCommand::PARAMETERTYPE_COLOR, CCommand::PARAMETERTYPE_END, CCommand::PARAMETERTYPE_FLOAT, CCommand::PARAMETERTYPE_INT, CCommand::PARAMETERTYPE_STRING, and CCommand::PARAMETERTYPE_VECTOR.
Referenced by CCommandParser::Parse().
| CCommand CCommandParser::Parse | ( | std::string | StrCommand | ) | const [inherited] |
This function parses a command and fills a CCommand structure to be executed.
It takes care of error checking and display messages if there is a syntax error.
Definition at line 100 of file CCommandParser.cpp.
References CCommand::DataUnion::Color, CCommand::COMMAND_END, CCommand::COMMAND_HELP, CCommand::COMMAND_PRINT, CCommand::COMMAND_QUIT, CCommand::COMMAND_RUN, CCommand::COMMAND_SET, CCommand::DataUnion::Float, CCommand::GetParameterType(), CCommand::DataUnion::Int, CCommand::m_CommandID, CCommand::m_ParameterID, CCommand::m_pData, CCommand::PARAMETER_END, CCommand::PARAMETERTYPE_COLOR, CCommand::PARAMETERTYPE_FLOAT, CCommand::PARAMETERTYPE_INT, CCommand::PARAMETERTYPE_STRING, CCommand::PARAMETERTYPE_VECTOR, CCommand::s_CommandString, CCommand::s_ParameterString, CCommand::DataUnion::String, CCommandParser::StringToFloat(), CCommandParser::StringToInt(), and CCommand::DataUnion::Vector.
Referenced by main().
| bool CCommandParser::StringToFloat | ( | const std::string & | StringNumber, | |
| float * | pFloat | |||
| ) | [static, private, inherited] |
This function converts a string into a floating point value.
It returns true if the string is a valid floating point value.
Definition at line 36 of file CCommandParser.cpp.
Referenced by CCommandParser::Parse().
| bool CCommandParser::StringToInt | ( | const std::string & | StringNumber, | |
| int * | pInt | |||
| ) | [static, private, inherited] |
This function converts a string into a integer value.
It returns true if the string is a valid integer value.
Definition at line 70 of file CCommandParser.cpp.
Referenced by CCommandParser::Parse().
| const std::string HelpMessages[CCommand::PARAMETER_END+1] |
const std::string CCommand::s_CommandString [static, inherited] |
Initial value:
{
"help",
"run",
"set",
"print",
"quit",
}
Definition at line 79 of file CCommand.h.
Referenced by CCommandParser::Parse().
const std::string CCommand::s_ParameterString [static, inherited] |
Initial value:
{
"FormulaString",
"SignIncrement",
"NoSignIncrement",
"NoSignPrecision",
"Zoom",
"MinVector",
"MaxVector",
"ViewerPos",
"LightDirection",
"SurfaceAmbientColor",
"SurfaceDiffuseColor",
"SurfaceSpecularColor",
"SurfaceSpecularExponent",
"BoxAmbientColor",
"BoxDiffuseColor",
"BoxSpecularColor",
"BoxSpecularExponent",
"BackgroundColor",
"Width",
"Height",
"Perspective",
"BoundingBox",
"Sign",
"OpenGLSpecular"
}
Definition at line 82 of file CCommand.h.
Referenced by CCommandExecutor::Execute(), and CCommandParser::Parse().
CCommandParser * CCommandParser::s_pInstance = NULL [static, private, inherited] |
Definition at line 101 of file CCommandParser.h.
Referenced by CCommandParser::freeInstance(), and CCommandParser::getInstance().
CCommandExecutor * CCommandExecutor::s_pInstance = NULL [static, private, inherited] |
Definition at line 68 of file CCommandExecutor.h.
Referenced by CCommandExecutor::freeInstance(), and CCommandExecutor::getInstance().
CSingletonHandler singletonHandler [static] |
Static instance of the CSingletonHandler so that the destructor will be called at the end of the program.
Definition at line 65 of file CSingletonHandler.cpp.
1.5.4