Jpp  18.6.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JColor.cc File Reference

Example program to test JLANG::JColor class. More...

#include <iostream>
#include <iomanip>
#include "JLang/JColorFacet.hh"
#include "JLang/JVectorize.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to test JLANG::JColor class.

Author
mdejong

Definition in file JColor.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 18 of file JColor.cc.

19 {
20  using namespace std;
21  using namespace JPP;
22 
23  string facet;
24  int debug;
25 
26  try {
27 
28  JParser<> zap("Example program to test color printing.");
29 
30  zap['F'] = make_field(facet) = get_keys(color_facets);
31  zap['d'] = make_field(debug) = 0;
32 
33  zap(argc, argv);
34  }
35  catch(const exception &error) {
36  FATAL(error.what() << endl);
37  }
38 
39  cout.imbue(locale(cout.getloc(), color_facets[facet]->clone()));
40 
41  cout << RED << "red" << RESET << endl;
42  cout << GREEN << "green" << RESET << endl;
43  cout << BLUE << "blue" << RESET << endl;
44  cout << WHITE << "white" << RESET << endl;
45  cout << CYAN << "cyan" << RESET << endl;
46  cout << PURPLE << "purple" << RESET << endl;
47  cout << YELLOW << "yellow" << RESET << endl;
48  cout << BOLD << "bold" << RESET << endl;
49 }
Utility class to parse command line options.
Definition: JParser.hh:1711
static const JColorFacetMap_t color_facets
Color facets.
Definition: JColorFacet.hh:332
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
#define FATAL(A)
Definition: JMessage.hh:67
const array_type< JKey_t > & get_keys(const std::map< JKey_t, JValue_t, JComparator_t, JAllocator_t > &data)
Method to create array of keys of map.
Definition: JVectorize.hh:139
int debug
debug level