/** \defgroup Parsing Parsing classes */

/** @addtogroup Parsing
    @{
*/

/** @file CCommand.cpp
    \brief This file contains the implementation of the CCommand class

    It contains information about a command to be executed.
*/

#include <cmath>
#include <string>

#include "popassert.h"
#include "CVector3f.h"
#include "CColor.h"
#include "CCommand.h"


const std::string CCommand::s_CommandString[CCommand::COMMAND_END] =
  {
    "help",
    "run",
    "set",
    "print",
    "quit",
  };

const std::string CCommand::s_ParameterString[CCommand::PARAMETER_END] =
  { 
    "FormulaString",
    "SignIncrement",
    "NoSignIncrement",
    "NoSignPrecision",
    "Zoom",
    "MinVector",
    "MaxVector",
    "ViewerPos",
    "LightDirection",
    "SurfaceAmbientColor",
    "SurfaceDiffuseColor",
    "SurfaceSpecularColor",
    "SurfaceSpecularExponent",
    "BoxAmbientColor",
    "BoxDiffuseColor",
    "BoxSpecularColor",
    "BoxSpecularExponent",
    "BackgroundColor",
    "Width",
    "Height",

    // Option
    "Perspective",
    "BoundingBox",
    "Sign",
    "OpenGLSpecular"
  };


CCommand::TYPE_PARAMETERTYPE CCommand::GetParameterType() const
{
  if (m_CommandID == COMMAND_END)
    {
      return PARAMETERTYPE_END;
    }
  else
    {
      switch (m_ParameterID)
        {
        case PARAMETER_FORMULASTRING:
        case PARAMETER_PERSPECTIVE:
        case PARAMETER_BOUNDINGBOX:
        case PARAMETER_SIGN:
        case PARAMETER_OPENGLSPECULAR:
          return PARAMETERTYPE_STRING;

        case PARAMETER_SIGNINCREMENT:
        case PARAMETER_NOSIGNINCREMENT:
        case PARAMETER_NOSIGNPRECISION:
        case PARAMETER_ZOOM:
        case PARAMETER_SURFACESPECULAREXPONENT:
        case PARAMETER_BOXSPECULAREXPONENT:
          return PARAMETERTYPE_FLOAT;

        case PARAMETER_MINVECTOR:
        case PARAMETER_MAXVECTOR:
        case PARAMETER_VIEWERPOS:
        case PARAMETER_LIGHTDIRECTION:
          return PARAMETERTYPE_VECTOR;

        case PARAMETER_SURFACEAMBIENTCOLOR:
        case PARAMETER_SURFACEDIFFUSECOLOR:
        case PARAMETER_SURFACESPECULARCOLOR:
        case PARAMETER_BOXAMBIENTCOLOR:
        case PARAMETER_BOXDIFFUSECOLOR:
        case PARAMETER_BOXSPECULARCOLOR:
        case PARAMETER_BACKGROUNDCOLOR:
          return PARAMETERTYPE_COLOR;

        case PARAMETER_WIDTH:
        case PARAMETER_HEIGHT:
          return PARAMETERTYPE_INT;

        default:
          return PARAMETERTYPE_END;
        }
    }
}


/** @} */
