/usr/include/kvutils/kvu_com_line.h is in libkvutils-dev 2.8.1-5build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | // -*- mode: C++; -*-
#ifndef INCLUDED_KVU_COM_LINE_H
#define INCLUDED_KVU_COM_LINE_H
#include <string>
#include <vector>
/**
* Class representation of command line arguments
*/
class COMMAND_LINE {
private:
std::vector<std::string> cparams;
mutable std::vector<std::string>::size_type current_rep;
public:
/**
* Number of elements
*/
std::string::size_type size() const { return(cparams.size()); }
/**
* Sets the first argument active. This is usually program's
* name.
*/
void begin(void) const { current_rep = 0; }
/**
* Moves to the next argument.
*/
void next(void) const { ++current_rep; }
/**
* Moves to the previous argument.
*/
void previous(void) const { --current_rep; }
/**
* Returns true if we've past the last argument.
*/
bool end(void) const { if (current_rep >= cparams.size()) return(true); else return (false); }
/**
* Returns the current argument
*
* require:
* end() == false
*/
const std::string& current(void) const { return(cparams[current_rep]); }
/**
* Is '-option' is among the arguments?
*
* ensure:
* current() == old current()
*/
bool has(char option) const;
/**
* Is '-option' is among the arguments?
*/
bool has(const std::string& option) const;
/**
* Make sure that all option tokens start with a '-' sign
*/
void combine(void);
/**
* Static version of <code>combine</code>
*/
static std::vector<std::string> combine(const std::vector<std::string>& source);
/**
* Adds 'argu' to the arguments.
*/
void push_back(const std::string& argu);
COMMAND_LINE(int argc, char *argv[]);
COMMAND_LINE(const std::vector<std::string>& params);
COMMAND_LINE(void);
};
#endif
|