Make GlyphBufferData as another class
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / text-abstraction / segmentation.h
1 #ifndef DALI_PLATFORM_TEXT_ABSTRACTION_SEGMENTATION_H
2 #define DALI_PLATFORM_TEXT_ABSTRACTION_SEGMENTATION_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 // INTERNAL INCLUDES
22 #include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
23 #include <dali/public-api/dali-adaptor-common.h>
24
25 // EXTERNAL INCLUDES
26 #include <dali/public-api/object/base-handle.h>
27
28 namespace Dali
29 {
30 namespace TextAbstraction
31 {
32 namespace Internal DALI_INTERNAL
33 {
34 class Segmentation;
35
36 } // namespace DALI_INTERNAL
37
38 } // namespace TextAbstraction
39
40 namespace TextAbstraction
41 {
42 /**
43  *   Segmentation API
44  *
45  */
46 class DALI_ADAPTOR_API Segmentation : public BaseHandle
47 {
48 public:
49   /**
50    * @brief Create an uninitialized TextAbstraction handle.
51    *
52    */
53   Segmentation();
54
55   /**
56    * @brief Destructor
57    *
58    * This is non-virtual since derived Handle types must not contain data or virtual methods.
59    */
60   ~Segmentation();
61
62   /**
63    * @brief This constructor is used by Segmentation::Get().
64    *
65    * @param[in] implementation A pointer to the internal segmentation object.
66    */
67   explicit DALI_INTERNAL Segmentation(Internal::Segmentation* implementation);
68
69   /**
70    * @brief Retrieve a handle to the Segmentation instance.
71    *
72    * @return A handle to the Segmentation
73    */
74   static Segmentation Get();
75
76   /**
77    * @brief Retrieves the line break info.
78    *
79    * @pre @p breakInfo must have enough space allocated for @p numberOfCharacters.
80    *
81    * Possible values for LineBreakInfo are:
82    *
83    *  - 0 is a LINE_MUST_BREAK.  Text must be broken into a new line.
84    *  - 1 is a LINE_ALLOW_BREAK. Is possible to break the text into a new line.
85    *  - 2 is a LINE_NO_BREAK.    Text can't be broken into a new line.
86    *
87      @verbatim
88      i.e. Hello big\nworld produces:
89           2222212220 22220
90      @endverbatim
91    *
92    * @param[in] text Pointer to the first character of the text coded in UTF32.
93    * @param[in] numberOfCharacters The number of characters.
94    * @param[out] breakInfo The line break info.
95    */
96   void GetLineBreakPositions(const Character* const text,
97                              Length                 numberOfCharacters,
98                              LineBreakInfo*         breakInfo);
99
100   /**
101    * @brief Retrieves the word break info.
102    *
103    * @pre @p breakInfo must have enough space allocated for @p numberOfCharacters.
104    *
105    * Possible values for WordBreakInfo are:
106    *
107    * - 0 is a WORD_BREAK.    Text can be broken into a new word.
108    * - 1 is a WORD_NO_BREAK. Text can't be broken into a new word.
109    *
110      @verbatim
111      i.e. Hello big\nworld produces:
112           1111001100 11110
113      @endverbatim
114    *
115    * @param[in] text Pointer to the first character of the text coded in UTF32.
116    * @param[in] numberOfCharacters The number of characters.
117    * @param[out] breakInfo The word break info.
118    */
119   void GetWordBreakPositions(const Character* const text,
120                              Length                 numberOfCharacters,
121                              WordBreakInfo*         breakInfo);
122
123   /**
124    * @brief Retrieves the line break info from utf8.
125    *
126    * @pre @p breakInfo must have enough space allocated for @p numberOfCharacters.
127    *
128    * Possible values for LineBreakInfo are:
129    *
130    *  - 0 is a LINE_MUST_BREAK.  Text must be broken into a new line.
131    *  - 1 is a LINE_ALLOW_BREAK. Is possible to break the text into a new line.
132    *  - 2 is a LINE_NO_BREAK.    Text can't be broken into a new line.
133    *
134      @verbatim
135      i.e. Hello big\nworld produces:
136           2222212220 22220
137      @endverbatim
138    *
139    * @param[in] text Pointer to the first character of the text coded in UTF8.
140    * @param[in] numberOfCharacters The number of characters.
141    * @param[out] breakInfo The line break info.
142    */
143   void GetLineBreakPositionsUtf8(const uint8_t* const text,
144                                  Length               numberOfCharacters,
145                                  LineBreakInfo*       breakInfo);
146
147   /**
148    * @brief Retrieves the word break info from utf8.
149    *
150    * @pre @p breakInfo must have enough space allocated for @p numberOfCharacters.
151    *
152    * Possible values for WordBreakInfo are:
153    *
154    * - 0 is a WORD_BREAK.    Text can be broken into a new word.
155    * - 1 is a WORD_NO_BREAK. Text can't be broken into a new word.
156    *
157      @verbatim
158      i.e. Hello big\nworld produces:
159           1111001100 11110
160      @endverbatim
161    *
162    * @param[in] text Pointer to the first character of the text coded in UTF8.
163    * @param[in] numberOfCharacters The number of characters.
164    * @param[out] breakInfo The word break info.
165    */
166   void GetWordBreakPositionsUtf8(const uint8_t* const text,
167                                  Length               numberOfCharacters,
168                                  WordBreakInfo*       breakInfo);
169 };
170
171 } // namespace TextAbstraction
172
173 } // namespace Dali
174
175 #endif // DALI_PLATFORM_TEXT_ABSTRACTION_SEGMENTATION_H