appkit  1.5.1
RoadNarrows Robotics Application Kit
utCommandLine

Classes

class  UTThread
 

Macros

#define APP_EC_OK   0
 success exit code
 
#define APP_EC_ARGS   2
 command-line options/arguments error exit code
 
#define APP_EC_EXEC   4
 execution exit code
 
#define APP_EC_OK   0
 success exit code
 
#define APP_EC_ARGS   2
 command-line options/arguments error exit code
 
#define APP_EC_EXEC   4
 execution exit code
 
#define APP_EC_OK   0
 success exit code
 
#define APP_EC_ARGS   2
 command-line options/arguments error exit code
 
#define APP_EC_EXEC   4
 execution exit code
 

Functions

static void mainInit (int argc, char *argv[])
 Main initialization. More...
 
static string HdrSep ("-------------------------------------------------------")
 
static void printTestHdr (const string strSynopsis)
 
static void captainsLogMuddsWomen (LogBook &log)
 
static void captainsLogManTrap (LogBook &log)
 
static void printMarks (LogBook &log, int whence)
 
static void testLogAttrs (LogBook &log, bool bIsTest=true)
 
static void testLogEdits (LogBook &log)
 
static void testLogOutput (LogBook &log)
 
static void testLogFundamentals (LogBook &log)
 
int main (int argc, char *argv[])
 Main. More...
 
static string getline (istream &is)
 
static void utPr (ostream &os, const string name, const RegEx &re)
 Print RegEx data. More...
 
static void utConstRe (ostream &os, const RegEx &re)
 Print RegEx data. More...
 
static void utRun (ostream &os)
 Test RegEx operations.
 
int getch ()
 
int kbhit ()
 

Variables

static char * Argv0
 the command
 
static OptsPgmInfo_T PgmInfo
 Program information. More...
 
static OptsInfo_T OptsInfo []
 Command line options information. More...
 
static char * Argv0
 the command
 
static double OptsHz = 2
 thread hertz rate
 
static OptsPgmInfo_T PgmInfo
 Program information. More...
 
static OptsInfo_T OptsInfo []
 Command line options information. More...
 
const RegEx re0
 Globally constructed, pre-compiled re's.
 
const RegEx re1 ("^[a-z]*$", RegEx::ReFlagICase)
 
RegEx re2 = re1
 
const RegEx re3 ("['\"]{1,2}([0-9]+)(hello)(^)")
 
const RegEx re4 ("^[a-z]*$")
 
RegEx reGo = "([cC]at)|([dD]og)"
 
static char * Argv0
 the command
 
static double OptsHz = 2
 thread hertz rate
 
static bool_t OptsRand = false
 thread random jitter
 
static OptsPgmInfo_T PgmInfo
 Program information. More...
 
static OptsInfo_T OptsInfo []
 Command line options information.
 

Detailed Description

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Main.

Parameters
argcCommand-line argument count.
argvCommand-line argument list.
Returns
Returns 0 on succes, non-zero on failure.

Definition at line 774 of file utLogBook.cxx.

References APP_EC_OK, and mainInit().

Referenced by mainInit().

775 {
776  string strName("Star Trek Log");
777 
778  mainInit(argc, argv);
779 
780  LogBook log(strName, 10);
781 
782  testLogAttrs(log);
783 
784  testLogFundamentals(log);
785 
786  testLogAttrs(log);
787 
788  testLogOutput(log);
789 
790  testLogEdits(log);
791 
792  testLogAttrs(log);
793 
794  return APP_EC_OK;
795 }
static void mainInit(int argc, char *argv[])
Main initialization.
Definition: utLogBook.cxx:101
#define APP_EC_OK
success exit code
Definition: utLogBook.cxx:59
static void mainInit ( int  argc,
char *  argv[] 
)
static

Main initialization.

Parameters
argcCommand-line argument count.
argvCommand-line argument list.
Exits:
Program terminates on conversion error.

Definition at line 101 of file utLogBook.cxx.

References Argv0, rnr::bookmark(), rnr::eoe(), rnr::LogBook::getBookMarks(), rnr::LogBook::getFlags(), rnr::LogBook::getName(), rnr::LogBook::max_size(), rnr::LogBook::numOfTotalEver(), OptsInfo, rnr::LogBook::orFlags(), PgmInfo, PkgInfo, rnr::LogBook::setFlags(), rnr::LogBook::setName(), rnr::LogBook::size(), and rnr::LogBook::textAt().

Referenced by main().

102 {
103  // name of this process
104  Argv0 = basename(argv[0]);
105 
106  // parse input options
107  argv = OptsGet(Argv0, &PkgInfo, &PgmInfo, OptsInfo, true, &argc, argv);
108 }
static char * Argv0
the command
Definition: utLogBook.cxx:63
static OptsInfo_T OptsInfo[]
Command line options information.
Definition: utLogBook.cxx:86
static const PkgInfo_T PkgInfo
Definition: version.h:45
static OptsPgmInfo_T PgmInfo
Program information.
Definition: utLogBook.cxx:68
static void utConstRe ( ostream &  os,
const RegEx re 
)
static

Print RegEx data.

Parameters
reRegEx object.

Definition at line 132 of file utRegEx.cxx.

References rnr::RegEx::match(), and utPr().

Referenced by mainInit().

133 {
134  const char *testinputs[] =
135  {
136  "abcd",
137  "ABCD",
138  "wXyZ",
139  "12",
140  "jkl mno",
141  NULL
142  };
143 
144  os << " Test Constant RegEx:" << endl;
145 
146  utPr(os, "sut", re);
147 
148  for(size_t i = 0; testinputs[i] != NULL; ++i)
149  {
150  string input(testinputs[i]);
151 
152  os << input << " --> ";
153 
154  if( re.match(input) )
155  {
156  os << "match";
157  }
158  else
159  {
160  os << "no match";
161  }
162  os << endl;
163  }
164 }
static void utPr(ostream &os, const string name, const RegEx &re)
Print RegEx data.
Definition: utRegEx.cxx:115
bool match(const std::string &strInput, const int nFlags=ReFlagDefaults)
Match the input string against the regular expression.
static void utPr ( ostream &  os,
const string  name,
const RegEx re 
)
static

Print RegEx data.

Parameters
reRegEx object.

Definition at line 115 of file utRegEx.cxx.

References rnr::RegEx::getErrorStr(), rnr::RegEx::getFlags(), rnr::RegEx::getRegEx(), rnr::RegEx::getReturnCode(), and rnr::RegEx::isValid().

Referenced by mainInit(), utConstRe(), and utRun().

116 {
117  os << " ... RE " << name << endl;
118 
119  os << "getRegEx() " << re.getRegEx() << endl;
120  os << "isValid() " << re.isValid() << endl;
121  os << "getFlags() " << re.getFlags() << endl;
122  os << "getReturnCode() " << re.getReturnCode() << endl;
123  os << "getErrorStr() " << re.getErrorStr() << endl;
124  os << "operator<<() " << re << endl;
125 }
int getReturnCode() const
Get the extened return code from the last RegEx operation.
Definition: RegEx.h:391
const std::string & getRegEx() const
Get the pre-compiled regular expression.
Definition: RegEx.h:342
const std::string & getErrorStr() const
Get the last RegExs operation error string.
Definition: RegEx.h:401
int getFlags() const
Get compile behavior flags.
Definition: RegEx.h:364
bool isValid() const
Test if in a valid state (i.e. compiled).
Definition: RegEx.h:354

Variable Documentation

OptsInfo_T OptsInfo[]
static
Initial value:
=
{
{NULL, }
}

Command line options information.

Definition at line 83 of file utRegEx.cxx.

Referenced by mainInit().

OptsInfo_T OptsInfo[]
static
Initial value:
=
{
{NULL, }
}

Command line options information.

Definition at line 86 of file utLogBook.cxx.

Referenced by mainInit().

OptsPgmInfo_T PgmInfo
static
Initial value:
=
{
NULL,
"Unit test librnr_appkit RegEx class.",
"The %P command unit tests the librnr_appkit RegEx class operation.",
NULL
}

Program information.

Definition at line 65 of file utRegEx.cxx.

Referenced by mainInit().

OptsPgmInfo_T PgmInfo
static
Initial value:
=
{
NULL,
"Unit test librnr_appkit LogBook class.",
"The %P command unit tests the librnr_appkit LogBook operation.",
NULL
}

Program information.

Definition at line 68 of file utLogBook.cxx.

Referenced by mainInit().

OptsPgmInfo_T PgmInfo
static
Initial value:
=
{
NULL,
"Unit test librnr_appkit Thread base class.",
"The %P command unit tests the librnr_appkit Thread base class operation.",
NULL
}

Program information.

Definition at line 70 of file utThread.cxx.

Referenced by mainInit().