Public Member Functions | Private Member Functions | Private Attributes | List of all members
testing::details::CommandLineArguments Class Reference

Reads and makes available the command line parameters. More...

#include <unit_test_base.h>

Inheritance diagram for testing::details::CommandLineArguments:
testing::BasicTesterEnvironment< CRMGeometryConfiguration > testing::BasicTesterEnvironment< StandardGeometryConfiguration > testing::BasicTesterEnvironment< ConfigurationClass > testing::TesterEnvironment< CRMGeometryConfiguration > testing::TesterEnvironment< CRMGeometryConfiguration > testing::TesterEnvironment< StandardGeometryConfiguration > testing::TesterEnvironment< StandardGeometryConfiguration > testing::TesterEnvironment< ConfigurationClass > testing::TesterEnvironment< ConfigurationClass > testing::GeometryTesterEnvironment< CRMGeometryConfiguration > testing::GeometryTesterEnvironment< CRMGeometryConfiguration > testing::GeometryTesterEnvironment< StandardGeometryConfiguration > testing::GeometryTesterEnvironment< StandardGeometryConfiguration > testing::GeometryTesterEnvironment< ConfigurationClass > testing::GeometryTesterEnvironment< ConfigurationClass > testing::GeometryTesterEnvironment< CRMGeometryConfiguration > testing::GeometryTesterEnvironment< CRMGeometryConfiguration > testing::GeometryTesterEnvironment< StandardGeometryConfiguration > testing::GeometryTesterEnvironment< StandardGeometryConfiguration > testing::GeometryTesterEnvironment< ConfigurationClass > testing::GeometryTesterEnvironment< ConfigurationClass >

Public Member Functions

 CommandLineArguments ()
 Constructor: automatically parses from Boost arguments. More...
 
 CommandLineArguments (int argc, char **argv)
 Constructor: parses from specified arguments. More...
 
void ParseArguments (int argc, char **argv)
 Parses arguments. More...
 
std::string Executable () const
 Returns the name of the executable as started. More...
 
std::vector< std::string > const & Arguments () const
 Returns the list of non-Boost-test arguments on the command line. More...
 
bool hasArgument (size_t iArg) const
 Returns whether we have arguments up to the iArg-th (0-based) More...
 
std::string const & Argument (size_t iArg) const
 Returns the value of the iArg-th (0-based; no range check!) More...
 
 CommandLineArguments ()
 Constructor: automatically parses from Boost arguments. More...
 
 CommandLineArguments (int argc, char **argv)
 Constructor: parses from specified arguments. More...
 
void ParseArguments (int argc, char **argv)
 Parses arguments. More...
 
std::string Executable () const
 Returns the name of the executable as started. More...
 
std::vector< std::string > const & Arguments () const
 Returns the list of non-Boost-test arguments on the command line. More...
 
bool hasArgument (size_t iArg) const
 Returns whether we have arguments up to the iArg-th (0-based) More...
 
std::string const & Argument (size_t iArg) const
 Returns the value of the iArg-th (0-based; no range check!) More...
 

Private Member Functions

void Clear ()
 Erases the stored arguments. More...
 
void Clear ()
 Erases the stored arguments. More...
 

Private Attributes

std::string exec_name
 name of the test executable (from argv[0]) More...
 
std::vector< std::stringargs
 command line arguments (from argv[0]) More...
 

Detailed Description

Reads and makes available the command line parameters.

Definition at line 63 of file unit_test_base.h.

Constructor & Destructor Documentation

testing::details::CommandLineArguments::CommandLineArguments ( )
inline

Constructor: automatically parses from Boost arguments.

Definition at line 66 of file unit_test_base.h.

66 { Clear(); }
void Clear()
Erases the stored arguments.
testing::details::CommandLineArguments::CommandLineArguments ( int  argc,
char **  argv 
)
inline

Constructor: parses from specified arguments.

Definition at line 69 of file unit_test_base.h.

70  { ParseArguments(argc, argv); }
void ParseArguments(int argc, char **argv)
Parses arguments.
testing::details::CommandLineArguments::CommandLineArguments ( )
inline

Constructor: automatically parses from Boost arguments.

Definition at line 68 of file unit_test_base.h.

68 { Clear(); }
void Clear()
Erases the stored arguments.
testing::details::CommandLineArguments::CommandLineArguments ( int  argc,
char **  argv 
)
inline

Constructor: parses from specified arguments.

Definition at line 71 of file unit_test_base.h.

72  { ParseArguments(argc, argv); }
void ParseArguments(int argc, char **argv)
Parses arguments.

Member Function Documentation

std::string const& testing::details::CommandLineArguments::Argument ( size_t  iArg) const
inline

Returns the value of the iArg-th (0-based; no range check!)

Definition at line 85 of file unit_test_base.h.

85 { return args[iArg]; }
std::vector< std::string > args
command line arguments (from argv[0])
std::string const& testing::details::CommandLineArguments::Argument ( size_t  iArg) const
inline

Returns the value of the iArg-th (0-based; no range check!)

Definition at line 87 of file unit_test_base.h.

87 { return args[iArg]; }
std::vector< std::string > args
command line arguments (from argv[0])
std::vector<std::string> const& testing::details::CommandLineArguments::Arguments ( ) const
inline

Returns the list of non-Boost-test arguments on the command line.

Definition at line 79 of file unit_test_base.h.

79 { return args; }
std::vector< std::string > args
command line arguments (from argv[0])
std::vector<std::string> const& testing::details::CommandLineArguments::Arguments ( ) const
inline

Returns the list of non-Boost-test arguments on the command line.

Definition at line 81 of file unit_test_base.h.

81 { return args; }
std::vector< std::string > args
command line arguments (from argv[0])
void testing::details::CommandLineArguments::Clear ( )
inlineprivate

Erases the stored arguments.

Definition at line 92 of file unit_test_base.h.

92 { exec_name.clear(); args.clear(); }
std::vector< std::string > args
command line arguments (from argv[0])
std::string exec_name
name of the test executable (from argv[0])
void testing::details::CommandLineArguments::Clear ( void  )
inlineprivate

Erases the stored arguments.

Definition at line 94 of file unit_test_base.h.

94 { exec_name.clear(); args.clear(); }
std::vector< std::string > args
command line arguments (from argv[0])
std::string exec_name
name of the test executable (from argv[0])
std::string testing::details::CommandLineArguments::Executable ( ) const
inline

Returns the name of the executable as started.

Definition at line 76 of file unit_test_base.h.

76 { return exec_name; }
std::string exec_name
name of the test executable (from argv[0])
std::string testing::details::CommandLineArguments::Executable ( ) const
inline

Returns the name of the executable as started.

Definition at line 78 of file unit_test_base.h.

78 { return exec_name; }
std::string exec_name
name of the test executable (from argv[0])
bool testing::details::CommandLineArguments::hasArgument ( size_t  iArg) const
inline

Returns whether we have arguments up to the iArg-th (0-based)

Definition at line 82 of file unit_test_base.h.

82 { return iArg < args.size(); }
std::vector< std::string > args
command line arguments (from argv[0])
bool testing::details::CommandLineArguments::hasArgument ( size_t  iArg) const
inline

Returns whether we have arguments up to the iArg-th (0-based)

Definition at line 84 of file unit_test_base.h.

84 { return iArg < args.size(); }
std::vector< std::string > args
command line arguments (from argv[0])
void testing::details::CommandLineArguments::ParseArguments ( int  argc,
char **  argv 
)
inline

Parses arguments.

Definition at line 97 of file unit_test_base.h.

97  {
98  Clear();
99  if (argc == 0) return;
100 
101  exec_name = argv[0];
102 
103  args.resize(argc - 1);
104  std::copy(argv + 1, argv + argc, args.begin());
105 
106  } // CommandLineArguments:ParseArguments()
std::vector< std::string > args
command line arguments (from argv[0])
std::string exec_name
name of the test executable (from argv[0])
T copy(T const &v)
void Clear()
Erases the stored arguments.
void testing::details::CommandLineArguments::ParseArguments ( int  argc,
char **  argv 
)

Parses arguments.

Member Data Documentation

std::vector< std::string > testing::details::CommandLineArguments::args
private

command line arguments (from argv[0])

Definition at line 89 of file unit_test_base.h.

std::string testing::details::CommandLineArguments::exec_name
private

name of the test executable (from argv[0])

Definition at line 88 of file unit_test_base.h.


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