1 #ifndef DALI_TOOLKIT_INTERNAL_TEXT_SPANNED_IMPL_H
2 #define DALI_TOOLKIT_INTERNAL_TEXT_SPANNED_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/spanned.h>
25 #include <dali-toolkit/internal/text/string-text/character-sequence-impl.h>
35 class CharacterSequence;
38 typedef IntrusivePtr<Spanned> SpannedPtr;
39 typedef const Spanned* SpannedConstPtr;
42 * @copydoc Dali::Toolkit::Text::Spanned
44 class Spanned : public CharacterSequence
48 * This constructor is only used by derived classes.
53 * @brief Virtual destructor.
55 * A reference counted object may only be deleted by calling Unreference()
57 virtual ~Spanned() = 0;
59 // Removed constructors and assignment operators
60 public: // Constructors
61 Spanned(const Spanned&) = delete; ///< Deleted copy constructor
62 Spanned(Spanned&&) = delete; ///< Deleted move constructor
63 Spanned& operator=(const Spanned&) = delete; ///< Deleted copy assignment operator
64 Spanned& operator=(Spanned&&) = delete; ///< Deleted move assignment operator
68 * @copydoc Dali::Toolkit::Text::Spanned::GetAllSpans()
70 virtual std::vector<Dali::Toolkit::Text::BaseSpan> GetAllSpans() const = 0;
73 * @copydoc Dali::Toolkit::Text::Spanned::RetrieveAllSpansAndRanges()
75 virtual void RetrieveAllSpansAndRanges(std::vector<Dali::Toolkit::Text::BaseSpan>& spans, std::vector<Dali::Toolkit::Text::Range>& ranges) const = 0;
79 } // namespace Internal
82 * Helper methods for public API.
84 inline Internal::Spanned& GetImplementation(Dali::Toolkit::Text::Spanned& spanned)
86 DALI_ASSERT_ALWAYS(spanned && "spanned handle is empty");
88 BaseObject& handle = spanned.GetBaseObject();
90 return static_cast<Internal::Spanned&>(handle);
93 inline const Internal::Spanned& GetImplementation(const Dali::Toolkit::Text::Spanned& spanned)
95 DALI_ASSERT_ALWAYS(spanned && "spanned handle is empty");
97 const BaseObject& handle = spanned.GetBaseObject();
99 return static_cast<const Internal::Spanned&>(handle);
104 } // namespace Toolkit
106 // Allow Spanned to be treated as a POD type
108 struct TypeTraits<Dali::Toolkit::Text::Internal::Spanned> : public Dali::BasicTypes<Dali::Toolkit::Text::Internal::Spanned>
112 IS_TRIVIAL_TYPE = true
118 #endif // DALI_TOOLKIT_INTERNAL_TEXT_SPANNED_IMPL_H