1 #ifndef DALI_TOOLKIT_INTERNAL_TEXT_SPANNABLE_IMPL_H
2 #define DALI_TOOLKIT_INTERNAL_TEXT_SPANNABLE_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.
22 #include <dali-toolkit/devel-api/text/spannable.h>
25 #include <dali-toolkit/internal/text/spannable/spanned-impl.h>
37 typedef IntrusivePtr<Spannable> SpannablePtr;
38 typedef const Spannable* SpannableConstPtr;
41 * @copydoc Dali::Toolkit::Text::Spannable
43 class Spannable : public Spanned
47 * This constructor is only used by derived classes.
52 * @brief Virtual destructor.
54 * A reference counted object may only be deleted by calling Unreference()
56 virtual ~Spannable() = 0;
58 // Removed constructors and assignment operators
60 Spannable(const Spannable&) = delete; ///< Deleted copy constructor
61 Spannable(Spannable&&) = delete; ///< Deleted move constructor
62 Spannable& operator=(const Spannable&) = delete; ///< Deleted copy assignment operator
63 Spannable& operator=(Spannable&&) = delete; ///< Deleted move assignment operator
67 * @copydoc Dali::Toolkit::Text::Spannable::AttachSpan()
69 virtual bool AttachSpan(const Dali::Toolkit::Text::BaseSpan& styleSpan, const Dali::Toolkit::Text::Range& range) = 0;
72 * @copydoc Dali::Toolkit::Text::Spannable::DetachSpan()
74 virtual bool DetachSpan(const Dali::Toolkit::Text::BaseSpan& styleSpan) = 0;
78 } // namespace Internal
81 * Helper methods for public API.
83 inline Internal::Spannable& GetImplementation(Dali::Toolkit::Text::Spannable& spannable)
85 DALI_ASSERT_ALWAYS(spannable && "spannable handle is empty");
87 BaseObject& handle = spannable.GetBaseObject();
89 return static_cast<Internal::Spannable&>(handle);
92 inline const Internal::Spannable& GetImplementation(const Dali::Toolkit::Text::Spannable& spannable)
94 DALI_ASSERT_ALWAYS(spannable && "spannable handle is empty");
96 const BaseObject& handle = spannable.GetBaseObject();
98 return static_cast<const Internal::Spannable&>(handle);
103 } // namespace Toolkit
105 // Allow Spannable to be treated as a POD type
107 struct TypeTraits<Dali::Toolkit::Text::Internal::Spannable> : public Dali::BasicTypes<Dali::Toolkit::Text::Internal::Spannable>
111 IS_TRIVIAL_TYPE = true
117 #endif // DALI_TOOLKIT_INTERNAL_TEXT_SPANNABLE_IMPL_H