[dali_1.0.31] Merge branch 'tizen'
[platform/core/uifw/dali-core.git] / dali / internal / event / text / character-impl.h
1 #ifndef __DALI_INTERNAL_CHARACTER_H__
2 #define __DALI_INTERNAL_CHARACTER_H__
3
4 /*
5  * Copyright (c) 2014 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 <stdint.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/text/character.h>
26
27 namespace Dali
28 {
29
30 namespace Internal
31 {
32
33 /**
34  * Implementation class for Dali::Character.
35  * @see Dali::Character.
36  */
37 class Character
38 {
39 public:
40
41   typedef Dali::Character::CharacterDirection CharacterDirection;
42
43 public:
44
45   /**
46    * Constructor.
47    * Creates a Character with the given UTF-32 encoded character.
48    * @param character A UTF-32 encoded character.
49    */
50   Character( uint32_t character );
51
52   /**
53    * Non virtual destructor.
54    */
55   ~Character();
56
57   /**
58    * Returns character direction
59    * @param[in] character The unicode character to determine direction of.
60    * @return The character's direction is returned.
61    */
62   static CharacterDirection GetCharacterDirection(uint32_t character);
63
64   /**
65    * @copydoc Dali::Character::GetCharacterDirection()
66    */
67   CharacterDirection GetCharacterDirection() const;
68
69   /**
70    * Returns the character's script.
71    *
72    * @param[in] character The unicode value of the character.
73    *
74    * @return The script of the character.
75    */
76   static Dali::Character::Script GetScript( uint32_t character );
77
78   /**
79    * @copydoc Dali::Character::GetScript()
80    */
81   Dali::Character::Script GetScript() const;
82
83   /**
84    * @copydoc Dali::Character::IsLeftToRight()
85    */
86   bool IsLeftToRight() const;
87
88   /**
89    * @copydoc Dali::Character::IsWhiteSpace()
90    */
91   bool IsWhiteSpace() const;
92
93   /**
94    * @copydoc Dali::Character::IsNewLine()
95    */
96   bool IsNewLine() const;
97
98   /**
99    * Retrieves the encapsulated UTF-32 encoded character.
100    * @return A UTF-32 encoded character.
101    */
102   uint32_t GetCharacter() const;
103
104   /**
105    * Sets a encapsulated UTF-32 encoded character.
106    * @param character A UTF-32 encoded character.
107    */
108   void SetCharacter( uint32_t character );
109
110   /**
111    * Whether the given character is a white space.
112    *
113    * @param[in] character The character.
114    *
115    * @return \e true the given character is a white space.
116    */
117   static bool IsWhiteSpace( uint32_t character );
118
119   /**
120    * Whether the given character is a new line character.
121    *
122    * @param[in] character The character.
123    *
124    * @return \e true the given character is a new line character.
125    */
126   static bool IsNewLine( uint32_t character );
127
128 private:
129
130   // Undefined constructor.
131   Character();
132
133   // Undefined copy constructor.
134   Character( const Character& character );
135
136   // Undefined assignment operator
137   Character& operator=( const Character& character );
138
139  private: //data
140
141   uint32_t mCharacter; ///< Stores the unicode of the character.
142 };
143
144 } // namespace Internal
145
146 } // namespace Dali
147
148 #endif // __DALI_INTERNAL_CHARACTER_H__