This file is indexed.

/usr/include/ossim/base/ossimArgumentParser.h is in libossim-dev 1.8.16-4ubuntu1.

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
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
//-------------------------------------------------------------------------
//
// This code was taken from Open Scene Graph and incorporated from into
// OSSIM.
//
//-------------------------------------------------------------------------
// $Id: ossimArgumentParser.h 19900 2011-08-04 14:19:57Z dburken $
#ifndef ossimArgumentParser_HEADER
#define ossimArgumentParser_HEADER 1
#include <ossim/base/ossimConstants.h>
#include <ossim/base/ossimString.h>
#include <map>
#include <string>
#include <iosfwd>

class ossimApplicationUsage;

class OSSIMDLLEXPORT ossimArgumentParser
{
public:
   
   class ossimParameter
   {
   public:
      enum ossimParameterType
      {
         OSSIM_FLOAT_PARAMETER,
         OSSIM_DOUBLE_PARAMETER,
         OSSIM_INT_PARAMETER,
         OSSIM_UNSIGNED_INT_PARAMETER,
         OSSIM_STRING_PARAMETER,
      };
      
      union ossimValueUnion
      {
         float*          theFloat;
         double*         theDouble;
         int*            theInt;
         unsigned int*   theUint;
         std::string*    theString;
      };
      
      ossimParameter(float& value)
      {
         theType = OSSIM_FLOAT_PARAMETER; theValue.theFloat = &value;
      }
      
      ossimParameter(double& value)
      {
         theType = OSSIM_DOUBLE_PARAMETER; theValue.theDouble = &value;
      }
      
      ossimParameter(int& value)
      {
         theType = OSSIM_INT_PARAMETER; theValue.theInt = &value;
      }
      
      ossimParameter(unsigned int& value)
      {
         theType = OSSIM_UNSIGNED_INT_PARAMETER; theValue.theUint = &value;
      }
      
      ossimParameter(std::string& value)
      {
         theType = OSSIM_STRING_PARAMETER; theValue.theString = &value;
      }
      
      ossimParameter(ossimString& value)
      {
         theType = OSSIM_STRING_PARAMETER; theValue.theString =
                                              &(value.string());
      }
      
      bool valid(const char* str) const;
      bool assign(const char* str);
      
   protected:
      
      ossimParameterType   theType;
      ossimValueUnion      theValue;
   };
   
   /** return return true if specified string is an option in the form of
    * -option or --option .
    */
   static bool isOption(const char* str);
   
   /** return return true if string is any other string apart from an option.*/
   static bool isString(const char* str);
   
   /** return return true if specified parameter is an number.*/
   static bool isNumber(const char* str);
   
public:
   
   ossimArgumentParser(int* argc,char **argv);

   ~ossimArgumentParser();

   /** @brief Initialize from command arguments. */
   void initialize(int* argc, const char **argv); 
   
   void setApplicationUsage(ossimApplicationUsage* usage) { theUsage = usage; }
   ossimApplicationUsage* getApplicationUsage() { return theUsage; }
   const ossimApplicationUsage* getApplicationUsage() const { return theUsage; }
   
   /** return the argument count.*/
   int& argc() { return *theArgc; }
   
   /** return the argument array.*/
   char** argv() { return theArgv; }
   
   /** return char* argument at specificed position.*/
   char* operator [] (int pos) { return theArgv[pos]; }
   
   /** return const char* argument at specificed position.*/
   const char* operator [] (int pos) const { return theArgv[pos]; }
   
   /** return the application name, as specified by argv[0] */
   std::string getApplicationName() const;
   
   /** return the position of an occurence of a string in the argument list.
    * return -1 when no string is found.*/      
   int find(const std::string& str) const;
   
   /** return return true if specified parameter is an option in the form of -option or --option .*/
   bool isOption(int pos) const;
   
   /** return return true if specified parameter is an string, which can be any other string apart from an option.*/
   bool isString(int pos) const;
   
   /** return return true if specified parameter is an number.*/
   bool isNumber(int pos) const;
   
   bool containsOptions() const;
   
   /** remove one or more arguments from the argv argument list, and decrement the argc respectively.*/
   void remove(int pos,int num=1);
   
   /** return true if specified argument matches string.*/        
   bool match(int pos, const std::string& str) const;
   
   /** search for an occurance of a string in the argument list, on sucess
    * remove that occurance from the list and return true, otherwise return false.*/
   bool read(const std::string& str);
   bool read(const std::string& str, ossimParameter value1);
   bool read(const std::string& str, ossimParameter value1, ossimParameter value2);
   bool read(const std::string& str, ossimParameter value1, ossimParameter value2, ossimParameter value3);
   bool read(const std::string& str, ossimParameter value1, ossimParameter value2, ossimParameter value3, ossimParameter value4);
   
   /** Returns the number of parameters of type value associated with specified option, 
    *  or -1 if option not found */
   int numberOfParams(const std::string& str, ossimParameter value) const;
   
   /** if the argument value at the position pos matches specified string, and subsequent
    * paramters are also matched then set the paramter values and remove the from the list of arguments.*/
   bool read(int pos, const std::string& str);
   bool read(int pos, const std::string& str, ossimParameter value1);
   bool read(int pos, const std::string& str, ossimParameter value1, ossimParameter value2);
   bool read(int pos, const std::string& str, ossimParameter value1, ossimParameter value2, ossimParameter value3);
   bool read(int pos, const std::string& str, ossimParameter value1, ossimParameter value2, ossimParameter value3, ossimParameter value4);
   
   
   enum ossimErrorSeverity
   {
      OSSIM_BENIGN = 0,
      OSSIM_CRITICAL = 1
   };
   
   typedef std::map<std::string,ossimErrorSeverity> ossimErrorMessageMap;
   
   /** return the error flag, true if an error has occured when reading arguments.*/
   bool errors(ossimErrorSeverity severity=OSSIM_BENIGN) const;
   
   /** report an error message by adding to the ErrorMessageMap.*/
   void reportError(const std::string& message,ossimErrorSeverity severity=OSSIM_CRITICAL);
   
   /** for each remaining option report it as an unrecongnized.*/
   void reportRemainingOptionsAsUnrecognized(ossimErrorSeverity severity=OSSIM_BENIGN);
   
   /** return the error message, if any has occured.*/
   ossimErrorMessageMap& getErrorMessageMap() { return theErrorMessageMap; }
   
   /** return the error message, if any has occured.*/
   const ossimErrorMessageMap& getErrorMessageMap() const { return theErrorMessageMap; }
   
   /** write out error messages at an above specified .*/
   void writeErrorMessages(std::ostream& output,ossimErrorSeverity sevrity=OSSIM_BENIGN);
   
   
protected:
   
   int*                     theArgc;
   char**                   theArgv;
   ossimErrorMessageMap     theErrorMessageMap;
   ossimApplicationUsage*   theUsage;
        
};

#endif