1 #ifndef DALI_TOOLKIT_TEXT_SPANNED_H
2 #define DALI_TOOLKIT_TEXT_SPANNED_H
5 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali-toolkit/devel-api/text/character-sequence.h>
23 #include <dali-toolkit/devel-api/text/range.h>
24 #include <dali-toolkit/devel-api/text/spans/base-span.h>
25 #include <dali/public-api/common/dali-vector.h>
33 namespace Internal DALI_INTERNAL
39 * @brief Interface for text that has spans objects attached to ranges of it.
40 * It provides uniform APIs for read-only access to many different kinds of formatted character sequences.
42 * @note An instance of this class cannot be created.
45 class DALI_TOOLKIT_API Spanned : public CharacterSequence
49 * @brief Creates an uninitialized Spanned handle.
51 * Calling member functions with an uninitialized Spanned handle is not allowed.
56 * @brief Copy constructor.
58 * @param[in] rhs A reference to the copied handle
60 Spanned(const Spanned& rhs);
63 * @brief Move constructor.
65 * @param[in] rhs A reference to the handle to move
67 Spanned(Spanned&& rhs);
70 * @brief Assignment operator.
72 * @param[in] handle A reference to the copied handle
73 * @return A reference to this
75 Spanned& operator=(const Spanned& handle);
78 * @brief Move assignment operator.
80 * @param[in] rhs A reference to the handle to move
81 * @return A reference to this handle
83 Spanned& operator=(Spanned&& rhs);
86 * @brief Non virtual destructor.
92 * @brief Downcasts to a Spanned handle.
93 * If handle is not a Spanned, the returned handle is left uninitialized.
95 * @param[in] handle Handle to an object
96 * @return Spanned handle or an uninitialized handle
98 static Spanned DownCast(BaseHandle handle);
102 * @brief Retrieve all spans.
104 * @return list of spans
106 std::vector<BaseSpan> GetAllSpans() const;
109 * @brief Retrieve all spans and ranges. Two lists are mapped by index.
111 * @param[out] spans container to clone spans
112 * @param[out] ranges container to clone ranges
114 void RetrieveAllSpansAndRanges(std::vector<BaseSpan>& spans, std::vector<Range>& ranges) const;
116 public: // Not intended for application developers
119 * @brief Internal constructor.
121 * @param[in] spanned Pointer to internal Spanned
123 explicit DALI_INTERNAL Spanned(Internal::Spanned* spanned);
129 } // namespace Toolkit
133 #endif // DALI_TOOLKIT_TEXT_SPANNED_H