1 // Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
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
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.
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.
30 // ---------------------------------------------------------------------------
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
37 #ifndef CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_
38 #define CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_
41 #include "include/capi/cef_base_capi.h"
49 // Structure used to create and/or parse command line arguments. Arguments with
50 // '--', '-' and, on Windows, '/' prefixes are considered switches. Switches
51 // will always precede any arguments without switch prefixes. Switches can
52 // optionally have a value specified using the '=' delimiter (e.g.
53 // "-switch=value"). An argument of "--" will terminate switch parsing with all
54 // subsequent tokens, regardless of prefix, being interpreted as non-switch
55 // arguments. Switch names are considered case-insensitive. This structure can
56 // be used before cef_initialize() is called.
58 typedef struct _cef_command_line_t {
65 // Returns true (1) if this object is valid. Do not call any other functions
66 // if this function returns false (0).
68 int (CEF_CALLBACK *is_valid)(struct _cef_command_line_t* self);
71 // Returns true (1) if the values of this object are read-only. Some APIs may
72 // expose read-only objects.
74 int (CEF_CALLBACK *is_read_only)(struct _cef_command_line_t* self);
77 // Returns a writable copy of this object.
79 struct _cef_command_line_t* (CEF_CALLBACK *copy)(
80 struct _cef_command_line_t* self);
83 // Initialize the command line with the specified |argc| and |argv| values.
84 // The first argument must be the name of the program. This function is only
85 // supported on non-Windows platforms.
87 void (CEF_CALLBACK *init_from_argv)(struct _cef_command_line_t* self,
88 int argc, const char* const* argv);
91 // Initialize the command line with the string returned by calling
92 // GetCommandLineW(). This function is only supported on Windows.
94 void (CEF_CALLBACK *init_from_string)(struct _cef_command_line_t* self,
95 const cef_string_t* command_line);
98 // Reset the command-line switches and arguments but leave the program
99 // component unchanged.
101 void (CEF_CALLBACK *reset)(struct _cef_command_line_t* self);
104 // Retrieve the original command line string as a vector of strings. The argv
105 // array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* }
107 void (CEF_CALLBACK *get_argv)(struct _cef_command_line_t* self,
108 cef_string_list_t argv);
111 // Constructs and returns the represented command line string. Use this
112 // function cautiously because quoting behavior is unclear.
114 // The resulting string must be freed by calling cef_string_userfree_free().
115 cef_string_userfree_t (CEF_CALLBACK *get_command_line_string)(
116 struct _cef_command_line_t* self);
119 // Get the program part of the command line string (the first item).
121 // The resulting string must be freed by calling cef_string_userfree_free().
122 cef_string_userfree_t (CEF_CALLBACK *get_program)(
123 struct _cef_command_line_t* self);
126 // Set the program part of the command line string (the first item).
128 void (CEF_CALLBACK *set_program)(struct _cef_command_line_t* self,
129 const cef_string_t* program);
132 // Returns true (1) if the command line has switches.
134 int (CEF_CALLBACK *has_switches)(struct _cef_command_line_t* self);
137 // Returns true (1) if the command line contains the given switch.
139 int (CEF_CALLBACK *has_switch)(struct _cef_command_line_t* self,
140 const cef_string_t* name);
143 // Returns the value associated with the given switch. If the switch has no
144 // value or isn't present this function returns the NULL string.
146 // The resulting string must be freed by calling cef_string_userfree_free().
147 cef_string_userfree_t (CEF_CALLBACK *get_switch_value)(
148 struct _cef_command_line_t* self, const cef_string_t* name);
151 // Returns the map of switch names and values. If a switch has no value an
152 // NULL string is returned.
154 void (CEF_CALLBACK *get_switches)(struct _cef_command_line_t* self,
155 cef_string_map_t switches);
158 // Add a switch to the end of the command line. If the switch has no value
159 // pass an NULL value string.
161 void (CEF_CALLBACK *append_switch)(struct _cef_command_line_t* self,
162 const cef_string_t* name);
165 // Add a switch with the specified value to the end of the command line.
167 void (CEF_CALLBACK *append_switch_with_value)(
168 struct _cef_command_line_t* self, const cef_string_t* name,
169 const cef_string_t* value);
172 // True if there are remaining command line arguments.
174 int (CEF_CALLBACK *has_arguments)(struct _cef_command_line_t* self);
177 // Get the remaining command line arguments.
179 void (CEF_CALLBACK *get_arguments)(struct _cef_command_line_t* self,
180 cef_string_list_t arguments);
183 // Add an argument to the end of the command line.
185 void (CEF_CALLBACK *append_argument)(struct _cef_command_line_t* self,
186 const cef_string_t* argument);
189 // Insert a command before the current command. Common for debuggers, like
190 // "valgrind" or "gdb --args".
192 void (CEF_CALLBACK *prepend_wrapper)(struct _cef_command_line_t* self,
193 const cef_string_t* wrapper);
194 } cef_command_line_t;
198 // Create a new cef_command_line_t instance.
200 CEF_EXPORT cef_command_line_t* cef_command_line_create();
203 // Returns the singleton global cef_command_line_t object. The returned object
204 // will be read-only.
206 CEF_EXPORT cef_command_line_t* cef_command_line_get_global();
213 #endif // CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_