• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2021 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=5af5bf1e877dd53f21f751d332a9e2166817324c$
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 are considered case-insensitive. This structure can
57 // be used before cef_initialize() is called.
58 ///
59 typedef struct _cef_command_line_t {
60   ///
61   // Base structure.
62   ///
63   cef_base_ref_counted_t base;
64 
65   ///
66   // Returns true (1) if this object is valid. Do not call any other functions
67   // if this function returns false (0).
68   ///
69   int(CEF_CALLBACK* is_valid)(struct _cef_command_line_t* self);
70 
71   ///
72   // Returns true (1) if the values of this object are read-only. Some APIs may
73   // expose read-only objects.
74   ///
75   int(CEF_CALLBACK* is_read_only)(struct _cef_command_line_t* self);
76 
77   ///
78   // Returns a writable copy of this object.
79   ///
80   struct _cef_command_line_t*(CEF_CALLBACK* copy)(
81       struct _cef_command_line_t* self);
82 
83   ///
84   // Initialize the command line with the specified |argc| and |argv| values.
85   // The first argument must be the name of the program. This function is only
86   // supported on non-Windows platforms.
87   ///
88   void(CEF_CALLBACK* init_from_argv)(struct _cef_command_line_t* self,
89                                      int argc,
90                                      const char* const* argv);
91 
92   ///
93   // Initialize the command line with the string returned by calling
94   // GetCommandLineW(). This function is only supported on Windows.
95   ///
96   void(CEF_CALLBACK* init_from_string)(struct _cef_command_line_t* self,
97                                        const cef_string_t* command_line);
98 
99   ///
100   // Reset the command-line switches and arguments but leave the program
101   // component unchanged.
102   ///
103   void(CEF_CALLBACK* reset)(struct _cef_command_line_t* self);
104 
105   ///
106   // Retrieve the original command line string as a vector of strings. The argv
107   // array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* }
108   ///
109   void(CEF_CALLBACK* get_argv)(struct _cef_command_line_t* self,
110                                cef_string_list_t argv);
111 
112   ///
113   // Constructs and returns the represented command line string. Use this
114   // function cautiously because quoting behavior is unclear.
115   ///
116   // The resulting string must be freed by calling cef_string_userfree_free().
117   cef_string_userfree_t(CEF_CALLBACK* get_command_line_string)(
118       struct _cef_command_line_t* self);
119 
120   ///
121   // Get the program part of the command line string (the first item).
122   ///
123   // The resulting string must be freed by calling cef_string_userfree_free().
124   cef_string_userfree_t(CEF_CALLBACK* get_program)(
125       struct _cef_command_line_t* self);
126 
127   ///
128   // Set the program part of the command line string (the first item).
129   ///
130   void(CEF_CALLBACK* set_program)(struct _cef_command_line_t* self,
131                                   const cef_string_t* program);
132 
133   ///
134   // Returns true (1) if the command line has switches.
135   ///
136   int(CEF_CALLBACK* has_switches)(struct _cef_command_line_t* self);
137 
138   ///
139   // Returns true (1) if the command line contains the given switch.
140   ///
141   int(CEF_CALLBACK* has_switch)(struct _cef_command_line_t* self,
142                                 const cef_string_t* name);
143 
144   ///
145   // Returns the value associated with the given switch. If the switch has no
146   // value or isn't present this function returns the NULL string.
147   ///
148   // The resulting string must be freed by calling cef_string_userfree_free().
149   cef_string_userfree_t(CEF_CALLBACK* get_switch_value)(
150       struct _cef_command_line_t* self,
151       const cef_string_t* name);
152 
153   ///
154   // Returns the map of switch names and values. If a switch has no value an
155   // NULL string is returned.
156   ///
157   void(CEF_CALLBACK* get_switches)(struct _cef_command_line_t* self,
158                                    cef_string_map_t switches);
159 
160   ///
161   // Add a switch to the end of the command line. If the switch has no value
162   // pass an NULL value string.
163   ///
164   void(CEF_CALLBACK* append_switch)(struct _cef_command_line_t* self,
165                                     const cef_string_t* name);
166 
167   ///
168   // Add a switch with the specified value to the end of the command line.
169   ///
170   void(CEF_CALLBACK* append_switch_with_value)(struct _cef_command_line_t* self,
171                                                const cef_string_t* name,
172                                                const cef_string_t* value);
173 
174   ///
175   // True if there are remaining command line arguments.
176   ///
177   int(CEF_CALLBACK* has_arguments)(struct _cef_command_line_t* self);
178 
179   ///
180   // Get the remaining command line arguments.
181   ///
182   void(CEF_CALLBACK* get_arguments)(struct _cef_command_line_t* self,
183                                     cef_string_list_t arguments);
184 
185   ///
186   // Add an argument to the end of the command line.
187   ///
188   void(CEF_CALLBACK* append_argument)(struct _cef_command_line_t* self,
189                                       const cef_string_t* argument);
190 
191   ///
192   // Insert a command before the current command. Common for debuggers, like
193   // "valgrind" or "gdb --args".
194   ///
195   void(CEF_CALLBACK* prepend_wrapper)(struct _cef_command_line_t* self,
196                                       const cef_string_t* wrapper);
197 } cef_command_line_t;
198 
199 ///
200 // Create a new cef_command_line_t instance.
201 ///
202 CEF_EXPORT cef_command_line_t* cef_command_line_create();
203 
204 ///
205 // Returns the singleton global cef_command_line_t object. The returned object
206 // will be read-only.
207 ///
208 CEF_EXPORT cef_command_line_t* cef_command_line_get_global();
209 
210 #ifdef __cplusplus
211 }
212 #endif
213 
214 #endif  // CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_
215