webrtc-streamer 0.8.13 → 0.8.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -28
- package/cxxopts/BUILD.bazel +16 -0
- package/cxxopts/CHANGELOG.md +183 -0
- package/cxxopts/INSTALL +46 -0
- package/cxxopts/LICENSE +19 -0
- package/cxxopts/README.md +289 -0
- package/cxxopts/WORKSPACE +16 -0
- package/cxxopts/include/cxxopts.hpp +2925 -0
- package/cxxopts/packaging/cxxopts-config.cmake.in +4 -0
- package/cxxopts/packaging/pkgconfig.pc.in +9 -0
- package/cxxopts/src/example.cpp +202 -0
- package/cxxopts/test/catch.hpp +17983 -0
- package/cxxopts/test/fuzz.cpp +107 -0
- package/cxxopts/test/link_a.cpp +6 -0
- package/cxxopts/test/link_b.cpp +1 -0
- package/cxxopts/test/main.cpp +2 -0
- package/cxxopts/test/options.cpp +1193 -0
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
prefix=@CMAKE_INSTALL_PREFIX@
|
|
2
|
+
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
|
3
|
+
|
|
4
|
+
Name: @PROJECT_NAME@
|
|
5
|
+
Description: @PROJECT_DESCRIPTION@
|
|
6
|
+
URL: @PROJECT_HOMEPAGE_URL@
|
|
7
|
+
Version: @PROJECT_VERSION@
|
|
8
|
+
Requires: @PKG_CONFIG_REQUIRES@
|
|
9
|
+
Cflags: -I${includedir} @PKG_CONFIG_EXTRA_CFLAGS@
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/*
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 Jarryd Beck
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
22
|
+
|
|
23
|
+
*/
|
|
24
|
+
#include "cxxopts.hpp"
|
|
25
|
+
|
|
26
|
+
#include <iostream>
|
|
27
|
+
#include <memory>
|
|
28
|
+
|
|
29
|
+
int
|
|
30
|
+
parse(int argc, const char* argv[])
|
|
31
|
+
{
|
|
32
|
+
try
|
|
33
|
+
{
|
|
34
|
+
std::unique_ptr<cxxopts::Options> allocated(new cxxopts::Options(argv[0], " - example command line options"));
|
|
35
|
+
auto& options = *allocated;
|
|
36
|
+
options
|
|
37
|
+
.positional_help("[optional args]")
|
|
38
|
+
.show_positional_help();
|
|
39
|
+
|
|
40
|
+
bool apple = false;
|
|
41
|
+
|
|
42
|
+
options
|
|
43
|
+
.set_width(70)
|
|
44
|
+
.set_tab_expansion()
|
|
45
|
+
.allow_unrecognised_options()
|
|
46
|
+
.add_options()
|
|
47
|
+
("a,apple,ringo", "an apple", cxxopts::value<bool>(apple))
|
|
48
|
+
("b,bob", "Bob")
|
|
49
|
+
("char", "A character", cxxopts::value<char>())
|
|
50
|
+
("t,true", "True", cxxopts::value<bool>()->default_value("true"))
|
|
51
|
+
("f, file", "File", cxxopts::value<std::vector<std::string>>(), "FILE")
|
|
52
|
+
("i,input", "Input", cxxopts::value<std::string>())
|
|
53
|
+
("o,output", "Output file", cxxopts::value<std::string>()
|
|
54
|
+
->default_value("a.out")->implicit_value("b.def"), "BIN")
|
|
55
|
+
("x", "A short-only option", cxxopts::value<std::string>())
|
|
56
|
+
("positional",
|
|
57
|
+
"Positional arguments: these are the arguments that are entered "
|
|
58
|
+
"without an option", cxxopts::value<std::vector<std::string>>())
|
|
59
|
+
("long-description",
|
|
60
|
+
"thisisareallylongwordthattakesupthewholelineandcannotbebrokenataspace")
|
|
61
|
+
("help", "Print help")
|
|
62
|
+
("tab-expansion", "Tab\texpansion")
|
|
63
|
+
("int", "An integer", cxxopts::value<int>(), "N")
|
|
64
|
+
("float", "A floating point number", cxxopts::value<float>())
|
|
65
|
+
("vector", "A list of doubles", cxxopts::value<std::vector<double>>())
|
|
66
|
+
("option_that_is_too_long_for_the_help", "A very long option")
|
|
67
|
+
("l,list", "List all parsed arguments (including default values)")
|
|
68
|
+
("range", "Use range-for to list arguments")
|
|
69
|
+
#ifdef CXXOPTS_USE_UNICODE
|
|
70
|
+
("unicode", u8"A help option with non-ascii: à. Here the size of the"
|
|
71
|
+
" string should be correct")
|
|
72
|
+
#endif
|
|
73
|
+
;
|
|
74
|
+
|
|
75
|
+
options.add_options("Group")
|
|
76
|
+
("c,compile", "compile")
|
|
77
|
+
("d,drop", "drop", cxxopts::value<std::vector<std::string>>());
|
|
78
|
+
|
|
79
|
+
options.parse_positional({"input", "output", "positional"});
|
|
80
|
+
|
|
81
|
+
auto result = options.parse(argc, argv);
|
|
82
|
+
|
|
83
|
+
if (result.count("help"))
|
|
84
|
+
{
|
|
85
|
+
std::cout << options.help({"", "Group"}) << std::endl;
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if(result.count("list"))
|
|
90
|
+
{
|
|
91
|
+
if(result.count("range"))
|
|
92
|
+
{
|
|
93
|
+
for(const auto &kv: result)
|
|
94
|
+
{
|
|
95
|
+
std::cout << kv.key() << " = " << kv.value() << std::endl;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else
|
|
99
|
+
{
|
|
100
|
+
std::cout << result.arguments_string() << std::endl;
|
|
101
|
+
}
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (apple)
|
|
106
|
+
{
|
|
107
|
+
std::cout << "Saw option ‘a’ " << result.count("a") << " times " <<
|
|
108
|
+
std::endl;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (result.count("b"))
|
|
112
|
+
{
|
|
113
|
+
std::cout << "Saw option ‘b’" << std::endl;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (result.count("char"))
|
|
117
|
+
{
|
|
118
|
+
std::cout << "Saw a character ‘" << result["char"].as<char>() << "’" << std::endl;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (result.count("f"))
|
|
122
|
+
{
|
|
123
|
+
auto& ff = result["f"].as<std::vector<std::string>>();
|
|
124
|
+
std::cout << "Files" << std::endl;
|
|
125
|
+
for (const auto& f : ff)
|
|
126
|
+
{
|
|
127
|
+
std::cout << f << std::endl;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (result.count("input"))
|
|
132
|
+
{
|
|
133
|
+
std::cout << "Input = " << result["input"].as<std::string>()
|
|
134
|
+
<< std::endl;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (result.count("output"))
|
|
138
|
+
{
|
|
139
|
+
std::cout << "Output = " << result["output"].as<std::string>()
|
|
140
|
+
<< std::endl;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (result.count("positional"))
|
|
144
|
+
{
|
|
145
|
+
std::cout << "Positional = {";
|
|
146
|
+
auto& v = result["positional"].as<std::vector<std::string>>();
|
|
147
|
+
for (const auto& s : v) {
|
|
148
|
+
std::cout << s << ", ";
|
|
149
|
+
}
|
|
150
|
+
std::cout << "}" << std::endl;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (result.count("int"))
|
|
154
|
+
{
|
|
155
|
+
std::cout << "int = " << result["int"].as<int>() << std::endl;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (result.count("float"))
|
|
159
|
+
{
|
|
160
|
+
std::cout << "float = " << result["float"].as<float>() << std::endl;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (result.count("vector"))
|
|
164
|
+
{
|
|
165
|
+
std::cout << "vector = ";
|
|
166
|
+
const auto values = result["vector"].as<std::vector<double>>();
|
|
167
|
+
for (const auto& v : values) {
|
|
168
|
+
std::cout << v << ", ";
|
|
169
|
+
}
|
|
170
|
+
std::cout << std::endl;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
std::cout << "Arguments remain = " << argc << std::endl;
|
|
174
|
+
|
|
175
|
+
auto arguments = result.arguments();
|
|
176
|
+
std::cout << "Saw " << arguments.size() << " arguments" << std::endl;
|
|
177
|
+
|
|
178
|
+
std::cout << "Unmatched options: ";
|
|
179
|
+
for (const auto& option: result.unmatched())
|
|
180
|
+
{
|
|
181
|
+
std::cout << "'" << option << "' ";
|
|
182
|
+
}
|
|
183
|
+
std::cout << std::endl;
|
|
184
|
+
}
|
|
185
|
+
catch (const cxxopts::exceptions::exception& e)
|
|
186
|
+
{
|
|
187
|
+
std::cout << "error parsing options: " << e.what() << std::endl;
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
int main(int argc, const char* argv[])
|
|
195
|
+
{
|
|
196
|
+
if (!parse(argc, argv))
|
|
197
|
+
{
|
|
198
|
+
return 1;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return 0;
|
|
202
|
+
}
|