Data structure to store command line arguments.  
 More...
#include <JArgs.hh>
 | 
|   | JArgs () | 
|   | Default constructor.  
  | 
|   | 
|   | JArgs (const int argc, const char *const argv[]) | 
|   | Constructor.  
  | 
|   | 
|   | JArgs (const std::string &PID, JArgs::const_iterator __begin, JArgs::const_iterator __end) | 
|   | Constructor.  
  | 
|   | 
|   | JArgs (const std::string &buffer) | 
|   | Constructor.  
  | 
|   | 
| std::string  | str (const char ws=' ') const | 
|   | Convert to string consisting of sequence of tokens separated by given white space character.  
  | 
|   | 
| const char *  | c_str (const char ws=' ') const | 
|   | Convert to character array consisting of sequence of tokens separated by given white space character.  
  | 
|   | 
 | 
| std::istream &  | operator>> (std::istream &in, JArgs &args) | 
|   | Stream input.  
  | 
|   | 
| std::ostream &  | operator<< (std::ostream &out, const JArgs &args) | 
|   | Stream output.  
  | 
|   | 
Data structure to store command line arguments. 
Definition at line 24 of file JArgs.hh.
 
◆ JArgs() [1/4]
Default constructor. 
Definition at line 31 of file JArgs.hh.
 
 
◆ JArgs() [2/4]
  
  
      
        
          | JEEP::JArgs::JArgs  | 
          ( | 
          const int |           argc,  | 
         
        
           | 
           | 
          const char *const |           argv[] ) | 
         
       
   | 
  
inline   | 
  
 
Constructor. 
The first argument (if any) is assumed to be the process name (PID).
- Parameters
 - 
  
    | argc | number of command line arguments  | 
    | argv | array of command line arguments  | 
  
   
Definition at line 42 of file JArgs.hh.
   43    {
   44      if (argc > 0) {
   45 
   47 
   48        for (int i = 1; i != argc; ++i) {
   49          push_back(argv[i]);
   50        }
   51 
   52      } else {
   53 
   55      }
   56    }
 
 
 
◆ JArgs() [3/4]
  
  
      
        
          | JEEP::JArgs::JArgs  | 
          ( | 
          const std::string & |           PID,  | 
         
        
           | 
           | 
          JArgs::const_iterator |           __begin,  | 
         
        
           | 
           | 
          JArgs::const_iterator |           __end ) | 
         
       
   | 
  
inline   | 
  
 
Constructor. 
 
- Parameters
 - 
  
    | PID | process identifier  | 
    | __begin | begin of command line arguments  | 
    | __end | end of command line arguments  | 
  
   
Definition at line 66 of file JArgs.hh.
   67    {
   69 
   70      for (const_iterator i = __begin; i != __end; ++i) {
   71        push_back(*i);
   72      }
   73    }
 
 
 
◆ JArgs() [4/4]
  
  
      
        
          | JEEP::JArgs::JArgs  | 
          ( | 
          const std::string & |           buffer | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Constructor. 
- Parameters
 - 
  
  
 
Definition at line 81 of file JArgs.hh.
   82    {
   84 
   85      istringstream is(buffer);
   86 
   88 
   89      for (string word; is >> word; ) {
   90        push_back(word);
   91      }
   92    }
 
 
 
◆ str()
  
  
      
        
          | std::string JEEP::JArgs::str  | 
          ( | 
          const char |           ws = ' ' | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Convert to string consisting of sequence of tokens separated by given white space character. 
- Parameters
 - 
  
  
 
- Returns
 - string 
 
Definition at line 101 of file JArgs.hh.
  102    {
  103      std::string buffer = 
PID;
 
  104 
  105      for (const_iterator i = this->begin(); i != this->end(); ++i) {
  106        buffer += ws;
  107        buffer += *i;
  108      }
  109 
  110      return buffer;
  111    }
 
 
 
◆ c_str()
  
  
      
        
          | const char * JEEP::JArgs::c_str  | 
          ( | 
          const char |           ws = ' ' | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Convert to character array consisting of sequence of tokens separated by given white space character. 
- Parameters
 - 
  
  
 
- Returns
 - character array 
 
Definition at line 120 of file JArgs.hh.
  121    {
  122      static std::string buffer;
  123 
  124      buffer = this->
str(ws);
 
  125 
  126      return buffer.c_str();
  127    }
std::string str(const char ws=' ') const
Convert to string consisting of sequence of tokens separated by given white space character.
 
 
 
 
◆ operator>>
  
  
      
        
          | std::istream & operator>>  | 
          ( | 
          std::istream & |           in,  | 
         
        
           | 
           | 
          JArgs & |           args ) | 
         
       
   | 
  
friend   | 
  
 
Stream input. 
- Parameters
 - 
  
  
 
- Returns
 - input stream 
 
Definition at line 137 of file JArgs.hh.
  138    {
  139      
  140 
  141      for (std::string buffer; in >> buffer; ) {
  142        args.push_back(buffer);
 
  143      } 
  144 
  145      return in;
  146    }
 
 
 
◆ operator<<
  
  
      
        
          | std::ostream & operator<<  | 
          ( | 
          std::ostream & |           out,  | 
         
        
           | 
           | 
          const JArgs & |           args ) | 
         
       
   | 
  
friend   | 
  
 
Stream output. 
- Parameters
 - 
  
    | out | output stream  | 
    | args | args  | 
  
   
- Returns
 - output stream 
 
Definition at line 156 of file JArgs.hh.
  157    {
  159 
  160      for (JArgs::const_iterator i = 
args.begin(); i != 
args.end(); ++i) {
 
  161        out << ' ' << *i;
  162      }
  163 
  164      return out;
  165    }
 
 
 
◆ PID
      
        
          | std::string JEEP::JArgs::PID | 
        
      
 
 
The documentation for this class was generated from the following file: