]> git.sesse.net Git - casparcg/blob - dependencies64/cef/include/cef_command_line.h
* Merged html producer and updated to latest CEF version (does not have satisfactory...
[casparcg] / dependencies64 / cef / include / cef_command_line.h
1 // Copyright (c) 2012 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 // The contents of this file must follow a specific format in order to
33 // support the CEF translator tool. See the translator.README.txt file in the
34 // tools directory for more information.
35 //
36
37 #ifndef CEF_INCLUDE_CEF_COMMAND_LINE_H_
38 #define CEF_INCLUDE_CEF_COMMAND_LINE_H_
39 #pragma once
40
41 #include "include/cef_base.h"
42 #include <map>
43 #include <vector>
44
45 ///
46 // Class used to create and/or parse command line arguments. Arguments with
47 // '--', '-' and, on Windows, '/' prefixes are considered switches. Switches
48 // will always precede any arguments without switch prefixes. Switches can
49 // optionally have a value specified using the '=' delimiter (e.g.
50 // "-switch=value"). An argument of "--" will terminate switch parsing with all
51 // subsequent tokens, regardless of prefix, being interpreted as non-switch
52 // arguments. Switch names are considered case-insensitive. This class can be
53 // used before CefInitialize() is called.
54 ///
55 /*--cef(source=library,no_debugct_check)--*/
56 class CefCommandLine : public virtual CefBase {
57  public:
58   typedef std::vector<CefString> ArgumentList;
59   typedef std::map<CefString, CefString> SwitchMap;
60
61   ///
62   // Create a new CefCommandLine instance.
63   ///
64   /*--cef(api_hash_check)--*/
65   static CefRefPtr<CefCommandLine> CreateCommandLine();
66
67   ///
68   // Returns the singleton global CefCommandLine object. The returned object
69   // will be read-only.
70   ///
71   /*--cef(api_hash_check)--*/
72   static CefRefPtr<CefCommandLine> GetGlobalCommandLine();
73
74   ///
75   // Returns true if this object is valid. Do not call any other methods if this
76   // function returns false.
77   ///
78   /*--cef()--*/
79   virtual bool IsValid() =0;
80
81   ///
82   // Returns true if the values of this object are read-only. Some APIs may
83   // expose read-only objects.
84   ///
85   /*--cef()--*/
86   virtual bool IsReadOnly() =0;
87
88   ///
89   // Returns a writable copy of this object.
90   ///
91   /*--cef()--*/
92   virtual CefRefPtr<CefCommandLine> Copy() =0;
93
94   ///
95   // Initialize the command line with the specified |argc| and |argv| values.
96   // The first argument must be the name of the program. This method is only
97   // supported on non-Windows platforms.
98   ///
99   /*--cef()--*/
100   virtual void InitFromArgv(int argc, const char* const* argv) =0;
101
102   ///
103   // Initialize the command line with the string returned by calling
104   // GetCommandLineW(). This method is only supported on Windows.
105   ///
106   /*--cef()--*/
107   virtual void InitFromString(const CefString& command_line) =0;
108
109   ///
110   // Reset the command-line switches and arguments but leave the program
111   // component unchanged.
112   ///
113   /*--cef()--*/
114   virtual void Reset() =0;
115
116   ///
117   // Retrieve the original command line string as a vector of strings.
118   // The argv array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* }
119   ///
120   /*--cef()--*/
121   virtual void GetArgv(std::vector<CefString>& argv) =0;
122
123   ///
124   // Constructs and returns the represented command line string. Use this method
125   // cautiously because quoting behavior is unclear.
126   ///
127   /*--cef()--*/
128   virtual CefString GetCommandLineString() =0;
129
130   ///
131   // Get the program part of the command line string (the first item).
132   ///
133   /*--cef()--*/
134   virtual CefString GetProgram() =0;
135
136   ///
137   // Set the program part of the command line string (the first item).
138   ///
139   /*--cef()--*/
140   virtual void SetProgram(const CefString& program) =0;
141
142   ///
143   // Returns true if the command line has switches.
144   ///
145   /*--cef()--*/
146   virtual bool HasSwitches() =0;
147
148   ///
149   // Returns true if the command line contains the given switch.
150   ///
151   /*--cef()--*/
152   virtual bool HasSwitch(const CefString& name) =0;
153
154   ///
155   // Returns the value associated with the given switch. If the switch has no
156   // value or isn't present this method returns the empty string.
157   ///
158   /*--cef()--*/
159   virtual CefString GetSwitchValue(const CefString& name) =0;
160
161   ///
162   // Returns the map of switch names and values. If a switch has no value an
163   // empty string is returned.
164   ///
165   /*--cef()--*/
166   virtual void GetSwitches(SwitchMap& switches) =0;
167
168   ///
169   // Add a switch to the end of the command line. If the switch has no value
170   // pass an empty value string.
171   ///
172   /*--cef()--*/
173   virtual void AppendSwitch(const CefString& name) =0;
174
175   ///
176   // Add a switch with the specified value to the end of the command line.
177   ///
178   /*--cef()--*/
179   virtual void AppendSwitchWithValue(const CefString& name,
180                                      const CefString& value) =0;
181
182   ///
183   // True if there are remaining command line arguments.
184   ///
185   /*--cef()--*/
186   virtual bool HasArguments() =0;
187
188   ///
189   // Get the remaining command line arguments.
190   ///
191   /*--cef()--*/
192   virtual void GetArguments(ArgumentList& arguments) =0;
193
194   ///
195   // Add an argument to the end of the command line.
196   ///
197   /*--cef()--*/
198   virtual void AppendArgument(const CefString& argument) =0;
199
200   ///
201   // Insert a command before the current command.
202   // Common for debuggers, like "valgrind" or "gdb --args".
203   ///
204   /*--cef()--*/
205   virtual void PrependWrapper(const CefString& wrapper) =0;
206 };
207
208 #endif  // CEF_INCLUDE_CEF_COMMAND_LINE_H_