Merge "Fix a heap-buffer-overflow issue." into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / atspi-interfaces / socket.h
1 #ifndef DALI_ADAPTOR_ATSPI_SOCKET_H
2 #define DALI_ADAPTOR_ATSPI_SOCKET_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 // INTERNAL INCLUDES
21 #include <dali/devel-api/atspi-interfaces/accessible.h>
22
23 namespace Dali::Accessibility
24 {
25 /**
26  * @brief A Socket is the root of the AT-SPI tree that can be embedded as a subtree
27  * in the tree belonging to another process (the Plug). The Plug initiates the Plug-Socket
28  * connection by calling Embed() and terminates it by calling Unembed().
29  *
30  * See AT_SPI2_CORE/xml/Socket.xml for a description of this interface in XML format.
31  */
32 class DALI_ADAPTOR_API Socket : public virtual Accessible
33 {
34 public:
35   /**
36    * @brief Establishes the Plug-Socket connection.
37    *
38    * @param plug Address of the Plug (remote parent)
39    * @return Address of the Socket
40    */
41   virtual Address Embed(Address plug) = 0;
42
43   /**
44    * @brief Terminates the Plug-Socket connection.
45    *
46    * @param plug Address of the Plug (remote parent)
47    */
48   virtual void Unembed(Address plug) = 0;
49
50   /**
51    * @brief Set the offset (position information).
52    *
53    * @param[in] x Horizontal offset
54    * @param[in] y Vertical offset
55    */
56   virtual void SetOffset(std::int32_t x, std::int32_t y) = 0;
57
58   /**
59    * @brief Downcasts an Accessible to a Socket.
60    *
61    * @param obj The Accessible
62    * @return A Socket or null
63    *
64    * @see Dali::Accessibility::Accessible::DownCast()
65    */
66   static inline Socket* DownCast(Accessible* obj);
67 };
68
69 namespace Internal
70 {
71 template<>
72 struct AtspiInterfaceTypeHelper<AtspiInterface::SOCKET>
73 {
74   using Type = Socket;
75 };
76 } // namespace Internal
77
78 inline Socket* Socket::DownCast(Accessible* obj)
79 {
80   return Accessible::DownCast<AtspiInterface::SOCKET>(obj);
81 }
82
83 } // namespace Dali::Accessibility
84
85 #endif // DALI_ADAPTOR_ATSPI_SOCKET_H