Spannable: Add BoldSpan
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / spannable / spans / bold-span-impl.h
1 #ifndef DALI_TOOLKIT_INTERNAL_TEXT_BOLDSPAN_IMPL_H
2 #define DALI_TOOLKIT_INTERNAL_TEXT_BOLDSPAN_IMPL_H
3
4 /*
5  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali-toolkit/devel-api/text/spans/bold-span.h>
23
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/internal/text/spannable/spans/base-span-impl.h>
26 #include <dali-toolkit/internal/text/logical-model-impl.h>
27
28 namespace Dali
29 {
30 namespace Toolkit
31 {
32 namespace Text
33 {
34 namespace Internal
35 {
36 class BoldSpan;
37 using BoldSpanPtr = IntrusivePtr<BoldSpan>;
38
39 /**
40  * @copydoc Dali::Toolkit::Text::BoldSpan
41  */
42 class BoldSpan : public BaseSpan
43 {
44 public:
45   /**
46    * @brief Creates a new BoldSpan object.
47    *
48    * @return Dali::Toolkit::Text::BoldSpan
49    */
50   static Dali::Toolkit::Text::BoldSpan New();
51
52   /**
53    * @brief Construct a new Bold Span object
54    *
55    */
56   BoldSpan();
57
58   ///< Deleted copy constructor
59   BoldSpan(const BoldSpan& rhs) = delete;
60
61   ///< Deleted move constructor
62   BoldSpan(BoldSpan&& rhs) = delete;
63
64   ///< Deleted copy assignment operator
65   BoldSpan& operator=(const BoldSpan& rhs) = delete;
66
67   ///< Deleted move assignment operator
68   BoldSpan& operator=(BoldSpan&& rhs) = delete;
69
70   /**
71    * @brief Destructor
72    * A reference counted object may only be deleted by calling Unreference().
73    */
74   ~BoldSpan() override;
75
76   /**
77    * @copydoc Dali::Toolkit::Text::BaseSpan::CreateStyleCharacterRun
78    */
79   void CreateStyleCharacterRun(IntrusivePtr<LogicalModel>& logicalModel, const Dali::Toolkit::Text::Range& range) const override;
80
81 }; // class BoldSpan
82
83 } // namespace Internal
84
85 // Helpers for public-api forwarding methods
86
87 inline Internal::BoldSpan& GetImplementation(Dali::Toolkit::Text::BoldSpan& boldSpan)
88 {
89   DALI_ASSERT_ALWAYS(boldSpan && "boldSpan handle is empty");
90
91   BaseObject& object = boldSpan.GetBaseObject();
92
93   return static_cast<Internal::BoldSpan&>(object);
94 }
95
96 inline const Internal::BoldSpan& GetImplementation(const Dali::Toolkit::Text::BoldSpan& boldSpan)
97 {
98   DALI_ASSERT_ALWAYS(boldSpan && "boldSpan handle is empty");
99
100   const BaseObject& object = boldSpan.GetBaseObject();
101
102   return static_cast<const Internal::BoldSpan&>(object);
103 }
104
105 } // namespace Text
106
107 } // namespace Toolkit
108
109 } // namespace Dali
110
111 #endif //DALI_TOOLKIT_INTERNAL_TEXT_BOLDSPAN_IMPL_H