License conversion from Flora to Apache 2.0
[platform/core/uifw/dali-core.git] / capi / dali / public-api / text / character.h
1 #ifndef __DALI_CHARACTER_H__
2 #define __DALI_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 /**
22  * @addtogroup CAPI_DALI_TEXT_MODULE
23  * @{
24  */
25
26 // INTERNAL INCLUDES
27 #include <dali/public-api/common/dali-common.h>
28
29 namespace Dali DALI_IMPORT_API
30 {
31
32 namespace Internal DALI_INTERNAL
33 {
34   class Character;
35 }
36
37 /**
38  * @brief The Character class encapsulates a character implementation to support multiple languages.
39  *
40  * This class is provided for convenience. A user can't instantiate Characters directly.
41  * However, by instantiating a Text object, Characters are returned by Text::operator[].
42  */
43 class Character
44 {
45 public:
46
47   /**
48    * @brief CharacterDirection
49    *
50    * Characters can be classified under one of five direction types, which determines the
51    * direction in which they are displayed.
52    *
53    * English is a left-to-right language.
54    * If English were instead right-to-left, then the word English would be displayed as
55    * "hsilgnE"
56    */
57   enum CharacterDirection
58   {
59     LeftToRight,                                            ///< Left to Right characters are the most common (e.g. English and other Indo-European languages)
60     RightToLeft,                                            ///< Right to Left characters are less common (e.g. Hebrew and Arabic)
61     LeftToRightWeak,                                        ///< Weak Left to Right characters (e.g. numbers)
62     RightToLeftWeak,                                        ///< Weak Right to Left characters
63     Neutral                                                 ///< Neutral characters follow the direction of characters surrounding them (e.g. whitespace ' ')
64   };
65
66 public:
67
68   /**
69    * @brief Copy constructor.
70    *
71    * @param [in] character Character to be copied.
72    */
73   Character( const Character& character );
74
75   /**
76    * @brief Assignment operator.
77    *
78    * @param [in] character Character to be assigned.
79    * @return a reference to this
80    */
81   Character& operator=( const Character& character );
82
83   /**
84    * @brief Non virtual destructor.
85    */
86   ~Character();
87
88   /**
89    * @brief Equality operator.
90    *
91    * @param [in] character The character to be compared.
92    * @return true if the character is identical
93    */
94   bool operator==( const Character& character ) const;
95
96   /**
97    * @brief Inequality operator.
98    *
99    * @param [in] character The character to be compared.
100    * @return true if the character is not identical
101    */
102   bool operator!=( const Character& character ) const;
103
104   /**
105    * @brief Returns direction of this character.
106    *
107    * @return The character's direction is returned see CharacterDirection
108    */
109   CharacterDirection GetCharacterDirection() const;
110
111   /**
112    * @brief Returns whether this character is white space (true)
113    * or not (false).
114    *
115    * @return true if a whitespace character, false otherwise.
116    */
117   bool IsWhiteSpace() const;
118
119   /**
120    * @brief Returns whether this character is a new line character (true).
121    *
122    * or not (false).
123    * @return true if a new line character, false otherwise.
124    */
125   bool IsNewLine() const;
126
127 private:
128   Internal::Character* mImpl;
129
130   /**
131    * @brief Default constructor.
132    *
133    * Not defined.
134    */
135   DALI_INTERNAL Character();
136
137 public: // Not intended for application developers
138   DALI_INTERNAL Character( Internal::Character* impl );
139
140   DALI_INTERNAL const Internal::Character& GetImplementation() const;
141
142   DALI_INTERNAL Internal::Character& GetImplementation();
143 };
144
145 } // namespace Dali
146
147 /**
148  * @}
149  */
150 #endif // __DALI_CHARACTER_H__