-- 034c30a00c64d93b9fcbc9d99a0a33801544d741 by Gennadiy Rozental <rogeeff@google.com>: Split private handle interfaces accessor into a separate target with private visibility. PiperOrigin-RevId: 310391488 -- 6f6ca869309b17900b90849e08488ce7f7b0193a by Derek Mauro <dmauro@google.com>: Remove __CLANG_SUPPORT_DYN_ANNOTATION__, which is a symbol defined by us to be true in all builds PiperOrigin-RevId: 310385325 -- ed5c1880c86973c000e826a3006b38e53ab3ed52 by Samuel Benzaquen <sbenza@google.com>: Add tests to exercise extreme width and precision, and fix the overflows from it. PiperOrigin-RevId: 310224957 GitOrigin-RevId: 034c30a00c64d93b9fcbc9d99a0a33801544d741 Change-Id: I6c89a3c89ae92fa617c696044148ce9a79bcdda8pull/682/head
parent
bd317cae3b
commit
a35ef8a62c
17 changed files with 214 additions and 99 deletions
@ -0,0 +1,52 @@ |
||||
//
|
||||
// Copyright 2020 The Abseil Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "absl/flags/internal/private_handle_accessor.h" |
||||
|
||||
namespace absl { |
||||
ABSL_NAMESPACE_BEGIN |
||||
namespace flags_internal { |
||||
|
||||
FlagFastTypeId PrivateHandleAccessor::TypeId(const CommandLineFlag& flag) { |
||||
return flag.TypeId(); |
||||
} |
||||
|
||||
std::unique_ptr<FlagStateInterface> PrivateHandleAccessor::SaveState( |
||||
CommandLineFlag* flag) { |
||||
return flag->SaveState(); |
||||
} |
||||
|
||||
bool PrivateHandleAccessor::ValidateInputValue(const CommandLineFlag& flag, |
||||
absl::string_view value) { |
||||
return flag.ValidateInputValue(value); |
||||
} |
||||
|
||||
void PrivateHandleAccessor::CheckDefaultValueParsingRoundtrip( |
||||
const CommandLineFlag& flag) { |
||||
flag.CheckDefaultValueParsingRoundtrip(); |
||||
} |
||||
|
||||
bool PrivateHandleAccessor::ParseFrom(CommandLineFlag* flag, |
||||
absl::string_view value, |
||||
flags_internal::FlagSettingMode set_mode, |
||||
flags_internal::ValueSource source, |
||||
std::string* error) { |
||||
return flag->ParseFrom(value, set_mode, source, error); |
||||
} |
||||
|
||||
} // namespace flags_internal
|
||||
ABSL_NAMESPACE_END |
||||
} // namespace absl
|
||||
|
@ -0,0 +1,52 @@ |
||||
//
|
||||
// Copyright 2020 The Abseil Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef ABSL_FLAGS_INTERNAL_PRIVATE_HANDLE_ACCESSOR_H_ |
||||
#define ABSL_FLAGS_INTERNAL_PRIVATE_HANDLE_ACCESSOR_H_ |
||||
|
||||
#include "absl/flags/internal/commandlineflag.h" |
||||
|
||||
namespace absl { |
||||
ABSL_NAMESPACE_BEGIN |
||||
namespace flags_internal { |
||||
|
||||
// This class serves as a trampoline to access private methods of
|
||||
// CommandLineFlag. This class is intended for use exclusively internally inside
|
||||
// of the Abseil Flags implementation.
|
||||
class PrivateHandleAccessor { |
||||
public: |
||||
// Access to CommandLineFlag::TypeId.
|
||||
static FlagFastTypeId TypeId(const CommandLineFlag& flag); |
||||
|
||||
// Access to CommandLineFlag::SaveState.
|
||||
static std::unique_ptr<FlagStateInterface> SaveState(CommandLineFlag* flag); |
||||
|
||||
// Access to CommandLineFlag::ValidateInputValue.
|
||||
static bool ValidateInputValue(const CommandLineFlag& flag, |
||||
absl::string_view value); |
||||
|
||||
// Access to CommandLineFlag::CheckDefaultValueParsingRoundtrip.
|
||||
static void CheckDefaultValueParsingRoundtrip(const CommandLineFlag& flag); |
||||
|
||||
static bool ParseFrom(CommandLineFlag* flag, absl::string_view value, |
||||
flags_internal::FlagSettingMode set_mode, |
||||
flags_internal::ValueSource source, std::string* error); |
||||
}; |
||||
|
||||
} // namespace flags_internal
|
||||
ABSL_NAMESPACE_END |
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_FLAGS_INTERNAL_PRIVATE_HANDLE_ACCESSOR_H_
|
Loading…
Reference in new issue