PropertyFetcher.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (C) 2017 The Android Open Source Project
  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. * http://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 "utils.h"
  17. #include <android-base/logging.h>
  18. #include <android-base/properties.h>
  19. namespace android {
  20. namespace vintf {
  21. namespace details {
  22. std::string PropertyFetcherNoOp::getProperty(const std::string&,
  23. const std::string& defaultValue) const {
  24. return defaultValue;
  25. }
  26. uint64_t PropertyFetcherNoOp::getUintProperty(const std::string&, uint64_t,
  27. uint64_t defaultValue) const {
  28. return defaultValue;
  29. }
  30. bool PropertyFetcherNoOp::getBoolProperty(const std::string&, bool defaultValue) const {
  31. return defaultValue;
  32. }
  33. std::string PropertyFetcherImpl::getProperty(const std::string& key,
  34. const std::string& defaultValue) const {
  35. return android::base::GetProperty(key, defaultValue);
  36. }
  37. uint64_t PropertyFetcherImpl::getUintProperty(const std::string& key, uint64_t defaultValue,
  38. uint64_t max) const {
  39. return android::base::GetUintProperty(key, defaultValue, max);
  40. }
  41. bool PropertyFetcherImpl::getBoolProperty(const std::string& key, bool defaultValue) const {
  42. return android::base::GetBoolProperty(key, defaultValue);
  43. }
  44. } // namespace details
  45. } // namespace vintf
  46. } // namespace android