private_handle_accessor.cc (2206B)
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 30 FlagFastTypeId PrivateHandleAccessor::TypeId(const CommandLineFlag& flag) { 31 return flag.TypeId(); 32 } 33 34 std::unique_ptr<FlagStateInterface> PrivateHandleAccessor::SaveState( 35 CommandLineFlag& flag) { 36 return flag.SaveState(); 37 } 38 39 bool PrivateHandleAccessor::IsSpecifiedOnCommandLine( 40 const CommandLineFlag& flag) { 41 return flag.IsSpecifiedOnCommandLine(); 42 } 43 44 bool PrivateHandleAccessor::ValidateInputValue(const CommandLineFlag& flag, 45 absl::string_view value) { 46 return flag.ValidateInputValue(value); 47 } 48 49 void PrivateHandleAccessor::CheckDefaultValueParsingRoundtrip( 50 const CommandLineFlag& flag) { 51 flag.CheckDefaultValueParsingRoundtrip(); 52 } 53 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 absl::string_view PrivateHandleAccessor::TypeName(const CommandLineFlag& flag) { 63 return flag.TypeName(); 64 } 65 66 } // namespace flags_internal 67 ABSL_NAMESPACE_END 68 } // namespace absl