ParagraphAttributes.cpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #include "ParagraphAttributes.h"
  8. #include <react/attributedstring/conversions.h>
  9. #include <react/debug/debugStringConvertibleUtils.h>
  10. #include <react/graphics/conversions.h>
  11. #include <react/utils/FloatComparison.h>
  12. namespace facebook {
  13. namespace react {
  14. bool ParagraphAttributes::operator==(const ParagraphAttributes &rhs) const {
  15. return std::tie(
  16. maximumNumberOfLines,
  17. ellipsizeMode,
  18. textBreakStrategy,
  19. adjustsFontSizeToFit) ==
  20. std::tie(
  21. rhs.maximumNumberOfLines,
  22. rhs.ellipsizeMode,
  23. rhs.textBreakStrategy,
  24. rhs.adjustsFontSizeToFit) &&
  25. floatEquality(minimumFontSize, rhs.minimumFontSize) &&
  26. floatEquality(maximumFontSize, rhs.maximumFontSize);
  27. }
  28. bool ParagraphAttributes::operator!=(const ParagraphAttributes &rhs) const {
  29. return !(*this == rhs);
  30. }
  31. #pragma mark - DebugStringConvertible
  32. #if RN_DEBUG_STRING_CONVERTIBLE
  33. SharedDebugStringConvertibleList ParagraphAttributes::getDebugProps() const {
  34. return {
  35. debugStringConvertibleItem("maximumNumberOfLines", maximumNumberOfLines),
  36. debugStringConvertibleItem("ellipsizeMode", ellipsizeMode),
  37. debugStringConvertibleItem("textBreakStrategy", textBreakStrategy),
  38. debugStringConvertibleItem("adjustsFontSizeToFit", adjustsFontSizeToFit),
  39. debugStringConvertibleItem("minimumFontSize", minimumFontSize),
  40. debugStringConvertibleItem("maximumFontSize", maximumFontSize)};
  41. }
  42. #endif
  43. } // namespace react
  44. } // namespace facebook