ReactNativeConfig.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #pragma once
  8. #include <string>
  9. namespace facebook {
  10. namespace react {
  11. /**
  12. * ReactNative configuration as provided by the hosting app.
  13. * Provide a sub-class implementation to allow app specific customization.
  14. */
  15. class ReactNativeConfig {
  16. public:
  17. ReactNativeConfig();
  18. virtual ~ReactNativeConfig();
  19. virtual bool getBool(const std::string &param) const = 0;
  20. virtual std::string getString(const std::string &param) const = 0;
  21. virtual int64_t getInt64(const std::string &param) const = 0;
  22. virtual double getDouble(const std::string &param) const = 0;
  23. };
  24. /**
  25. * Empty configuration that will always provide "falsy" values.
  26. */
  27. class EmptyReactNativeConfig : public ReactNativeConfig {
  28. public:
  29. EmptyReactNativeConfig();
  30. bool getBool(const std::string &param) const override;
  31. std::string getString(const std::string &param) const override;
  32. int64_t getInt64(const std::string &param) const override;
  33. double getDouble(const std::string &param) const override;
  34. };
  35. } // namespace react
  36. } // namespace facebook