This file is indexed.

/usr/include/OTB-5.8/otbCommandLineArgumentParser.h is in libotb-dev 5.8.0+dfsg-3.

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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
/*=========================================================================

  Program:   ORFEO Toolbox
  Language:  C++
  Date:      $Date$
  Version:   $Revision$


  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
  See OTBCopyright.txt for details.


     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
#ifndef otbCommandLineArgumentParser_h
#define otbCommandLineArgumentParser_h

#include <iostream>
#include <vector>
#include <string>
#include <map>

#include "itkProcessObject.h"

/** \class CommandLineArgumentParserHelpException
 * \brief This exception is thrown when the help menu is displayed.
 *
 * \ingroup OTBCommandLineParser
 */
class ITK_EXPORT CommandLineArgumentParserHelpException
  : public itk::ExceptionObject
{
public:
  /** Run-time information. */
  itkTypeMacro(CommandLineArgumentParserHelpException, ExceptionObject);

  /** Constructor. */
  CommandLineArgumentParserHelpException(const char *file, unsigned int line,
                                         const char* message = "Help:",
                                         const char* loc = "Unknown") :
    ExceptionObject(file, line, message, loc) {}
  /** Constructor. */
  CommandLineArgumentParserHelpException(const std::string & file, unsigned int line,
                                         const char* message = "Help:",
                                         const char* loc = "Unknown") :
    ExceptionObject(file, line, message, loc) {}
};

/** \class CommandLineArgumentParserVersionException
 * \brief This exception is thrown when the version is displayed.
 *
 * \ingroup OTBCommandLineParser
 */
class ITK_EXPORT CommandLineArgumentParserVersionException
  : public itk::ExceptionObject
{
public:
  /** Run-time information. */
  itkTypeMacro(CommandLineArgumentParserVersionException, ExceptionObject);

  /** Constructor. */
  CommandLineArgumentParserVersionException(const char *file, unsigned int line,
                                            const char* message = "Version:",
                                            const char* loc = "Unknown") :
    ExceptionObject(file, line, message, loc) {}
  /** Constructor. */
  CommandLineArgumentParserVersionException(const std::string & file, unsigned int line,
                                            const char* message = "Version:",
                                            const char* loc = "Unknown") :
    ExceptionObject(file, line, message, loc) {}
};

/** \class CommandLineArgumentParserArgumentErrorException
 * \brief This exception is thrown when the version is displayed.
 *
 * \ingroup OTBCommandLineParser
 */
class ITK_EXPORT CommandLineArgumentParserArgumentErrorException
  : public itk::ExceptionObject
{
public:
  /** Run-time information. */
  itkTypeMacro(CommandLineArgumentParserArgumentErrorException, ExceptionObject);

  /** Constructor. */
  CommandLineArgumentParserArgumentErrorException(const char *file, unsigned int line,
                                                  const char* message = "Argument error:",
                                                  const char* loc = "Unknown") :
    ExceptionObject(file, line, message, loc) {}
  /** Constructor. */
  CommandLineArgumentParserArgumentErrorException(const std::string & file, unsigned int line,
                                                  const char* message = "Argument error:",
                                                  const char* loc = "Unknown") :
    ExceptionObject(file, line, message, loc) {}
};

namespace otb
{

//class CommandLineArgumentParser;

/**
 * \class CommandLineArgumentParseResult
 * \brief Object returned by CommandLineArgumentParser
 *
 * \see CommandLineArgumentParser
 *
 * \ingroup OTBCommandLineParser
 */
class ITK_EXPORT CommandLineArgumentParseResult : public itk::ProcessObject
{
public:
  typedef CommandLineArgumentParseResult Self;
  typedef itk::ProcessObject             Superclass;
  typedef itk::SmartPointer<Self>        Pointer;
  typedef itk::SmartPointer<const Self>  ConstPointer;

  itkNewMacro(Self);
  itkTypeMacro(CommandLineArgumentParseResult, itk::ProcessObject);

  /** Check whether the option was passed in or not */
  bool IsOptionPresent(const std::string& option) const;

  /** Check whether the input image option was passed in or not */
  bool IsOptionInputImagePresent(void) const;

  /** Check whether the output image option was passed in or not */
  bool IsOptionOutputImagePresent(void) const;

  /** Check whether the OTBTesting option was passed in or not */
  bool IsOptionOTBTestingPresent(void) const;

  /** Get one of the parameters to the option */
//  const char *GetOptionParameter(const char *option, unsigned int number = 0);
  int GetNumberOfParameters(const std::string& option);

  void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;

#define otbGetParameterMacro(name, type)                                                 \
  virtual type GetParameter ## name (const std::string& option, unsigned int number = 0) const     \
  {                                                                     \
    std::string parameter = this->GetParameterString(option, number);   \
    type        lValeur;                                                \
    std::stringstream flux;                                             \
    flux << parameter;                                                  \
    flux >> lValeur;                                                    \
    return lValeur;                                                     \
  }

  otbGetParameterMacro(Char, char);
  otbGetParameterMacro(Short, short);
  otbGetParameterMacro(UShort, unsigned short);
  otbGetParameterMacro(Int, int);
  otbGetParameterMacro(UInt, unsigned int);
  otbGetParameterMacro(Long, long);
  otbGetParameterMacro(ULong, unsigned long);
  otbGetParameterMacro(Float, float);
  otbGetParameterMacro(Double, double);

  std::string GetParameterString(const std::string& option, unsigned int number = 0) const;

  std::string GetInputImage(void) const;
  std::string GetOutputImage(void) const;

protected:
  CommandLineArgumentParseResult();
  ~CommandLineArgumentParseResult() ITK_OVERRIDE;

private:
  template<typename TypeValeur>
  TypeValeur GetParameter(const std::string& option, unsigned int number = 0) const;

  typedef std::vector<std::string>                  ParameterArrayType;
  typedef std::map<std::string, ParameterArrayType> OptionMapType;

  void Clear();
  void AddOption(const std::string & option);
  void AddParameter(const std::string & option, const std::string & parameter);

  OptionMapType m_OptionMap;

  friend class CommandLineArgumentParser;
};

/**
 * \class CommandLineArgumentParser
 * \brief Utility to Parse command line argument.
 *
 * Usage:
 *  - Initialize the parser:
 * \code
 *    CommandLineArgumentParser parser;
 *    parser.SetProgramDescription("This program is an example");
 *    parser.AddInputImage();
 *    parser.AddOption("--DetailedName","Help explanation","-d", 1, false);
 * \endcode
 *  - Use the parser:
 * \code
 *    CommandLineArgumentParseResult result;
 *    if( parser.ParseCommandLine(argc, argv, &result) )
 *    {
 *      if( result.IsOptionPresent("--DetailledName") )
 *      {
 *        std::cout << "DetailedName : " << result.GetParameterString("--DetailedName") << std::endl;
 *        ...
 *      }
 *    }
 * \endcode
 *
 * \ingroup OTBCommandLineParser
 */
class ITK_EXPORT CommandLineArgumentParser : public itk::ProcessObject
{
public:
  typedef CommandLineArgumentParser     Self;
  typedef itk::ProcessObject            Superclass;
  typedef itk::SmartPointer<Self>       Pointer;
  typedef itk::SmartPointer<const Self> ConstPointer;

  itkNewMacro(Self);
  itkTypeMacro(CommandLineArgumentParser, itk::ProcessObject);

  /** Add an input image option */
  void AddInputImage(bool obligatory = true);
  /** Add an output image option */
  void AddOutputImage(bool obligatory = true);

  /** Set the program name */
  itkSetStringMacro(ProgramDescription);

  /** Get the program name */
  itkGetStringMacro(ProgramDescription);

  /** Add a new option with fixed number of parameters */
  void AddOption(const std::string& name,
                 const std::string& comment,
                 const std::string& synonym = ITK_NULLPTR,
                 int nParameters = 1,
                 bool obligatory = true);

  /** Add a new option with unknown number of parameters */
  void AddOptionNParams(const std::string& name, const std::string& comment, const std::string& synonym = ITK_NULLPTR, bool obligatory = true);

  /** Interpret options from the command line */
  void ParseCommandLine(int argc, char *argv[],
                        CommandLineArgumentParseResult * outResult,
                        bool failOnUnknownTrailingParameters = true);

protected:
  CommandLineArgumentParser();
  ~CommandLineArgumentParser() ITK_OVERRIDE;

private:

  void PrintUsage(std::ostream& os) const;
  void PrintVersion(std::ostream& os) const;
  bool FindOption(const std::string&, int& index);
  bool IsNumber(const std::string& text);

  /** Try processing a command line.  Returns false if something breaks */
  bool TryParseCommandLine(int argc, char *argv[],
                           CommandLineArgumentParseResult * outResult,
                           bool reportFailedMsg,
                           bool failOnUnknownTrailingParameters);

  typedef struct
  {
    std::string CommonName;             // option name
    std::string Description;            // option description
    std::string Synonym;                // shortcut
    bool NumberOfParametersFixed;       // required number of values
    int NumberOfParameters;             // number of values
    bool Obligatory;                    // is the option mandatory ?
    bool Finded;                        // check if the option is present
  } OptionType;

  typedef std::vector<OptionType> ListOptionType;

  ListOptionType m_OptionList;

  std::string m_ProgramName;
  std::string m_ProgramDescription;
};

}

#endif // otbCommandLineArgumentParser_h_