This file is indexed.

/usr/include/Aria/ArArgumentBuilder.h is in libaria-dev 2.8.0+repack-1.2.

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
/*
Adept MobileRobots Robotics Interface for Applications (ARIA)
Copyright (C) 2004, 2005 ActivMedia Robotics LLC
Copyright (C) 2006, 2007, 2008, 2009, 2010 MobileRobots Inc.
Copyright (C) 2011, 2012, 2013 Adept Technology

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.

     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

If you wish to redistribute ARIA under different terms, contact 
Adept MobileRobots for information about a commercial version of ARIA at 
robots@mobilerobots.com or 
Adept MobileRobots, 10 Columbia Drive, Amherst, NH 03031; +1-603-881-7960
*/
#ifndef ARARGUMENTBUILDER_H
#define ARARGUMENTBUILDER_H

#include "ariaTypedefs.h"

/// This class is to build arguments for things that require argc and argv
/// @ingroup ImportantClasses
class ArArgumentBuilder
{
public:
  /// Constructor
  AREXPORT ArArgumentBuilder(size_t argvLen = 512, 
                             char extraSpaceChar = '\0',
			                       bool ignoreNormalSpaces = false,
                             bool isPreCompressQuotes = false);
  /// Copy Constructor
  AREXPORT ArArgumentBuilder(const ArArgumentBuilder &builder);

  AREXPORT ArArgumentBuilder &operator=(const ArArgumentBuilder &builder);

  /// Destructor
  AREXPORT virtual ~ArArgumentBuilder();
#ifndef SWIG
  /** @brief Adds the given string, with varargs, separates if there are spaces
   *  @swignote Not available
   */
  AREXPORT void add(const char *str, ...);
#endif
  /// Adds the given string, without varargs (wrapper for java)
  AREXPORT void addPlain(const char *str, int position = -1);
  /// Adds the given string, without varargs and without touching the str
  AREXPORT void addPlainAsIs(const char *str, int position = -1);
  /// Adds the given string thats divided
  AREXPORT void addStrings(char **argv, int argc, int position = -1);
  /// Adds the given string thats divided
  AREXPORT void addStrings(int argc, char **argv, int position = -1);
  /// Adds the given string thats divided (but doesn't touch the strings)
  AREXPORT void addStringsAsIs(int argc, char **argv, int position = -1);
  /// Gets the original string of the input
  AREXPORT const char *getFullString(void) const;
  /// Sets the full string (this is so you can have a more raw full string)
  AREXPORT void setFullString(const char *str);
  /// Gets the extra string of the input, used differently by different things
  AREXPORT const char *getExtraString(void) const;
  /// Sets the extra string of the input, used differently by different things
  AREXPORT void setExtraString(const char *str);
  /// Prints out the arguments
  AREXPORT void log(void) const;
  /// Gets the argc
  AREXPORT size_t getArgc(void) const;
  /// Gets the argv
  AREXPORT char** getArgv(void) const;
  /// Gets a specific argument as a string
  AREXPORT const char* getArg(size_t whichArg) const;

  /// Sees if an argument is a bool
  AREXPORT bool isArgBool(size_t whichArg) const;

  /// Gets the value of an argument as a boolean 
  /**
   * Valid boolean values are "true" and "false", and "1" and "0".
   * There are two ways to to verify that the specified argument is a bool.
   * Either call isArgBool() before calling this method, or specify a non-NULL
   * ok parameter value. The latter is somewhat more efficient since the 
   * argument string is checked only once.
   * 
   * @param whichArg the size_t index of the arg to retrieve; must be >= 0
   * and less than getArgc()
   * @param ok an optional pointer to a bool that will be set to true if the 
   * arg was successfully retrieved or to false if an error occurred
   * @return bool the retrieved argument value; valid only if ok or isArgBool
   * is true
  **/
  AREXPORT bool getArgBool(size_t whichArg,
                           bool *ok = NULL) const;

  /// Sees if an argument is an int
  /**
   * @param whichArg the size_t index of the arg to retrieve; must be >= 0
   * and less than getArgc()
   * @param forceHex if true this makes it find the int in base 16 instead of 10
   */
  AREXPORT bool isArgInt(size_t whichArg, bool forceHex = false) const;

  /// Gets the value of an argument as an integer
  /**
   * There are two ways to to verify that the specified argument is an integer.
   * Either call isArgInt() before calling this method, or specify a non-NULL
   * ok parameter value. The latter is somewhat more efficient because the 
   * digit status of each character is checked only once.
   * 
   * @param whichArg the size_t index of the arg to retrieve; must be >= 0
   * and less than getArgc()
   * @param ok an optional pointer to a bool that will be set to true if the 
   * arg was successfully retrieved or to false if an error occurred
   * @param forceHex if true this makes it find the int in base 16 instead of 10
   * @return int the retrieved argument value; valid only if ok or isArgInt 
   * is true
  **/
  AREXPORT int getArgInt(size_t whichArg,
                         bool *ok = NULL, bool forceHex = false) const;

  /// Sees if an argument is a long long int
  AREXPORT bool isArgLongLongInt(size_t whichArg) const;

  /// Gets the value of an argument as a long long integer
  /**
   * There are two ways to to verify that the specified argument is an integer.
   * Either call isArgInt() before calling this method, or specify a non-NULL
   * ok parameter value. The latter is somewhat more efficient because the 
   * digit status of each character is checked only once.
   * 
   * @param whichArg the size_t index of the arg to retrieve; must be >= 0
   * and less than getArgc()
   * @param ok an optional pointer to a bool that will be set to true if the 
   * arg was successfully retrieved or to false if an error occurred
   * @return int the retrieved argument value; valid only if ok or isArgInt 
   * is true
  **/
  AREXPORT int getArgLongLongInt(size_t whichArg,
				 bool *ok = NULL) const;

  /// Sees if an argument is a double
  AREXPORT bool isArgDouble(size_t whichArg) const;

  /// Gets the value of an argument as a double
  /**
   * There are two ways to to verify that the specified argument is a double.
   * Either call isArgDouble() before calling this method, or specify a non-NULL
   * ok parameter value. The latter is somewhat more efficient because the 
   * digit status of each character is checked only once.
   * 
   * @param whichArg the size_t index of the arg to retrieve; must be >= 0
   * and less than getArgc()
   * @param ok an optional pointer to a bool that will be set to true if the 
   * arg was successfully retrieved or to false if an error occurred
   * @return double the retrieved argument value; valid only if ok or 
   * isArgDouble is true
  **/
  AREXPORT double getArgDouble(size_t whichArg,
                               bool *ok = NULL) const;

  /// Delete a particular arg, you MUST finish adding before you can remove
  AREXPORT void removeArg(size_t which,
									        bool isRebuildFullString = false);
  /// Combines quoted arguments into one
  AREXPORT void compressQuoted(bool stripQuotationMarks = false);

  /// Turn on this flag to reduce the number of verbose log messages.
  AREXPORT void setQuiet(bool isQuiet);

protected:
  AREXPORT void internalAdd(const char *str, int position = -1);
  AREXPORT void internalAddAsIs(const char *str, int position = -1);
	AREXPORT void rebuildFullString();

  /// Characters that may be used to separate arguments; bitwise flags so QUOTE can be combined with spaces
  enum ArgSeparatorType {
    SPACE              = 1,               // Normal space character
    SPECIAL            = SPACE << 1,      // The special "extra" space character, if any
    ANY_SPACE          = SPACE | SPECIAL, // Either normal space or special extra space
    QUOTE              = SPECIAL << 1,    // Double-quote, must be used in combination with spaces 
 };

  /// Determines whether the current buffer position marks the start of an argument
  /**
   * This method should only be called when an argument is not currently being 
   * parsed (i.e. the previous character was a space).  
   * @param buf the char * buffer that is being parsed; must be non-NULL
   * @param len the maximum number of characters in the buffer
   * @param index the int buffer position of the character to be tested
   * @param endArgFlagsOut a pointer to an output int that will indicate which separators
   * will mark the end of the argument.  If quotes are being pre-processed, and the
   * current argument starts with space-quote, then the argument must end with a quote-space.
  **/
  bool isStartArg(const char *buf, 
                  int len, 
                  int index,
                  int *endArgFlagsOut);

  /// Determines whether the current buffer position marks the end of an argument
  /**
   * This method should only be called when an argument is currently being 
   * parsed (i.e. isStartArg returned true).  
   * @param buf the char * buffer that is being parsed; must be non-NULL
   * @param len the maximum number of characters in the buffer
   * @param indexInOut the input/output int buffer position of the character to be tested; 
   * if the argument ends with a quote-space, then the index will be incremented to mark
   * the space; otherwise, it will remain unchanged
   * @param endArgFlags an int that indicates which separators mark the end of the 
   * argument.  If quotes are being pre-processed, and the current argument started
   * with space-quote, then the argument must end with a quote-space.
  **/
  bool isEndArg(const char *buf, 
                int len, 
                int &indexInOut,
                int endArgFlags);

  /// Determines whether the specified character is an acceptable space (either normal or extra)
  bool isSpace(char c);

  size_t getArgvLen(void) const { return myArgvLen; }
  // how many arguments we had originally (so we can delete 'em)
  size_t myOrigArgc;
  // how many arguments we have
  size_t myArgc;
  // argument list
  char **myArgv;
  // argv length
  size_t myArgvLen;
  // the extra string (utility thing)
  std::string myExtraString;
  // the full string
  std::string myFullString;
  // whether this is our first add or not
  bool myFirstAdd;
  // a character to alternately treat as a space
  char myExtraSpace;
  // if we should ignore normal spaces
  bool myIgnoreNormalSpaces;
  /// Whether to treat double-quotes as arg delimiters (preserving spaces within)
  bool myIsPreCompressQuotes;

  bool myIsQuiet;
};

// ----------------------------------------------------------------------------

/// Comparator that returns true if arg1's full string is less than arg2's.
struct ArArgumentBuilderCompareOp
{
public:

  /// Compares arg1's full string to arg2's.
  bool operator() (ArArgumentBuilder* arg1, ArArgumentBuilder* arg2) const;

}; // end struct ArArgumentBuilderCompareOp



#endif // ARARGUMENTBUILDER_H