Spannable-Core: Add SpannableString and ForegroundColorSpan
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / text / character-sequence.h
1 #ifndef DALI_TOOLKIT_TEXT_CHARACTER_SEQUENCE_H
2 #define DALI_TOOLKIT_TEXT_CHARACTER_SEQUENCE_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-toolkit/public-api/dali-toolkit-common.h>
23 #include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
24 #include <dali/public-api/object/base-handle.h>
25
26 namespace Dali
27 {
28 namespace Toolkit
29 {
30 namespace Text
31 {
32 namespace Internal DALI_INTERNAL
33 {
34 class CharacterSequence;
35 }
36
37 /**
38  * @brief Interface for readable character sequence.
39  * It provides uniform APIs for read-only access to many different kinds of character sequences.
40  *
41  * @note An instance of this class cannot be created.
42  *
43  */
44 class DALI_TOOLKIT_API CharacterSequence : public BaseHandle
45 {
46 public:
47   /**
48    * @brief Creates an uninitialized CharacterSequence handle.
49    *
50    * Calling member functions with an uninitialized CharacterSequence handle is not allowed.
51    */
52   CharacterSequence();
53
54   /**
55    * @brief Copy constructor.
56    *
57    * @param[in] rhs A reference to the copied handle
58    */
59   CharacterSequence(const CharacterSequence& rhs);
60
61   /**
62    * @brief Move constructor.
63    *
64    * @param[in] rhs A reference to the handle to move
65    */
66   CharacterSequence(CharacterSequence&& rhs);
67
68   /**
69    * @brief Assignment operator.
70    *
71    * @param[in] handle A reference to the copied handle
72    * @return A reference to this
73    */
74   CharacterSequence& operator=(const CharacterSequence& handle);
75
76   /**
77    * @brief Move assignment operator.
78    *
79    * @param[in] rhs A reference to the handle to move
80    * @return A reference to this handle
81    */
82   CharacterSequence& operator=(CharacterSequence&& rhs);
83
84   /**
85    * @brief Non virtual destructor.
86    */
87   ~CharacterSequence();
88
89 protected:
90   /**
91    * @brief Downcasts to a CharacterSequence handle.
92    * If handle is not a CharacterSequence, the returned handle is left uninitialized.
93    *
94    * @param[in] handle Handle to an object
95    * @return CharacterSequence handle or an uninitialized handle
96    */
97   static CharacterSequence DownCast(BaseHandle handle);
98
99 public: // Not intended for application developers
100   /// @cond internal
101   /**
102    * @brief Internal constructor.
103    *
104    * @param[in] characterSequence Pointer to internal CharacterSequence
105    */
106   explicit DALI_INTERNAL CharacterSequence(Internal::CharacterSequence* characterSequence);
107   /// @endcond
108
109 public: //Methods
110   /**
111   * @brief Retrive the characters
112   *
113   * @return the utf32 characters.
114   */
115   Vector<uint32_t> GetCharacters() const;
116
117   /**
118   * @brief Retrive number of characters in container
119   *
120   * @return the number of characters.
121   */
122   uint32_t GetNumberOfCharacters() const;
123
124   /**
125   * @brief Retrieve constructed string form Character Sequence.
126   * Copy the characters from container to string
127   *
128   * @return the std string.
129   */
130   std::string ToString() const;
131 };
132
133 } // namespace Text
134
135 } // namespace Toolkit
136
137 } // namespace Dali
138
139 #endif // DALI_TOOLKIT_TEXT_CHARACTER_SEQUENCE_H