52       return (first.name  == second.name &&
 
   53               first.value == second.value);
 
   65     inline std::istream& 
read(std::istream& in)
 
   67       return in >> this->value;
 
   79     inline std::ostream& write(std::ostream& out)
 const 
   81       return out << this->value;
 
  126     return out << (this->value ? 
"1" : 
"0");
 
  140     return parameter.read(in);
 
  152   inline std::ostream& operator<<(std::ostream& out, const JParameter<T>& parameter)
 
  154     return parameter.write(out);
 
  161   template<
class T = JNullType>
 
  188     JEnvironment 
join(
const JEnvironment& environment)
 
  190       this->insert(environment.begin(), environment.end());
 
  203     int operator()(
int argc, 
char** argv)
 
  210       for ( ; argc != 0 && strcmp(*argv, 
"--") != 0; --argc, ++argv) {}
 
  221           status = this->
read(argc, argv);
 
  236   struct JEnvironment<std::string> :
 
  237     public JEnvironment<>
 
  258     friend inline std::istream& 
operator>>(std::istream& in, JEnvironment& environment)
 
  269       if (!has_facet<JEquationFacet>(in.getloc())) {
 
  270         in.imbue(locale(in.getloc(), facet.clone()));
 
  273       if (in >> c >> key >> equation) {
 
  275         if (c == 
'-' && !equation.getKey().empty()) {
 
  277           environment.data.push_back(parameter_type(equation.getKey()));
 
  279           parameter_type& parameter = environment.data.back();
 
  281           if (facet.isSeparator(equation.getSeparator())) {
 
  285             istringstream is(equation.getValue());
 
  289             for (parameter_type buffer(parameter.name); 
getline(is, buffer.value, 
','); ) {
 
  291               buffer.value = 
trim(buffer.value);
 
  293               possible_values.push_back(buffer);
 
  296             environment[key] = 
JPARSER::getOption(parameter, equation.getKey(), possible_values.begin(), possible_values.end());
 
  305           THROW(
JParseError, 
"JEnvironment: error parsing " << c << 
" <" << equation.getKey() << 
">");
 
  321   struct JEnvironment<bool> :
 
  322     public JEnvironment<>
 
  343     friend inline std::istream& 
operator>>(std::istream& in, JEnvironment& environment)
 
  354       if (!has_facet<JEquationFacet>(in.getloc())) {
 
  355         in.imbue(locale(in.getloc(), facet.clone()));
 
  358       if (in >> c >> key >> equation) {
 
  360         if (c == 
'-' && !equation.getKey().empty()) {
 
  362           environment.data.push_back(parameter_type(equation.getKey()));
 
  364           parameter_type& parameter = environment.data.back();
 
  366           if (facet.isSeparator(equation.getSeparator()) || equation.getValue() != 
"") {
 
  368             THROW(
JParseError, 
"JEnvironment: invalid operation " << c << 
" <" << equation.getKey() << 
">");
 
  377           THROW(
JParseError, 
"JEnvironment: error parsing " << c << 
" <" << equation.getKey() << 
">");
 
  395   void evaluate(
const JEnvironment<T>& environment)
 
  399     for (
typename JEnvironment<T>::const_iterator i = environment.data.begin(); i != environment.data.end(); ++i) {
 
  420 int main(
int argc, 
char **argv)
 
  428     JEnvironment<bool>   boolean;
 
  429     JEnvironment<string> regular;
 
  431     JParser<> zap(
"Auxiliary program to interface C++ parser to command line of shell scripts.");
 
  437     if (zap.
read(argc, argv) != 0) {
 
  441     JEnvironment<> buffer;
 
  445     buffer.join(
boolean);
 
  446     buffer.join(regular);
 
  448     if (buffer(argc, argv) == 0) { 
 
  455   catch(
const exception& error) {
 
  456     return gexit(2, error.what());
 
Utility class to parse command line options. 
 
std::istream & operator>>(std::istream &in, JHead &header)
Read header from input. 
 
JParameter()
Default constructor. 
 
Facet class to specify parsing of equations in currect locale (see class JLANG::JEquation). 
 
void set_variable(const std::string &name, const std::string &value)
Set environment variable. 
 
void gprint(const std::string &message)
Print method. 
 
JParserTemplateElement< bool > getOption(bool &object, const std::string &name, const std::string &help="")
Auxiliary method for creation of template parser element object. 
 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message. 
 
Simple data structure to support I/O of equations (see class JLANG::JEquation). 
 
Empty structure for specification of parser element that is initialised (i.e. 
 
std::string trim(const std::string &buffer)
Trim string. 
 
General purpose equation class. 
 
std::istream & read(std::istream &in, JContainer_t< TString, JAllocator_t > &object, const JBool< false > &option)
Auxiliary method for reading if TString does not exist. 
 
This class can be used to temporarily redirect one output (input) stream to another output (input) st...
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
Auxiliary class for no type definition. 
 
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line. 
 
friend bool operator==(const JParameter< T > &first, typename JClass< JNullType >::argument_type second)
Equal operator. 
 
int gexit(int status, const std::string &message="")
Exit method. 
 
int read(const int argc, const char *const argv[])
Parse the program's command line options. 
 
Utility class to parse command line options. 
 
Exception for parsing value. 
 
int main(int argc, char *argv[])