1 #ifndef DALI_INTERNAL_TEXT_ABSTRACTION_BIDIRECTIONAL_SUPPORT_IMPL_H
2 #define DALI_INTERNAL_TEXT_ABSTRACTION_BIDIRECTIONAL_SUPPORT_IMPL_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/common/dali-vector.h>
23 #include <dali/public-api/object/base-object.h>
26 #include <dali/devel-api/text-abstraction/bidirectional-support.h>
30 namespace TextAbstraction
35 * Implementation of the BidirectionalSupport
37 class BidirectionalSupport : public BaseObject
43 BidirectionalSupport();
48 ~BidirectionalSupport();
51 * @copydoc Dali::BidirectionalSupport::Get()
53 static TextAbstraction::BidirectionalSupport Get();
56 * @copydoc Dali::BidirectionalSupport::CreateInfo()
58 BidiInfoIndex CreateInfo(const Character* const paragraph,
59 Length numberOfCharacters,
60 bool matchLayoutDirection,
61 LayoutDirection::Type layoutDirection);
64 * @copydoc Dali::BidirectionalSupport::DestroyInfo()
66 void DestroyInfo(BidiInfoIndex bidiInfoIndex);
69 * @copydoc Dali::BidirectionalSupport::Reorder()
71 void Reorder(BidiInfoIndex bidiInfoIndex,
72 CharacterIndex firstCharacterIndex,
73 Length numberOfCharacters,
74 CharacterIndex* visualToLogicalMap);
77 * @copydoc Dali::BidirectionalSupport::GetMirroredText()
79 bool GetMirroredText(Character* text,
80 CharacterDirection* directions,
81 Length numberOfCharacters);
84 * @copydoc Dali::BidirectionalSupport::GetParagraphDirection()
86 bool GetParagraphDirection(BidiInfoIndex bidiInfoIndex) const;
89 * @copydoc Dali::BidirectionalSupport::GetCharactersDirection()
91 void GetCharactersDirection(BidiInfoIndex bidiInfoIndex,
92 CharacterDirection* directions,
93 Length numberOfCharacters);
97 * Helper for lazy initialization.
102 // Undefined copy constructor.
103 BidirectionalSupport(const BidirectionalSupport&);
105 // Undefined assignment constructor.
106 BidirectionalSupport& operator=(const BidirectionalSupport&);
112 }; // class BidirectionalSupport
114 } // namespace Internal
116 } // namespace TextAbstraction
118 inline static TextAbstraction::Internal::BidirectionalSupport& GetImplementation(TextAbstraction::BidirectionalSupport& bidirectionalSupport)
120 DALI_ASSERT_ALWAYS(bidirectionalSupport && "bidirectional support handle is empty");
121 BaseObject& handle = bidirectionalSupport.GetBaseObject();
122 return static_cast<TextAbstraction::Internal::BidirectionalSupport&>(handle);
125 inline static const TextAbstraction::Internal::BidirectionalSupport& GetImplementation(const TextAbstraction::BidirectionalSupport& bidirectionalSupport)
127 DALI_ASSERT_ALWAYS(bidirectionalSupport && "bidirectional support handle is empty");
128 const BaseObject& handle = bidirectionalSupport.GetBaseObject();
129 return static_cast<const TextAbstraction::Internal::BidirectionalSupport&>(handle);
134 #endif // DALI_INTERNAL_TEXT_ABSTRACTION_BIDIRECTIONAL_SUPPORT_IMPL_H