DebugStringConvertibleItem.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. #include <react/debug/DebugStringConvertible.h>
  10. namespace facebook {
  11. namespace react {
  12. #if RN_DEBUG_STRING_CONVERTIBLE
  13. // Trivial implementation of `DebugStringConvertible` abstract class
  14. // with a stored output; useful for assembling `DebugStringConvertible` values
  15. // in custom implementations of `getDebugChildren` and `getDebugProps`.
  16. class DebugStringConvertibleItem : public DebugStringConvertible {
  17. public:
  18. DebugStringConvertibleItem(const DebugStringConvertibleItem &item) = default;
  19. DebugStringConvertibleItem(
  20. const std::string &name = "",
  21. const std::string &value = "",
  22. const SharedDebugStringConvertibleList &props = {},
  23. const SharedDebugStringConvertibleList &children = {});
  24. std::string getDebugName() const override;
  25. std::string getDebugValue() const override;
  26. SharedDebugStringConvertibleList getDebugChildren() const override;
  27. SharedDebugStringConvertibleList getDebugProps() const override;
  28. private:
  29. std::string name_;
  30. std::string value_;
  31. SharedDebugStringConvertibleList debugProps_;
  32. SharedDebugStringConvertibleList children_;
  33. };
  34. #endif
  35. } // namespace react
  36. } // namespace facebook