1 #ifndef DALI_TOOLKIT_TEXT_RANGE_H
2 #define DALI_TOOLKIT_TEXT_RANGE_H
5 * Copyright (c) 2024 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/public-api/dali-toolkit-common.h>
23 #include <dali/public-api/object/base-handle.h>
31 namespace Internal DALI_INTERNAL
37 * @brief Base structure for different text-spans.
38 * The application can attach and detach spans on range of text for text-controller.
39 * Used to modify text style dynamically at runtime on character level.
41 * A text-span contains set of attributes of specific style for text.
43 * To receive a particular text-span, the application has to create span through its builder.
45 * @note An instance of this class cannot be created.
48 class DALI_TOOLKIT_API Range : public BaseHandle
52 * @brief Create an initialized range.
54 * @param[in] startIndex the start index of range (included)
55 * @param[in] endIndex the end index of range (included)
57 * @return A handle to a newly allocated Dali resource
59 static Range New(u_int32_t startIndex, u_int32_t endIndex);
62 * @brief Creates an uninitialized Range handle.
64 * Calling member functions with an uninitialized Range handle is not allowed.
69 * @brief Copy constructor.
71 * @param[in] rhs A reference to the copied handle
73 Range(const Range& rhs);
76 * @brief Move constructor.
78 * @param[in] rhs A reference to the handle to move
83 * @brief Assignment operator.
85 * @param[in] handle A reference to the copied handle
86 * @return A reference to this
88 Range& operator=(const Range& handle);
91 * @brief Move assignment operator.
93 * @param[in] rhs A reference to the handle to move
94 * @return A reference to this handle
96 Range& operator=(Range&& rhs);
99 * @brief Non virtual destructor.
105 * @brief Downcasts to a Range handle.
106 * If handle is not a Range, the returned handle is left uninitialized.
108 * @param[in] handle Handle to an object
109 * @return Range handle or an uninitialized handle
111 static Range DownCast(BaseHandle handle);
113 public: // Not intended for application developers
116 * @brief Internal constructor.
118 * @param[in] range Pointer to internal Range
120 explicit DALI_INTERNAL Range(Internal::Range* range);
125 * @brief Retrive the start index of range
126 * @return the 32-bit unsigned int.
128 u_int32_t GetStartIndex() const;
131 * @brief Retrive the end index of range
132 * @return the 32-bit unsigned int.
134 u_int32_t GetEndIndex() const;
137 * @brief Retrive the number of indices of range (endIndex - startIndex +1)
138 * @return the 32-bit unsigned int.
140 u_int32_t GetNumberOfIndices() const;
145 } // namespace Toolkit
149 #endif // DALI_TOOLKIT_TEXT_RANGE_H