proj home

Files   Classes   Functions   Hierarchy  

viscmd Class Reference

A command with its arguments are stored. More...

#include <viscmd.h>

Collaboration diagram for viscmd:

List of all members.

Public Member Functions

 viscmd (stringc command_, stringc arg_)
 Explicitly construct.
 viscmd ()
 Construct in bad state - for STL.
 operator string () const
 Serialize as xml.
void serializeInverse (stringc &s)
 Interpret xml string eg <viscmd><command>point2</command><arg>2.0 1.0</arg><valid>1</valid></viscmd>.

Static Public Member Functions

static void printstatusinvalid (vector< viscmd > &v)
 Print to cout invalid commands.

Public Attributes

string command
 Command id.
string arg
 Argument string.
bool valid
 Was the command run successfully?
bool enabled
 Is this command enabled - used for toggling graphics.


Detailed Description

A command with its arguments are stored.

Definition at line 15 of file viscmd.h.


Constructor & Destructor Documentation

viscmd::viscmd ( stringc  command_,
stringc  arg_ 
)

Explicitly construct.

Definition at line 6 of file viscmd.cpp.

00007   : command(command_), arg(arg_), valid(false), enabled(true)
00008 {
00009 }

viscmd::viscmd (  ) 

Construct in bad state - for STL.

Definition at line 11 of file viscmd.cpp.

00012   : command(""), arg(""), 
00013   valid(false), enabled(true)
00014 
00015 {
00016 }


Member Function Documentation

viscmd::operator string (  )  const

Serialize as xml.

Definition at line 18 of file viscmd.cpp.

References arg, command, enabled, and valid.

00019 {
00020   string s;
00021   s = "<viscmd><command>";
00022   s += command;
00023   s += "</command><arg>";
00024   s += arg;
00025   s += "</arg><valid>";
00026   if (valid)
00027     s += "1";
00028   else
00029     s += "0";
00030   s += "</valid>";
00031   s += "<enabled>";
00032   if (enabled)
00033     s += "1";
00034   else
00035     s += "0";
00036   s += "</enabled>";
00037   s += "</viscmd>";
00038 ;
00039   return s;
00040 }

void viscmd::printstatusinvalid ( vector< viscmd > &  v  )  [static]

Print to cout invalid commands.

Definition at line 65 of file viscmd.cpp.

References valid.

Referenced by vistest::test02().

00067 {
00068   for (uint i=0; i<v.size(); ++i)
00069   {
00070     if (v[i].valid==false)
00071       cout << (string)(v[i]) << endl;
00072   }
00073 }

void viscmd::serializeInverse ( stringc s  ) 

Interpret xml string eg <viscmd><command>point2</command><arg>2.0 1.0</arg><valid>1</valid></viscmd>.

Definition at line 42 of file viscmd.cpp.

00043 {
00044   assert(false); //TODO  
00045 }


Member Data Documentation

string viscmd::arg

Is this command enabled - used for toggling graphics.

Definition at line 28 of file viscmd.h.

Referenced by operator string().


The documentation for this class was generated from the following files:

Generated on Fri Mar 4 00:50:23 2011 for Chelton Evans Source by  doxygen 1.5.8