1dd25bb508b4fe7f5dcab84d35fbeca49056b6ae
[platform/core/uifw/dali-adaptor.git] / text / dali / public-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) 2015 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/public-api/text-abstraction/text-abstraction.h>
23
24 // EXTERNAL INCLUDES
25 #include <dali/public-api/object/base-handle.h>
26
27 namespace Dali
28 {
29
30 namespace Internal DALI_INTERNAL
31 {
32
33 namespace TextAbstraction
34 {
35 class Segmentation;
36 } // TextAbstraction
37 } // Internal
38
39 namespace TextAbstraction
40 {
41
42 /**
43  *   Segmentation API
44  *
45  */
46 class DALI_IMPORT_API Segmentation : public BaseHandle
47 {
48
49 public:
50
51   /**
52    * @brief Create an uninitialized TextAbstraction handle.
53    *
54    */
55   Segmentation();
56
57   /**
58    * @brief Destructor
59    *
60    * This is non-virtual since derived Handle types must not contain data or virtual methods.
61    */
62   ~Segmentation();
63
64   /**
65    * @brief This constructor is used by Segmentation::Get().
66    *
67    * @param[in] implementation A pointer to the internal segmentation object.
68    */
69   explicit DALI_INTERNAL Segmentation( Dali::Internal::TextAbstraction::Segmentation* implementation );
70
71   /**
72    * @brief Retrieve a handle to the Segmentation instance.
73    *
74    * @return A handle to the Segmentation
75    */
76   static Segmentation Get();
77
78   /**
79    * @brief Retrieves the line break info.
80    *
81    * @pre @p breakInfo must have enough space allocated for @p numberOfCharacters.
82    *
83    * Possible values for LineBreakInfo are:
84    *
85    *  - 0 is a LINE_MUST_BREAK.  Text must be broken into a new line.
86    *  - 1 is a LINE_ALLOW_BREAK. Is possible to break the text into a new line.
87    *  - 2 is a LINE_NO_BREAK.    Text can't be broken into a new line.
88    *
89      @verbatim
90      i.e. Hello big\nworld produces:
91           2222212220 22220
92      @endverbatim
93    *
94    * @param[in] text Pointer to the first character of the text coded in UTF32.
95    * @param[in] numberOfCharacters The number of characters.
96    * @param[out] breakInfo The line break info.
97    */
98   void GetLineBreakPositions( const Character* const text,
99                               Length numberOfCharacters,
100                               LineBreakInfo* breakInfo );
101
102   /**
103    * @brief Retrieves the word break info.
104    *
105    * @pre @p breakInfo must have enough space allocated for @p numberOfCharacters.
106    *
107    * Possible values for WordBreakInfo are:
108    *
109    * - 0 is a WORD_BREAK.    Text can be broken into a new word.
110    * - 1 is a WORD_NO_BREAK. Text can't be broken into a new word.
111    *
112      @verbatim
113      i.e. Hello big\nworld produces:
114           1111001100 11110
115      @endverbatim
116    *
117    * @param[in] text Pointer to the first character of the text coded in UTF32.
118    * @param[in] numberOfCharacters The number of characters.
119    * @param[out] breakInfo The word break info.
120    */
121   void GetWordBreakPositions( const Character* const text,
122                               Length numberOfCharacters,
123                               WordBreakInfo* breakInfo );
124 };
125
126 } // namespace TextAbstraction
127
128 } // namespace Dali
129
130 #endif // __DALI_PLATFORM_TEXT_ABSTRACTION_SEGMENTATION_H__