Revert "Fix attribute cache bug"
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / atspi-interfaces / hypertext.h
1 #ifndef DALI_ADAPTOR_ATSPI_HYPERTEXT_H
2 #define DALI_ADAPTOR_ATSPI_HYPERTEXT_H
3
4 /*
5  * Copyright (c) 2021 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 // EXTERNAL INCLUDES
21 #include <cstdint>
22
23 // INTERNAL INCLUDES
24 #include <dali/devel-api/atspi-interfaces/accessible.h>
25 #include <dali/devel-api/atspi-interfaces/hyperlink.h>
26
27 namespace Dali::Accessibility
28 {
29 /**
30  * @brief Interface representing hypertext that can store a collection of hyperlinks.
31  */
32 class DALI_ADAPTOR_API Hypertext : public virtual Accessible
33 {
34 public:
35   /**
36    * @brief Gets the handle to hyperlink object from a specified index in hyperlink collection of this hypertext.
37    *
38    * @param[in] linkIndex The 0-based index in hyperlink collection.
39    *
40    * @return Handle to hyperlink object at a specified index in hyperlink collection of hypertext.
41    */
42   virtual Hyperlink* GetLink(std::int32_t linkIndex) const = 0;
43
44   /**
45    * @brief Gets the index in hyperlink collection occupied by hyperlink which spans over a specified character offset in this hypertext.
46    *
47    * @param[in] characterOffset The 0-based index of character in hypertext.
48    *
49    * @return The value of 0-based index in hyperlink collection (-1 if there is no hyperlink at the specified character offset).
50    */
51   virtual std::int32_t GetLinkIndex(std::int32_t characterOffset) const = 0;
52
53   /**
54    * @brief Gets number of hyperlinks stored in this hypertext.
55    *
56    * @return The number of hyperlinks (zero if none or -1 if the number cannot be determined)
57    */
58   virtual std::int32_t GetLinkCount() const = 0;
59
60   /**
61    * @brief Downcasts an Accessible to a Hypertext.
62    *
63    * @param obj The Accessible
64    * @return A Hypertext or null
65    *
66    * @see Dali::Accessibility::Accessible::DownCast()
67    */
68   static inline Hypertext* DownCast(Accessible* obj);
69 };
70
71 namespace Internal
72 {
73 template<>
74 struct AtspiInterfaceTypeHelper<AtspiInterface::HYPERTEXT>
75 {
76   using Type = Hypertext;
77 };
78 } // namespace Internal
79
80 inline Hypertext* Hypertext::DownCast(Accessible* obj)
81 {
82   return Accessible::DownCast<AtspiInterface::HYPERTEXT>(obj);
83 }
84
85 } // namespace Dali::Accessibility
86
87 #endif // DALI_ADAPTOR_ATSPI_HYPERTEXT_H