1 #ifndef DALI_TOOLKIT_TEXT_SPANNED_H
2 #define DALI_TOOLKIT_TEXT_SPANNED_H
5 * Copyright (c) 2023 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>
26 #include <dali/public-api/common/vector-wrapper.h>
34 namespace Internal DALI_INTERNAL
40 * @brief Interface for text that has spans objects attached to ranges of it.
41 * It provides uniform APIs for read-only access to many different kinds of formatted character sequences.
43 * @note An instance of this class cannot be created.
46 class DALI_TOOLKIT_API Spanned : public CharacterSequence
50 * @brief Creates an uninitialized Spanned handle.
52 * Calling member functions with an uninitialized Spanned handle is not allowed.
57 * @brief Copy constructor.
59 * @param[in] rhs A reference to the copied handle
61 Spanned(const Spanned& rhs);
64 * @brief Move constructor.
66 * @param[in] rhs A reference to the handle to move
68 Spanned(Spanned&& rhs);
71 * @brief Assignment operator.
73 * @param[in] handle A reference to the copied handle
74 * @return A reference to this
76 Spanned& operator=(const Spanned& handle);
79 * @brief Move assignment operator.
81 * @param[in] rhs A reference to the handle to move
82 * @return A reference to this handle
84 Spanned& operator=(Spanned&& rhs);
87 * @brief Non virtual destructor.
93 * @brief Downcasts to a Spanned handle.
94 * If handle is not a Spanned, the returned handle is left uninitialized.
96 * @param[in] handle Handle to an object
97 * @return Spanned handle or an uninitialized handle
99 static Spanned DownCast(BaseHandle handle);
103 * @brief Retrieve all spans.
105 * @return list of spans
107 std::vector<BaseSpan> GetAllSpans() const;
110 * @brief Retrieve all spans and ranges. Two lists are mapped by index.
112 * @param[out] spans container to clone spans
113 * @param[out] ranges container to clone ranges
115 void RetrieveAllSpansAndRanges(std::vector<BaseSpan>& spans, std::vector<Range>& ranges) const;
117 public: // Not intended for application developers
120 * @brief Internal constructor.
122 * @param[in] spanned Pointer to internal Spanned
124 explicit DALI_INTERNAL Spanned(Internal::Spanned* spanned);
130 } // namespace Toolkit
134 #endif // DALI_TOOLKIT_TEXT_SPANNED_H