|
|
|
//
|
|
|
|
// 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"
|
|
|
|
|
Export of internal Abseil changes
--
b2b94b9f533e4f9ae2a2df9de56ccb3b18f31d0d by Gennadiy Rozental <rogeeff@google.com>:
Internal change
PiperOrigin-RevId: 314366138
--
7a5ac6be82741aec5b327d7b67efd14d69deed6a by Gennadiy Rozental <rogeeff@google.com>:
Introduce Abseil prefixed dynamic annotation macros.
PiperOrigin-RevId: 314228914
--
33e7c605cb1be9bd48bd3590b1eedccd68d3bd1b by Gennadiy Rozental <rogeeff@google.com>:
Fixing missing includes and remove unnecessary ones.
PiperOrigin-RevId: 314217909
--
6a3c5c26bfa13317bf0a880f13d0e4be0b971b76 by Gennadiy Rozental <rogeeff@google.com>:
Import of CCTZ from GitHub.
PiperOrigin-RevId: 314209576
--
f7795aa68020af4a6b4905531ba951e04b88966a by Abseil Team <absl-team@google.com>:
absl::FormatTime() and absl::ParseTime() format specifiers:
- %EZ now accepts 'z' in addition to 'Z' as a synonym for +00:00.
- %ET is introduced, producing 'T' on output, and accepting 'T'
or 't' on input. This is for the RFC3339 date-time separator.
PiperOrigin-RevId: 313945137
--
87c437ce3aab3f59a7546e44a28cd1c8aaa152c3 by Laramie Leavitt <lar@google.com>:
Rollback
PiperOrigin-RevId: 313868206
--
8049b74349486a0026932b86d29c380b195e1cba by Laramie Leavitt <lar@google.com>:
Remove the MockingBitGenBase base class in favor of type-erasure in BitGenRef.
In Abseil random, mocking was split across two different classes,
MockingBitGenBase and MockingBitGen. This split existed because Google Mock is a
test-only library that we don't link into production, so MockingBitGenBase
provided a low-overhead scaffold used to lookup mocks when in test code, but
which is unused in production code.
That has been replaced by type-erasure which looks for a method named
CallImpl with the correct signature.
Weaken the coupling between MockingBitGen, DistributionCaller, and MockOverloadSet.
Rename CallImpl to InvokeMock()
Previously, the implementation of DistributionCaller was also split across different files using explicit instantiation of the DistributionCaller struct and some details in the Mocking classes. Now Distribution caller uses the presence of the InvokeMock() method to choose whether to use the mockable call path or the default call path.
PiperOrigin-RevId: 313848695
--
1741d80e08050e1939605f70ca6ff64809785c85 by Gennadiy Rozental <rogeeff@google.com>:
Introduce public interface to access reflection handle corresponding the flag.
This interface will be the only official way to access flag reflection information from the flag object. The other internal methods will eventually disappear.
PiperOrigin-RevId: 313734006
--
c375bead457de29d9c29595d16c66d3e5125b585 by Abseil Team <absl-team@google.com>:
Improve documentation of absl::c_partial_sort_copy.
This function takes no middle parameter, instead using the size of the result
container to determine the size of the partial sort.
PiperOrigin-RevId: 313656062
--
bbc759d43656b1b996ad558f23c852a9f14129d2 by Gennadiy Rozental <rogeeff@google.com>:
Eliminate dynamic annotation symbols in the library.
PiperOrigin-RevId: 313650817
GitOrigin-RevId: b2b94b9f533e4f9ae2a2df9de56ccb3b18f31d0d
Change-Id: Ic7a11bbcb723f3ff6a7e2f214bff0a92c6f8ab4d
5 years ago
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "absl/base/config.h"
|
|
|
|
#include "absl/flags/commandlineflag.h"
|
|
|
|
#include "absl/flags/internal/commandlineflag.h"
|
|
|
|
#include "absl/strings/string_view.h"
|
|
|
|
|
|
|
|
namespace absl {
|
|
|
|
ABSL_NAMESPACE_BEGIN
|
|
|
|
namespace flags_internal {
|
|
|
|
|
|
|
|
FlagFastTypeId PrivateHandleAccessor::TypeId(const CommandLineFlag& flag) {
|
|
|
|
return flag.TypeId();
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<FlagStateInterface> PrivateHandleAccessor::SaveState(
|
Export of internal Abseil changes
--
7d0468a6610ed85586d5c87fd65de8dac5118923 by Derek Mauro <dmauro@google.com>:
Import of CCTZ from GitHub.
PiperOrigin-RevId: 313226473
--
1131ef6d116f5ce7d46537a82f300ea06dcaaa53 by Gennadiy Rozental <rogeeff@google.com>:
Migrate internal interface to use mutable references.
PiperOrigin-RevId: 312931131
--
96225212a9f5fbd0b38c71fe65539164992c7c3b by Laramie Leavitt <lar@google.com>:
Remove random/internal/distributions.h
This file was something of an historical artifact. All of the related
code has either been removed or migraged, and so the only remaining type
belongs with uniform_helper.h, as it is used to infer the return type
of the absl::Uniform method in a few cases.
PiperOrigin-RevId: 312878173
--
6dcbd5be58ad425e08740ff64088373ee7fe4a72 by Mark Barolak <mbar@google.com>:
Release the StrFormat test case for Cords to open source.
PiperOrigin-RevId: 312707974
--
34484d18dfb63a0a7ad6e2aaeb570e33592968be by Abseil Team <absl-team@google.com>:
Let Cord::Cord(string&&), Cord::operator=(string&&),
Cord::Append(string&&), and Cord::Prepend(string&&) steal string data
and embed it into the Cord as a single external chunk, instead of
copying it into flat chunks (at most 4083-byte each).
Stealing string data is faster, but it creates a long chunk, which leads
to a higher more memory usage if its subcords are created and outlive
the whole Cord.
These functions revert to copying the data if any of the following
conditions holds:
- string size is at most kMaxBytesToCopy (511), to avoid the overhead
of an external chunk for short strings;
- less than half of string capacity is used, to avoid pinning to much
unused memory.
PiperOrigin-RevId: 312683785
GitOrigin-RevId: 7d0468a6610ed85586d5c87fd65de8dac5118923
Change-Id: If79b5a1dfe6d53a8ddddbc7da84338f11fc4cfa3
5 years ago
|
|
|
CommandLineFlag& flag) {
|
|
|
|
return flag.SaveState();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool PrivateHandleAccessor::IsSpecifiedOnCommandLine(
|
|
|
|
const CommandLineFlag& flag) {
|
|
|
|
return flag.IsSpecifiedOnCommandLine();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool PrivateHandleAccessor::ValidateInputValue(const CommandLineFlag& flag,
|
|
|
|
absl::string_view value) {
|
|
|
|
return flag.ValidateInputValue(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PrivateHandleAccessor::CheckDefaultValueParsingRoundtrip(
|
|
|
|
const CommandLineFlag& flag) {
|
|
|
|
flag.CheckDefaultValueParsingRoundtrip();
|
|
|
|
}
|
|
|
|
|
Export of internal Abseil changes
--
7d0468a6610ed85586d5c87fd65de8dac5118923 by Derek Mauro <dmauro@google.com>:
Import of CCTZ from GitHub.
PiperOrigin-RevId: 313226473
--
1131ef6d116f5ce7d46537a82f300ea06dcaaa53 by Gennadiy Rozental <rogeeff@google.com>:
Migrate internal interface to use mutable references.
PiperOrigin-RevId: 312931131
--
96225212a9f5fbd0b38c71fe65539164992c7c3b by Laramie Leavitt <lar@google.com>:
Remove random/internal/distributions.h
This file was something of an historical artifact. All of the related
code has either been removed or migraged, and so the only remaining type
belongs with uniform_helper.h, as it is used to infer the return type
of the absl::Uniform method in a few cases.
PiperOrigin-RevId: 312878173
--
6dcbd5be58ad425e08740ff64088373ee7fe4a72 by Mark Barolak <mbar@google.com>:
Release the StrFormat test case for Cords to open source.
PiperOrigin-RevId: 312707974
--
34484d18dfb63a0a7ad6e2aaeb570e33592968be by Abseil Team <absl-team@google.com>:
Let Cord::Cord(string&&), Cord::operator=(string&&),
Cord::Append(string&&), and Cord::Prepend(string&&) steal string data
and embed it into the Cord as a single external chunk, instead of
copying it into flat chunks (at most 4083-byte each).
Stealing string data is faster, but it creates a long chunk, which leads
to a higher more memory usage if its subcords are created and outlive
the whole Cord.
These functions revert to copying the data if any of the following
conditions holds:
- string size is at most kMaxBytesToCopy (511), to avoid the overhead
of an external chunk for short strings;
- less than half of string capacity is used, to avoid pinning to much
unused memory.
PiperOrigin-RevId: 312683785
GitOrigin-RevId: 7d0468a6610ed85586d5c87fd65de8dac5118923
Change-Id: If79b5a1dfe6d53a8ddddbc7da84338f11fc4cfa3
5 years ago
|
|
|
bool PrivateHandleAccessor::ParseFrom(CommandLineFlag& flag,
|
|
|
|
absl::string_view value,
|
|
|
|
flags_internal::FlagSettingMode set_mode,
|
|
|
|
flags_internal::ValueSource source,
|
Export of internal Abseil changes
--
7d0468a6610ed85586d5c87fd65de8dac5118923 by Derek Mauro <dmauro@google.com>:
Import of CCTZ from GitHub.
PiperOrigin-RevId: 313226473
--
1131ef6d116f5ce7d46537a82f300ea06dcaaa53 by Gennadiy Rozental <rogeeff@google.com>:
Migrate internal interface to use mutable references.
PiperOrigin-RevId: 312931131
--
96225212a9f5fbd0b38c71fe65539164992c7c3b by Laramie Leavitt <lar@google.com>:
Remove random/internal/distributions.h
This file was something of an historical artifact. All of the related
code has either been removed or migraged, and so the only remaining type
belongs with uniform_helper.h, as it is used to infer the return type
of the absl::Uniform method in a few cases.
PiperOrigin-RevId: 312878173
--
6dcbd5be58ad425e08740ff64088373ee7fe4a72 by Mark Barolak <mbar@google.com>:
Release the StrFormat test case for Cords to open source.
PiperOrigin-RevId: 312707974
--
34484d18dfb63a0a7ad6e2aaeb570e33592968be by Abseil Team <absl-team@google.com>:
Let Cord::Cord(string&&), Cord::operator=(string&&),
Cord::Append(string&&), and Cord::Prepend(string&&) steal string data
and embed it into the Cord as a single external chunk, instead of
copying it into flat chunks (at most 4083-byte each).
Stealing string data is faster, but it creates a long chunk, which leads
to a higher more memory usage if its subcords are created and outlive
the whole Cord.
These functions revert to copying the data if any of the following
conditions holds:
- string size is at most kMaxBytesToCopy (511), to avoid the overhead
of an external chunk for short strings;
- less than half of string capacity is used, to avoid pinning to much
unused memory.
PiperOrigin-RevId: 312683785
GitOrigin-RevId: 7d0468a6610ed85586d5c87fd65de8dac5118923
Change-Id: If79b5a1dfe6d53a8ddddbc7da84338f11fc4cfa3
5 years ago
|
|
|
std::string& error) {
|
|
|
|
return flag.ParseFrom(value, set_mode, source, error);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace flags_internal
|
|
|
|
ABSL_NAMESPACE_END
|
|
|
|
} // namespace absl
|
|
|
|
|