• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2020 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 #include "absl/flags/internal/private_handle_accessor.h"
17 
18 #include <memory>
19 #include <string>
20 
21 #include "absl/base/config.h"
22 #include "absl/flags/commandlineflag.h"
23 #include "absl/flags/internal/commandlineflag.h"
24 #include "absl/strings/string_view.h"
25 
26 namespace absl {
27 ABSL_NAMESPACE_BEGIN
28 namespace flags_internal {
29 
TypeId(const CommandLineFlag & flag)30 FlagFastTypeId PrivateHandleAccessor::TypeId(const CommandLineFlag& flag) {
31   return flag.TypeId();
32 }
33 
SaveState(CommandLineFlag & flag)34 std::unique_ptr<FlagStateInterface> PrivateHandleAccessor::SaveState(
35     CommandLineFlag& flag) {
36   return flag.SaveState();
37 }
38 
IsSpecifiedOnCommandLine(const CommandLineFlag & flag)39 bool PrivateHandleAccessor::IsSpecifiedOnCommandLine(
40     const CommandLineFlag& flag) {
41   return flag.IsSpecifiedOnCommandLine();
42 }
43 
ValidateInputValue(const CommandLineFlag & flag,absl::string_view value)44 bool PrivateHandleAccessor::ValidateInputValue(const CommandLineFlag& flag,
45                                                absl::string_view value) {
46   return flag.ValidateInputValue(value);
47 }
48 
CheckDefaultValueParsingRoundtrip(const CommandLineFlag & flag)49 void PrivateHandleAccessor::CheckDefaultValueParsingRoundtrip(
50     const CommandLineFlag& flag) {
51   flag.CheckDefaultValueParsingRoundtrip();
52 }
53 
ParseFrom(CommandLineFlag & flag,absl::string_view value,flags_internal::FlagSettingMode set_mode,flags_internal::ValueSource source,std::string & error)54 bool PrivateHandleAccessor::ParseFrom(CommandLineFlag& flag,
55                                       absl::string_view value,
56                                       flags_internal::FlagSettingMode set_mode,
57                                       flags_internal::ValueSource source,
58                                       std::string& error) {
59   return flag.ParseFrom(value, set_mode, source, error);
60 }
61 
62 }  // namespace flags_internal
63 ABSL_NAMESPACE_END
64 }  // namespace absl
65 
66