This file is indexed.

/usr/include/giomm-2.4/giomm/applicationcommandline.h is in libglibmm-2.4-dev 2.56.0-1.

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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
// Generated by gmmproc 2.54.1 -- DO NOT MODIFY!
#ifndef _GIOMM_APPLICATIONCOMMANDLINE_H
#define _GIOMM_APPLICATIONCOMMANDLINE_H


#include <glibmm/ustring.h>
#include <sigc++/sigc++.h>

/* Copyright (C) 2010 Jonathon Jongsma <jonathon@quotidian.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <giomm/file.h>
#include <giomm/inputstream.h>
#include <glibmm/object.h>
#include <glibmm/variant.h>
#include <glibmm/variantdict.h>


#ifndef DOXYGEN_SHOULD_SKIP_THIS
using GApplicationCommandLine = struct _GApplicationCommandLine;
using GApplicationCommandLineClass = struct _GApplicationCommandLineClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Gio
{ class ApplicationCommandLine_Class; } // namespace Gio
#endif //DOXYGEN_SHOULD_SKIP_THIS

namespace Gio
{

/** ApplicationCommandLine - A command-line invocation of an application.
 * ApplicationCommandLine represents a command-line invocation of an
 * application. It is created by Application and emitted in the "command-line"
 * signal and virtual function.
 *
 * The class contains the list of arguments that the program was invoked with.
 * It is also possible to query if the commandline invocation was local (ie:
 * the current process is running in direct response to the invocation) or
 * remote (ie: some other process forwarded the commandline to this process).
 *
 * The ApplicationCommandLine object can provide the argc and argv parameters
 * for use with the Glib::OptionContext command-line parsing API, with the
 * get_arguments() method.
 *
 * The exit status of the originally-invoked process may be set and messages
 * can be printed to stdout or stderr of that process. The lifecycle of the
 * originally-invoked process is tied to the lifecycle of this object (ie: the
 * process exits when the last reference is dropped).
 *
 * The main use for ApplicationCommandline (and the "command-line" signal) is
 * 'Emacs server' like use cases: You can set the EDITOR environment variable
 * to have e.g. git use your favourite editor to edit commit messages, and if
 * you already have an instance of the editor running, the editing will happen
 * in the running instance, instead of opening a new one. An important aspect
 * of this use case is that the process that gets started by git does not
 * return until the editing is done.
 * @newin{2,32}
 */

class ApplicationCommandLine : public Glib::Object
{
  
#ifndef DOXYGEN_SHOULD_SKIP_THIS

public:
  using CppObjectType = ApplicationCommandLine;
  using CppClassType = ApplicationCommandLine_Class;
  using BaseObjectType = GApplicationCommandLine;
  using BaseClassType = GApplicationCommandLineClass;

  // noncopyable
  ApplicationCommandLine(const ApplicationCommandLine&) = delete;
  ApplicationCommandLine& operator=(const ApplicationCommandLine&) = delete;

private:  friend class ApplicationCommandLine_Class;
  static CppClassType applicationcommandline_class_;

protected:
  explicit ApplicationCommandLine(const Glib::ConstructParams& construct_params);
  explicit ApplicationCommandLine(GApplicationCommandLine* castitem);

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

public:

  ApplicationCommandLine(ApplicationCommandLine&& src) noexcept;
  ApplicationCommandLine& operator=(ApplicationCommandLine&& src) noexcept;

  ~ApplicationCommandLine() noexcept override;

  /** Get the GType for this class, for use with the underlying GObject type system.
   */
  static GType get_type()      G_GNUC_CONST;

#ifndef DOXYGEN_SHOULD_SKIP_THIS


  static GType get_base_type() G_GNUC_CONST;
#endif

  ///Provides access to the underlying C GObject.
  GApplicationCommandLine*       gobj()       { return reinterpret_cast<GApplicationCommandLine*>(gobject_); }

  ///Provides access to the underlying C GObject.
  const GApplicationCommandLine* gobj() const { return reinterpret_cast<GApplicationCommandLine*>(gobject_); }

  ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
  GApplicationCommandLine* gobj_copy();

private:


protected:
  ApplicationCommandLine();

public:

  
  /** Gets the list of arguments that was passed on the command line.
   *
   * The strings in the array may contain non-UTF-8 data on UNIX (such as
   * filenames or arguments given in the system locale) but are always in
   * UTF-8 on Windows.
   *
   * If you wish to use the return value with Glib::OptionContext, you must
   * use Glib::OptionContext::parse(char**& argv).
   *
   * The return value is nullptr-terminated and should be freed using
   * g_strfreev().
   *
   * @newin{2,28}
   *
   * @param[out] argc The length of the arguments array.
   * @return The string array containing the arguments (the argv).
   */
  char** get_arguments(int& argc) const;

  //TODO: Wrap the GVariantDict*. See also Application's handle-local-options signal.
  
  /** Gets the options there were passed to Glib::application_command_line().
   * 
   * If you did not override local_command_line() then these are the same
   * options that were parsed according to the OptionEntrys added to the
   * application with g_application_add_main_option_entries() and possibly
   * modified from your GApplication::handle-local-options handler.
   * 
   * If no options were sent then an empty dictionary is returned so that
   * you don't need to check for <tt>nullptr</tt>.
   * 
   * @newin{2,40}
   * 
   * @return A VariantDict with the options.
   */
  Glib::RefPtr<Glib::VariantDict> get_options_dict();
  
  /** Gets the options there were passed to Glib::application_command_line().
   * 
   * If you did not override local_command_line() then these are the same
   * options that were parsed according to the OptionEntrys added to the
   * application with g_application_add_main_option_entries() and possibly
   * modified from your GApplication::handle-local-options handler.
   * 
   * If no options were sent then an empty dictionary is returned so that
   * you don't need to check for <tt>nullptr</tt>.
   * 
   * @newin{2,40}
   * 
   * @return A VariantDict with the options.
   */
  Glib::RefPtr<const Glib::VariantDict> get_options_dict() const;

  
  /** Gets the stdin of the invoking process.
   * 
   * The InputStream can be used to read data passed to the standard
   * input of the invoking process.
   * This doesn't work on all platforms.  Presently, it is only available
   * on UNIX when using a DBus daemon capable of passing file descriptors.
   * If stdin is not available then <tt>nullptr</tt> will be returned.  In the
   * future, support may be expanded to other platforms.
   * 
   * You must only call this function once per commandline invocation.
   * 
   * @newin{2,34}
   * 
   * @return A InputStream for stdin.
   */
  Glib::RefPtr<InputStream> get_stdin();
  
  /** Gets the stdin of the invoking process.
   * 
   * The InputStream can be used to read data passed to the standard
   * input of the invoking process.
   * This doesn't work on all platforms.  Presently, it is only available
   * on UNIX when using a DBus daemon capable of passing file descriptors.
   * If stdin is not available then <tt>nullptr</tt> will be returned.  In the
   * future, support may be expanded to other platforms.
   * 
   * You must only call this function once per commandline invocation.
   * 
   * @newin{2,34}
   * 
   * @return A InputStream for stdin.
   */
  Glib::RefPtr<const InputStream> get_stdin() const;


  //We use std::string instead of ustring because the C documentation says that it may be non-UTF-8 data:
  
  /** Gets the working directory of the command line invocation.
   * The string may contain non-utf8 data.
   * 
   * It is possible that the remote application did not send a working
   * directory, so this may be <tt>nullptr</tt>.
   * 
   * The return value should not be modified or freed and is valid for as
   * long as @a cmdline exists.
   * 
   * @newin{2,28}
   * 
   * @return The current directory, or <tt>nullptr</tt>.
   */
  std::string get_cwd() const;

  //We use std::string instead of ustring because the C documentation says that it may be non-UTF-8 data:
 

  /** Gets the contents of the 'environ' variable of the command line
   * invocation, as would be returned by Glib::get_environ(), ie as a
   * <tt>nullptr</tt>-terminated list of strings in the form 'NAME=VALUE'.
   * The strings may contain non-utf8 data.
   * 
   * The remote application usually does not send an environment.  Use
   * APPLICATION_SEND_ENVIRONMENT to affect that.  Even with this flag
   * set it is possible that the environment is still not available (due
   * to invocation messages from other applications).
   * 
   * The return value should not be modified or freed and is valid for as
   * long as @a cmdline exists.
   * 
   * See g_application_command_line_getenv() if you are only interested
   * in the value of a single environment variable.
   * 
   * @newin{2,28}
   * 
   * @return The environment strings, or <tt>nullptr</tt> if they were not sent.
   */
  std::vector<std::string> get_environ() const;

  //We use std::string instead of ustring because the C documentation says that it may be non-UTF-8 data:
  
  /** Gets the value of a particular environment variable of the command
   * line invocation, as would be returned by Glib::getenv().  The strings may
   * contain non-utf8 data.
   * 
   * The remote application usually does not send an environment.  Use
   * APPLICATION_SEND_ENVIRONMENT to affect that.  Even with this flag
   * set it is possible that the environment is still not available (due
   * to invocation messages from other applications).
   * 
   * The return value should not be modified or freed and is valid for as
   * long as @a cmdline exists.
   * 
   * @newin{2,28}
   * 
   * @param name The environment variable to get.
   * @return The value of the variable, or <tt>nullptr</tt> if unset or unsent.
   */
  std::string getenv(const Glib::ustring& name) const;

  
  /** Determines if @a cmdline represents a remote invocation.
   * 
   * @newin{2,28}
   * 
   * @return <tt>true</tt> if the invocation was remote.
   */
  bool is_remote() const;

 
  /** Gets the platform data associated with the invocation of @a cmdline.
   * 
   * This is a Variant dictionary containing information about the
   * context in which the invocation occurred.  It typically contains
   * information like the current working directory and the startup
   * notification ID.
   * 
   * For local invocation, it will be <tt>nullptr</tt>.
   * 
   * @newin{2,28}
   * 
   * @return The platform data, or <tt>nullptr</tt>.
   */
  Glib::Variant< std::map<Glib::ustring, Glib::VariantBase> > get_platform_data() const;

  
  /** Sets the exit status that will be used when the invoking process
   * exits.
   * 
   * The return value of the Application::signal_command_line() signal is
   * passed to this function when the handler returns.  This is the usual
   * way of setting the exit status.
   * 
   * In the event that you want the remote invocation to continue running
   * and want to decide on the exit status in the future, you can use this
   * call.  For the case of a remote invocation, the remote process will
   * typically exit when the last reference is dropped on @a cmdline.  The
   * exit status of the remote process will be equal to the last value
   * that was set with this function.
   * 
   * In the case that the commandline invocation is local, the situation
   * is slightly more complicated.  If the commandline invocation results
   * in the mainloop running (ie: because the use-count of the application
   * increased to a non-zero value) then the application is considered to
   * have been 'successful' in a certain sense, and the exit status is
   * always zero.  If the application use count is zero, though, the exit
   * status of the local ApplicationCommandLine is used.
   * 
   * @newin{2,28}
   * 
   * @param exit_status The exit status.
   */
  void set_exit_status(int exit_status);
  
  /** Gets the exit status of @a cmdline.  See
   * g_application_command_line_set_exit_status() for more information.
   * 
   * @newin{2,28}
   * 
   * @return The exit status.
   */
  int get_exit_status() const;

  /** Formats a message and prints it using the stdout print handler in the invoking process.
   * If this is a local invocation then this is exactly equivalent to g_print().
   *  If this is remote then this is equivalent to calling g_print() in the invoking process.
   *
   * @param message The text to print.
   */
  void print(const Glib::ustring& message);
  

  /** Formats a message and prints it using the stderr print handler in the invoking process.
   * If this is a local invocation then this is exactly equivalent to g_printerr().
   *  If this is remote then this is equivalent to calling g_printerr() in the invoking process.
   *
   * @param message The text to print.
   */
  void printerr(const Glib::ustring& message);
  

  /** Creates a File corresponding to a filename that was given as part
   * of the invocation of @a cmdline.
   * 
   * This differs from g_file_new_for_commandline_arg() in that it
   * resolves relative pathnames using the current working directory of
   * the invoking process rather than the local process.
   * 
   * @newin{2,36}
   * 
   * @param arg An argument from @a cmdline.
   * @return A new File.
   */
  Glib::RefPtr<File> create_file_for_arg(const Glib::ustring& arg) const;


public:

public:
  //C++ methods used to invoke GTK+ virtual functions:

protected:
  //GTK+ Virtual Functions (override these to change behaviour):

  //Default Signal Handlers::


};


} // namespace Gio


namespace Glib
{
  /** A Glib::wrap() method for this object.
   *
   * @param object The C instance.
   * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
   * @result A C++ instance that wraps this C instance.
   *
   * @relates Gio::ApplicationCommandLine
   */
  Glib::RefPtr<Gio::ApplicationCommandLine> wrap(GApplicationCommandLine* object, bool take_copy = false);
}


#endif /* _GIOMM_APPLICATIONCOMMANDLINE_H */