Make GlyphBufferData as another class
[platform/core/uifw/dali-adaptor.git] / dali / internal / text / text-abstraction / segmentation-impl.h
1 #ifndef DALI_INTERNAL_TEXT_ABSTRACTION_SEGMENTATION_IMPL_H
2 #define DALI_INTERNAL_TEXT_ABSTRACTION_SEGMENTATION_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/public-api/object/base-object.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/text-abstraction/segmentation.h>
26
27 namespace Dali
28 {
29 namespace TextAbstraction
30 {
31 namespace Internal
32 {
33 /**
34  * Implementation of the Segmentation
35  */
36
37 class Segmentation : public BaseObject
38 {
39 public:
40   /**
41    * Constructor
42    */
43   Segmentation();
44
45   /**
46    * Destructor
47    */
48   ~Segmentation();
49
50   /**
51    * @copydoc Dali::Segmentation::Get()
52    */
53   static TextAbstraction::Segmentation Get();
54
55   /**
56    * @copydoc Dali::Segmentation::GetLineBreakPositions()
57    */
58   void GetLineBreakPositions(const Character* const text,
59                              Length                 numberOfCharacters,
60                              LineBreakInfo*         breakInfo);
61
62   /**
63    * @copydoc Dali::Segmentation::GetWordBreakPositions()
64    */
65   void GetWordBreakPositions(const Character* const text,
66                              Length                 numberOfCharacters,
67                              WordBreakInfo*         breakInfo);
68
69   /**
70    * @copydoc Dali::Segmentation::GetLineBreakPositionsUtf8()
71    */
72   void GetLineBreakPositionsUtf8(const uint8_t* const text,
73                                  Length               numberOfCharacters,
74                                  LineBreakInfo*       breakInfo);
75
76   /**
77    * @copydoc Dali::Segmentation::GetWordBreakPositionsUtf8()
78    */
79   void GetWordBreakPositionsUtf8(const uint8_t* const text,
80                                  Length               numberOfCharacters,
81                                  WordBreakInfo*       breakInfo);
82
83 private:
84   /**
85    * Helper for lazy initialization.
86    */
87   void CreatePlugin();
88
89 private:
90   // Undefined copy constructor.
91   Segmentation(const Segmentation&);
92
93   // Undefined assignment constructor.
94   Segmentation& operator=(Segmentation&);
95
96 private:
97   struct Plugin;
98   Plugin* mPlugin;
99
100 }; // class Segmentation
101
102 } // namespace Internal
103
104 } // namespace TextAbstraction
105
106 inline static TextAbstraction::Internal::Segmentation& GetImplementation(TextAbstraction::Segmentation& segmentation)
107 {
108   DALI_ASSERT_ALWAYS(segmentation && "segmentation handle is empty");
109   BaseObject& handle = segmentation.GetBaseObject();
110   return static_cast<TextAbstraction::Internal::Segmentation&>(handle);
111 }
112
113 inline static const TextAbstraction::Internal::Segmentation& GetImplementation(const TextAbstraction::Segmentation& segmentation)
114 {
115   DALI_ASSERT_ALWAYS(segmentation && "segmentation handle is empty");
116   const BaseObject& handle = segmentation.GetBaseObject();
117   return static_cast<const TextAbstraction::Internal::Segmentation&>(handle);
118 }
119
120 } // namespace Dali
121
122 #endif // DALI_INTERNAL_TEXT_ABSTRACTION_SEGMENTATION_IMPL_H