abseil-cpp/absl/flags/internal/usage.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 #ifndef ABSL_FLAGS_INTERNAL_USAGE_H_
17 #define ABSL_FLAGS_INTERNAL_USAGE_H_
18 
19 #include <iosfwd>
20 #include <string>
21 
22 #include "absl/base/config.h"
23 #include "absl/flags/commandlineflag.h"
24 #include "absl/flags/declare.h"
25 #include "absl/strings/string_view.h"
26 
27 // --------------------------------------------------------------------
28 // Usage reporting interfaces
29 
30 namespace absl {
32 namespace flags_internal {
33 
34 // The format to report the help messages in.
35 enum class HelpFormat {
37 };
38 
39 // Streams the help message describing `flag` to `out`.
40 // The default value for `flag` is included in the output.
41 void FlagHelp(std::ostream& out, const CommandLineFlag& flag,
43 
44 // Produces the help messages for all flags matching the filter. A flag matches
45 // the filter if it is defined in a file with a filename which includes
46 // filter string as a substring. You can use '/' and '.' to restrict the
47 // matching to a specific file names. For example:
48 // FlagsHelp(out, "/path/to/file.");
49 // restricts help to only flags which resides in files named like:
50 // .../path/to/file.<ext>
51 // for any extension 'ext'. If the filter is empty this function produces help
52 // messages for all flags.
53 void FlagsHelp(std::ostream& out, absl::string_view filter,
54  HelpFormat format, absl::string_view program_usage_message);
55 
56 // --------------------------------------------------------------------
57 
58 // If any of the 'usage' related command line flags (listed on the bottom of
59 // this file) has been set this routine produces corresponding help message in
60 // the specified output stream and returns:
61 // 0 - if "version" or "only_check_flags" flags were set and handled.
62 // 1 - if some other 'usage' related flag was set and handled.
63 // -1 - if no usage flags were set on a commmand line.
64 // Non negative return values are expected to be used as an exit code for a
65 // binary.
66 int HandleUsageFlags(std::ostream& out,
67  absl::string_view program_usage_message);
68 
69 // --------------------------------------------------------------------
70 // Globals representing usage reporting flags
71 
72 enum class HelpMode {
73  kNone,
74  kImportant,
75  kShort,
76  kFull,
77  kPackage,
78  kMatch,
79  kVersion,
81 };
82 
83 // Returns substring to filter help output (--help=substr argument)
85 // Returns the requested help mode.
87 // Returns the requested help format.
89 
90 // These are corresponding setters to the attributes above.
94 
95 // Deduces usage flags from the input argument in a form --name=value or
96 // --name. argument is already split into name and value before we call this
97 // function.
99 
100 } // namespace flags_internal
102 } // namespace absl
103 
104 #endif // ABSL_FLAGS_INTERNAL_USAGE_H_
absl::flags_internal::HelpMode::kShort
@ kShort
flag
uint32_t flag
Definition: ssl_versions.cc:162
absl::flags_internal::HelpFormat
HelpFormat
Definition: abseil-cpp/absl/flags/internal/usage.h:35
absl::flags_internal::HelpMode::kMatch
@ kMatch
http2_test_server.format
format
Definition: http2_test_server.py:118
absl::flags_internal::HelpMode
HelpMode
Definition: abseil-cpp/absl/flags/internal/usage.h:72
absl::flags_internal::SetFlagsHelpMatchSubstr
void SetFlagsHelpMatchSubstr(absl::string_view substr)
Definition: abseil-cpp/absl/flags/internal/usage.cc:438
absl::string_view
Definition: abseil-cpp/absl/strings/string_view.h:167
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
absl::flags_internal::HandleUsageFlags
int HandleUsageFlags(std::ostream &out, absl::string_view program_usage_message)
Definition: abseil-cpp/absl/flags/internal/usage.cc:355
absl::flags_internal::SetFlagsHelpMode
void SetFlagsHelpMode(HelpMode mode)
Definition: abseil-cpp/absl/flags/internal/usage.cc:449
absl::flags_internal::FlagsHelp
void FlagsHelp(std::ostream &out, absl::string_view filter, HelpFormat format, absl::string_view program_usage_message)
Definition: abseil-cpp/absl/flags/internal/usage.cc:344
absl::flags_internal::SetFlagsHelpFormat
void SetFlagsHelpFormat(HelpFormat format)
Definition: abseil-cpp/absl/flags/internal/usage.cc:459
setup.name
name
Definition: setup.py:542
absl::flags_internal::HelpMode::kNone
@ kNone
absl::CommandLineFlag
Definition: abseil-cpp/absl/flags/commandlineflag.h:62
ABSL_NAMESPACE_END
#define ABSL_NAMESPACE_END
Definition: third_party/abseil-cpp/absl/base/config.h:171
absl::flags_internal::DeduceUsageFlags
bool DeduceUsageFlags(absl::string_view name, absl::string_view value)
Definition: abseil-cpp/absl/flags/internal/usage.cc:467
ABSL_NAMESPACE_BEGIN
#define ABSL_NAMESPACE_BEGIN
Definition: third_party/abseil-cpp/absl/base/config.h:170
absl::flags_internal::HelpMode::kOnlyCheckArgs
@ kOnlyCheckArgs
absl::flags_internal::FlagHelp
void FlagHelp(std::ostream &out, const CommandLineFlag &flag, HelpFormat format)
Definition: abseil-cpp/absl/flags/internal/usage.cc:335
absl::flags_internal::HelpMode::kImportant
@ kImportant
absl::flags_internal::HelpMode::kPackage
@ kPackage
absl::flags_internal::GetFlagsHelpMode
HelpMode GetFlagsHelpMode()
Definition: abseil-cpp/absl/flags/internal/usage.cc:444
value
const char * value
Definition: hpack_parser_table.cc:165
absl::flags_internal::GetFlagsHelpMatchSubstr
std::string GetFlagsHelpMatchSubstr()
Definition: abseil-cpp/absl/flags/internal/usage.cc:432
absl::flags_internal::HelpMode::kVersion
@ kVersion
absl::flags_internal::GetFlagsHelpFormat
HelpFormat GetFlagsHelpFormat()
Definition: abseil-cpp/absl/flags/internal/usage.cc:454
absl::flags_internal::HelpFormat::kHumanReadable
@ kHumanReadable
absl::flags_internal::HelpMode::kFull
@ kFull
absl
Definition: abseil-cpp/absl/algorithm/algorithm.h:31
absl::out
char * out
Definition: abseil-cpp/absl/synchronization/mutex.h:1048


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:48