• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
7 //    * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 //    * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
12 // distribution.
13 //    * Neither the name of Google Inc. nor the name Chromium Embedded
14 // Framework nor the names of its contributors may be used to endorse
15 // or promote products derived from this software without specific prior
16 // written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // ---------------------------------------------------------------------------
31 //
32 // This file was generated by the CEF translator tool and should not edited
33 // by hand. See the translator.README.txt file in the tools directory for
34 // more information.
35 //
36 // $hash=93f3d769c0d48ed6e1d91ad8a8e2f95d4ee54287$
37 //
38 
39 #ifndef CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_
40 #define CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_
41 #pragma once
42 
43 #include "include/capi/cef_base_capi.h"
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 ///
50 // Structure used to create and/or parse command line arguments. Arguments with
51 // '--', '-' and, on Windows, '/' prefixes are considered switches. Switches
52 // will always precede any arguments without switch prefixes. Switches can
53 // optionally have a value specified using the '=' delimiter (e.g.
54 // "-switch=value"). An argument of "--" will terminate switch parsing with all
55 // subsequent tokens, regardless of prefix, being interpreted as non-switch
56 // arguments. Switch names should be lowercase ASCII and will be converted to
57 // such if necessary. Switch values will retain the original case and UTF8
58 // encoding. This structure can be used before cef_initialize() is called.
59 ///
60 typedef struct _cef_command_line_t {
61   ///
62   // Base structure.
63   ///
64   cef_base_ref_counted_t base;
65 
66   ///
67   // Returns true (1) if this object is valid. Do not call any other functions
68   // if this function returns false (0).
69   ///
70   int(CEF_CALLBACK* is_valid)(struct _cef_command_line_t* self);
71 
72   ///
73   // Returns true (1) if the values of this object are read-only. Some APIs may
74   // expose read-only objects.
75   ///
76   int(CEF_CALLBACK* is_read_only)(struct _cef_command_line_t* self);
77 
78   ///
79   // Returns a writable copy of this object.
80   ///
81   struct _cef_command_line_t*(CEF_CALLBACK* copy)(
82       struct _cef_command_line_t* self);
83 
84   ///
85   // Initialize the command line with the specified |argc| and |argv| values.
86   // The first argument must be the name of the program. This function is only
87   // supported on non-Windows platforms.
88   ///
89   void(CEF_CALLBACK* init_from_argv)(struct _cef_command_line_t* self,
90                                      int argc,
91                                      const char* const* argv);
92 
93   ///
94   // Initialize the command line with the string returned by calling
95   // GetCommandLineW(). This function is only supported on Windows.
96   ///
97   void(CEF_CALLBACK* init_from_string)(struct _cef_command_line_t* self,
98                                        const cef_string_t* command_line);
99 
100   ///
101   // Reset the command-line switches and arguments but leave the program
102   // component unchanged.
103   ///
104   void(CEF_CALLBACK* reset)(struct _cef_command_line_t* self);
105 
106   ///
107   // Retrieve the original command line string as a vector of strings. The argv
108   // array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* }
109   ///
110   void(CEF_CALLBACK* get_argv)(struct _cef_command_line_t* self,
111                                cef_string_list_t argv);
112 
113   ///
114   // Constructs and returns the represented command line string. Use this
115   // function cautiously because quoting behavior is unclear.
116   ///
117   // The resulting string must be freed by calling cef_string_userfree_free().
118   cef_string_userfree_t(CEF_CALLBACK* get_command_line_string)(
119       struct _cef_command_line_t* self);
120 
121   ///
122   // Get the program part of the command line string (the first item).
123   ///
124   // The resulting string must be freed by calling cef_string_userfree_free().
125   cef_string_userfree_t(CEF_CALLBACK* get_program)(
126       struct _cef_command_line_t* self);
127 
128   ///
129   // Set the program part of the command line string (the first item).
130   ///
131   void(CEF_CALLBACK* set_program)(struct _cef_command_line_t* self,
132                                   const cef_string_t* program);
133 
134   ///
135   // Returns true (1) if the command line has switches.
136   ///
137   int(CEF_CALLBACK* has_switches)(struct _cef_command_line_t* self);
138 
139   ///
140   // Returns true (1) if the command line contains the given switch.
141   ///
142   int(CEF_CALLBACK* has_switch)(struct _cef_command_line_t* self,
143                                 const cef_string_t* name);
144 
145   ///
146   // Returns the value associated with the given switch. If the switch has no
147   // value or isn't present this function returns the NULL string.
148   ///
149   // The resulting string must be freed by calling cef_string_userfree_free().
150   cef_string_userfree_t(CEF_CALLBACK* get_switch_value)(
151       struct _cef_command_line_t* self,
152       const cef_string_t* name);
153 
154   ///
155   // Returns the map of switch names and values. If a switch has no value an
156   // NULL string is returned.
157   ///
158   void(CEF_CALLBACK* get_switches)(struct _cef_command_line_t* self,
159                                    cef_string_map_t switches);
160 
161   ///
162   // Add a switch to the end of the command line. If the switch has no value
163   // pass an NULL value string.
164   ///
165   void(CEF_CALLBACK* append_switch)(struct _cef_command_line_t* self,
166                                     const cef_string_t* name);
167 
168   ///
169   // Add a switch with the specified value to the end of the command line.
170   ///
171   void(CEF_CALLBACK* append_switch_with_value)(struct _cef_command_line_t* self,
172                                                const cef_string_t* name,
173                                                const cef_string_t* value);
174 
175   ///
176   // True if there are remaining command line arguments.
177   ///
178   int(CEF_CALLBACK* has_arguments)(struct _cef_command_line_t* self);
179 
180   ///
181   // Get the remaining command line arguments.
182   ///
183   void(CEF_CALLBACK* get_arguments)(struct _cef_command_line_t* self,
184                                     cef_string_list_t arguments);
185 
186   ///
187   // Add an argument to the end of the command line.
188   ///
189   void(CEF_CALLBACK* append_argument)(struct _cef_command_line_t* self,
190                                       const cef_string_t* argument);
191 
192   ///
193   // Insert a command before the current command. Common for debuggers, like
194   // "valgrind" or "gdb --args".
195   ///
196   void(CEF_CALLBACK* prepend_wrapper)(struct _cef_command_line_t* self,
197                                       const cef_string_t* wrapper);
198 } cef_command_line_t;
199 
200 ///
201 // Create a new cef_command_line_t instance.
202 ///
203 CEF_EXPORT cef_command_line_t* cef_command_line_create();
204 
205 ///
206 // Returns the singleton global cef_command_line_t object. The returned object
207 // will be read-only.
208 ///
209 CEF_EXPORT cef_command_line_t* cef_command_line_get_global();
210 
211 #ifdef __cplusplus
212 }
213 #endif
214 
215 #endif  // CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_
216