Resolve incorrect position for Ellipsis when mixed LTR & RTL languages and set layout...
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / abstract-style-character-run.h
1 #ifndef DALI_TOOLKIT_TEXT_ABSTRACT_STYLE_CHARACTER_RUN_H
2 #define DALI_TOOLKIT_TEXT_ABSTRACT_STYLE_CHARACTER_RUN_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/public-api/common/type-traits.h>
23 #include <dali/public-api/math/vector4.h>
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/internal/text/character-run.h>
27
28 namespace Dali
29 {
30 namespace Toolkit
31 {
32 namespace Text
33 {
34 /**
35  * @brief Run of characters with the same style.
36  */
37 struct AbstractStyleCharacterRun
38 {
39   CharacterRun characterRun; ///< The initial character index and the number of characters of the run.
40
41   // Constructors
42
43 protected:
44   /**
45    * @brief Constructor.
46    * Default constructor to set the default values
47    */
48   AbstractStyleCharacterRun()
49   : characterRun{}
50   {
51   }
52
53   /**
54    * @brief Constructor.
55    * Default constructor to set the default values
56    *
57    * @param[in] characterRun the character run
58    */
59   AbstractStyleCharacterRun(const CharacterRun& characterRun)
60   : characterRun{characterRun}
61   {
62   }
63
64 public:
65   AbstractStyleCharacterRun(const AbstractStyleCharacterRun&) = default;
66
67   AbstractStyleCharacterRun(AbstractStyleCharacterRun&&) noexcept = default;
68
69   // Operators
70
71   AbstractStyleCharacterRun& operator=(const AbstractStyleCharacterRun&) = default;
72
73   AbstractStyleCharacterRun& operator=(AbstractStyleCharacterRun&&) noexcept = default;
74
75   /**
76    * @brief Destructor.
77    */
78   virtual ~AbstractStyleCharacterRun() = default;
79
80   //Methods
81
82   /**
83   * @brief Retrive the first index in run.
84   * @return the end character index in run.
85   */
86   CharacterIndex GetStartCharacterIndex() const;
87
88   /**
89   * @brief Retrive the number of characters in the run.
90   * @return the the number of characters in run.
91   */
92   Length GetNumberOfCharacters() const;
93
94   /**
95   * @brief Calculate the end index in run.
96   * @return the end character index in run.
97   */
98   CharacterIndex GetEndCharacterIndex() const;
99 };
100
101 } // namespace Text
102
103 } // namespace Toolkit
104
105 // Allow AbstractStyleCharacterRun to be treated as a POD type
106 template<>
107 struct TypeTraits<Dali::Toolkit::Text::AbstractStyleCharacterRun> : public Dali::BasicTypes<Dali::Toolkit::Text::AbstractStyleCharacterRun>
108 {
109   enum
110   {
111     IS_TRIVIAL_TYPE = true
112   };
113 };
114
115 } // namespace Dali
116
117 #endif // DALI_TOOLKIT_TEXT_ABSTRACT_STYLE_CHARACTER_RUN_H