This file is indexed.

/usr/include/arc/OptionParser.h is in nordugrid-arc-dev 5.4.2-1build1.

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
// -*- indent-tabs-mode: nil -*-

#ifndef __ARC_OPTION_H__
#define __ARC_OPTION_H__

#include <list>
#include <string>

namespace Arc {

  class OptionBase;

  /// Command line option parser used by ARC command line tools.
  /**
   * The command line arguments and a brief and detailed description can be set
   * in the constructor. Each command line option should be added with an
   * AddOption() method, corresponding to the type of the option. Parse()
   * can then be called with the same arguments as main() takes. It returns a
   * list of arguments and fills each "val" passed in AddOption() if the
   * corresponding option is specified on the command line.
   *
   * A help text is automatically generated and displayed on stdout if a help
   * option (-h or -?) is used on the command line. Note that Parse() calls
   * exit(0) after displaying the help text.
   *
   * Both short and long format options are supported.
   * \ingroup common
   * \headerfile OptionParser.h arc/OptionParser.h
   */
  class OptionParser {

  public:
    /// Create a new OptionParser.
    /**
     * @param arguments Command line arguments
     * @param summary Brief summary of command
     * @param description Detailed description of command
     */
    OptionParser(const std::string& arguments = "",
                 const std::string& summary = "",
                 const std::string& description = "");

    ~OptionParser();

    /// Add an option which does not take any arguments.
    /**
     * @param shortOpt Short version of this option
     * @param longOpt Long version of this option
     * @param optDesc Description of option
     * @param val Value filled during Parse()
     */
    void AddOption(const char shortOpt,
                   const std::string& longOpt,
                   const std::string& optDesc,
                   bool& val);

    /// Add an option which takes an integer argument.
    /**
     * @param shortOpt Short version of this option
     * @param longOpt Long version of this option
     * @param optDesc Description of option
     * @param argDesc Value of option argument
     * @param val Value filled during Parse()
     */
    void AddOption(const char shortOpt,
                   const std::string& longOpt,
                   const std::string& optDesc,
                   const std::string& argDesc,
                   int& val);

    /// Add an option which takes a string argument.
    /**
     * @param shortOpt Short version of this option
     * @param longOpt Long version of this option
     * @param optDesc Description of option
     * @param argDesc Value of option argument
     * @param val Value filled during Parse()
     */
    void AddOption(const char shortOpt,
                   const std::string& longOpt,
                   const std::string& optDesc,
                   const std::string& argDesc,
                   std::string& val);

    /// Add an option which takes a string argument and can be specified multiple times.
    /**
     * @param shortOpt Short version of this option
     * @param longOpt Long version of this option
     * @param optDesc Description of option
     * @param argDesc Value of option argument
     * @param val Value filled during Parse()
     */
    void AddOption(const char shortOpt,
                   const std::string& longOpt,
                   const std::string& optDesc,
                   const std::string& argDesc,
                   std::list<std::string>& val);

    /// Parse the options and arguments.
    /**
     * Should be called after all options have been added with AddOption().
     * The parameters can be the same as those taken by main(). Note that if a
     * help option is given this method calls exit(0) after printing help text
     * to stdout.
     * @return The list of command line arguments
     */
    std::list<std::string> Parse(int argc, char **argv);

    /// Get command and arguments
    /**
     * Get the arguments as they were passed to the Parse method as a string
     * joined by spaces.
     * @return The command and all arguments joined by a spaces.
     * @since Added in 4.1.0.
     **/
    const std::string& GetCommandWithArguments() const { return origcmdwithargs; }
    
  private:
    std::string arguments;
    std::string summary;
    std::string description;
    std::list<OptionBase*> options;
    std::string origcmdwithargs;
  };

} // namespace Arc

#endif // __ARC_OPTION_H__