AAO DRAMA/DRAMA2 C++ Interface
Public Member Functions | List of all members
drama::gitarg::String Class Reference

Detailed Description

A class which reads a string item from an SDS structure.

This class is a subclass of std::string and hence all the normal string operations are possible. All std::string constructors are inherited. The std::string assignment operators are re-implemented.

This combination which should mean that this class could be used where-ever a std::string is used, but would provide the Get() function to get the value from an SDS structure, as well as a similar style constructor.

#include "gitarg.hh"

Inheritance diagram for drama::gitarg::String:

Public Member Functions

 String (const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const std::string &Default="", const Flags flags=Flags::KeepErr)
 Constructor with the initial value set from an SDS structure. More...
 
virtual void Get (const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const std::string &Default="", const Flags flags=Flags::KeepErr)
 Fetch the value of this item from an SDS structure. More...
 
String operator= (const std::string str)
 Assign a std::string to this gitarg::String. More...
 
String operator= (const String str)
 Assign a const std::string to this gitarg::String. More...
 
String operator= (const char *s)
 Copy contents of a C string into this gitarg::String. More...
 
Stringoperator= (char c)
 Set this gitarg::String to a string containing a single character. More...
 

Constructor & Destructor Documentation

drama::gitarg::String::String ( const sds::Id Id,
const std::string &  Name = "Argument1",
const int  Position = 1,
const std::string &  Default = "",
const Flags  flags = Flags::KeepErr 
)
inline

Constructor with the initial value set from an SDS structure.

The value is fetched from the named item (arg #2) within the SDS structure specified. or the Position (constructor arg #3) item in the structure if the item named does not exist.

Parameters
IdThe SDS structure.
NameThe name of the item within the structure.
PositionIf the item does not exist by the name, then presume this position.
DefaultThe default value. If not specified, an empty string is used.
flagsWhich GIT Flags to apply. If you specify KeepErr, then an exception is throw if the value in the SDS structure is invalid. If you don't specify KeepErr and and the SDS structure does not contain a value item, then the value is set to the supplied default.

References Get().

Member Function Documentation

virtual void drama::gitarg::String::Get ( const sds::Id Id,
const std::string &  Name = "Argument1",
const int  Position = 1,
const std::string &  Default = "",
const Flags  flags = Flags::KeepErr 
)
virtual

Fetch the value of this item from an SDS structure.

The value is fetched from the named item (arg #2) within the SDS structure specified. or the Position (constructor arg #3) item in the structure if the item named does not exist.

Parameters
IdThe SDS structure.
NameThe name of the item within the structure.
PositionIf the item does not exist by the name, then presume this position.
DefaultThe default value.
flagsWhich GIT Flags to apply. If you specify KeepErr, then an exception is throw if the value in the SDS structure is invalid. If you don't specify KeepErr and and the SDS structure does not contain a value item, then the value is set to the supplied default.

Referenced by String().

String drama::gitarg::String::operator= ( const std::string  str)
inline

Assign a std::string to this gitarg::String.

Parameters
strSource string.
String drama::gitarg::String::operator= ( const String  str)
inline

Assign a const std::string to this gitarg::String.

Parameters
strSource string.
String drama::gitarg::String::operator= ( const char *  s)
inline

Copy contents of a C string into this gitarg::String.

Parameters
sSource C style null-terminated string.
String& drama::gitarg::String::operator= ( char  c)
inline

Set this gitarg::String to a string containing a single character.

Parameters
cSource character.

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

Click here for the DRAMA home page and here for the AAO home page.

For more information, contact tjf@aao.gov.au 

Generated on Mon Feb 22 2016 15:57:53 for AAO DRAMA/DRAMA2 C++ Interface by doxygen 1.8.10