1 #ifndef DALI_TOOLKIT_INTERNAL_TEXT_RANGE_IMPL_H
2 #define DALI_TOOLKIT_INTERNAL_TEXT_RANGE_IMPL_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.
25 #include <dali-toolkit/devel-api/text/range.h>
26 #include <dali/public-api/object/base-object.h>
38 typedef IntrusivePtr<Range> RangePtr;
41 * @copydoc Dali::Toolkit::Text::Range
43 class Range : public BaseObject
47 * @brief Creates a new Range.
49 * @param[in] startIndex the start index of range (included)
50 * @param[in] endIndex the end index of range (included)
52 * @return A public handle to the newly allocated Range.
54 static Dali::Toolkit::Text::Range New(u_int32_t startIndex, u_int32_t endIndex);
59 * A reference counted object may only be deleted by calling Unreference()
65 * @brief Constructs a new Range.
67 * @param[in] startIndex the start index of range (included)
68 * @param[in] endIndex the end index of range (included)
71 Range(u_int32_t startIndex, u_int32_t endIndex);
75 * @copydoc Dali::Toolkit::Text::Range::GetStartIndex()
77 u_int32_t GetStartIndex() const;
80 * @copydoc Dali::Toolkit::Text::Range::GetEndIndex()
82 u_int32_t GetEndIndex() const;
85 * @copydoc Dali::Toolkit::Text::Range::GetNumberOfIndices()
87 u_int32_t GetNumberOfIndices() const;
90 Range(const Range&) = delete; ///< Deleted copy constructor
91 Range(Range&&) = delete; ///< Deleted move constructor
92 Range& operator=(const Range&) = delete; ///< Deleted copy assignment operator
93 Range& operator=(Range&&) = delete; ///< Deleted move assignment operator
98 std::unique_ptr<Impl> mImpl{nullptr};
102 } // namespace Internal
105 * Helper methods for public API.
107 inline Internal::Range& GetImplementation(Dali::Toolkit::Text::Range& range)
109 DALI_ASSERT_ALWAYS(range && "range handle is empty");
111 BaseObject& handle = range.GetBaseObject();
113 return static_cast<Internal::Range&>(handle);
116 inline const Internal::Range& GetImplementation(const Dali::Toolkit::Text::Range& range)
118 DALI_ASSERT_ALWAYS(range && "range handle is empty");
120 const BaseObject& handle = range.GetBaseObject();
122 return static_cast<const Internal::Range&>(handle);
127 } // namespace Toolkit
129 // Allow Range to be treated as a POD type
131 struct TypeTraits<Dali::Toolkit::Text::Internal::Range> : public Dali::BasicTypes<Dali::Toolkit::Text::Internal::Range>
135 IS_TRIVIAL_TYPE = true
141 #endif // DALI_TOOLKIT_INTERNAL_TEXT_RANGE_IMPL_H