private_handle_accessor.cc 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #include "absl/flags/internal/private_handle_accessor.h"
  16. #include <memory>
  17. #include <string>
  18. #include "absl/base/config.h"
  19. #include "absl/flags/commandlineflag.h"
  20. #include "absl/flags/internal/commandlineflag.h"
  21. #include "absl/strings/string_view.h"
  22. namespace absl {
  23. ABSL_NAMESPACE_BEGIN
  24. namespace flags_internal {
  25. FlagFastTypeId PrivateHandleAccessor::TypeId(const CommandLineFlag& flag) {
  26. return flag.TypeId();
  27. }
  28. std::unique_ptr<FlagStateInterface> PrivateHandleAccessor::SaveState(
  29. CommandLineFlag& flag) {
  30. return flag.SaveState();
  31. }
  32. bool PrivateHandleAccessor::IsSpecifiedOnCommandLine(
  33. const CommandLineFlag& flag) {
  34. return flag.IsSpecifiedOnCommandLine();
  35. }
  36. bool PrivateHandleAccessor::ValidateInputValue(const CommandLineFlag& flag,
  37. absl::string_view value) {
  38. return flag.ValidateInputValue(value);
  39. }
  40. void PrivateHandleAccessor::CheckDefaultValueParsingRoundtrip(
  41. const CommandLineFlag& flag) {
  42. flag.CheckDefaultValueParsingRoundtrip();
  43. }
  44. bool PrivateHandleAccessor::ParseFrom(CommandLineFlag& flag,
  45. absl::string_view value,
  46. flags_internal::FlagSettingMode set_mode,
  47. flags_internal::ValueSource source,
  48. std::string& error) {
  49. return flag.ParseFrom(value, set_mode, source, error);
  50. }
  51. } // namespace flags_internal
  52. ABSL_NAMESPACE_END
  53. } // namespace absl