parse.h
Go to the documentation of this file.
1 //
2 // Copyright 2019 The Abseil Authors.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // https://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 // -----------------------------------------------------------------------------
17 // File: parse.h
18 // -----------------------------------------------------------------------------
19 //
20 // This file defines the main parsing function for Abseil flags:
21 // `absl::ParseCommandLine()`.
22 
23 #ifndef ABSL_FLAGS_PARSE_H_
24 #define ABSL_FLAGS_PARSE_H_
25 
26 #include <string>
27 #include <vector>
28 
30 
31 namespace absl {
32 
33 // ParseCommandLine()
34 //
35 // Parses the set of command-line arguments passed in the `argc` (argument
36 // count) and `argv[]` (argument vector) parameters from `main()`, assigning
37 // values to any defined Abseil flags. (Any arguments passed after the
38 // flag-terminating delimiter (`--`) are treated as positional arguments and
39 // ignored.)
40 //
41 // Any command-line flags (and arguments to those flags) are parsed into Abseil
42 // Flag values, if those flags are defined. Any undefined flags will either
43 // return an error, or be ignored if that flag is designated using `undefok` to
44 // indicate "undefined is OK."
45 //
46 // Any command-line positional arguments not part of any command-line flag (or
47 // arguments to a flag) are returned in a vector, with the program invocation
48 // name at position 0 of that vector. (Note that this includes positional
49 // arguments after the flag-terminating delimiter `--`.)
50 //
51 // After all flags and flag arguments are parsed, this function looks for any
52 // built-in usage flags (e.g. `--help`), and if any were specified, it reports
53 // help messages and then exits the program.
54 std::vector<char*> ParseCommandLine(int argc, char* argv[]);
55 
56 } // namespace absl
57 
58 #endif // ABSL_FLAGS_PARSE_H_
std::vector< char * > ParseCommandLine(int argc, char *argv[])
Definition: parse.cc:755
Definition: algorithm.h:29


abseil_cpp
Author(s):
autogenerated on Mon Feb 28 2022 21:31:19