From e1b8841c7aff44fc820c853020bf321a4dc31bb2 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Mon, 9 Mar 2020 16:32:33 -0700 Subject: [PATCH] Fabric: non-const `AttributedString::getFragments()` Summary: This diff adds a non-const method to AttributedString that allows accessing a list of fragments by reference. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D20268040 fbshipit-source-id: cd0c8be126607b99686f7f596106b38fbe3da230 --- ReactCommon/fabric/attributedstring/AttributedString.cpp | 6 +++++- ReactCommon/fabric/attributedstring/AttributedString.h | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ReactCommon/fabric/attributedstring/AttributedString.cpp b/ReactCommon/fabric/attributedstring/AttributedString.cpp index 01ae1188b25..7d872e65e9c 100644 --- a/ReactCommon/fabric/attributedstring/AttributedString.cpp +++ b/ReactCommon/fabric/attributedstring/AttributedString.cpp @@ -82,7 +82,11 @@ void AttributedString::prependAttributedString( attributedString.fragments_.end()); } -const Fragments &AttributedString::getFragments() const { +Fragments const &AttributedString::getFragments() const { + return fragments_; +} + +Fragments &AttributedString::getFragments() { return fragments_; } diff --git a/ReactCommon/fabric/attributedstring/AttributedString.h b/ReactCommon/fabric/attributedstring/AttributedString.h index c6b07edd714..9da9d2f260e 100644 --- a/ReactCommon/fabric/attributedstring/AttributedString.h +++ b/ReactCommon/fabric/attributedstring/AttributedString.h @@ -73,9 +73,14 @@ class AttributedString : public Sealable, public DebugStringConvertible { void prependAttributedString(const AttributedString &attributedString); /* - * Returns read-only reference to a list of fragments. + * Returns a read-only reference to a list of fragments. */ - const Fragments &getFragments() const; + Fragments const &getFragments() const; + + /* + * Returns a reference to a list of fragments. + */ + Fragments &getFragments(); /* * Returns a string constructed from all strings in all fragments.