Merge "Fix a heap-buffer-overflow issue." into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / atspi-interfaces / collection.h
1 #ifndef DALI_ADAPTOR_ATSPI_COLLECTION_H
2 #define DALI_ADAPTOR_ATSPI_COLLECTION_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 // INTERNAL INCLUDES
21 #include <dali/devel-api/atspi-interfaces/accessible.h>
22
23 namespace Dali::Accessibility
24 {
25 /**
26  * @brief Interface enabling advanced quering of accessibility objects.
27  *
28  * @note Since all methods can be implemented inside bridge,
29  * no methods have to be overriden.
30  */
31 class DALI_ADAPTOR_API Collection : public virtual Accessible
32 {
33   /**
34    * @brief Downcasts an Accessible to a Collection.
35    *
36    * @param obj The Accessible
37    * @return A Collection or null
38    *
39    * @see Dali::Accessibility::Accessible::DownCast()
40    */
41   static inline Collection* DownCast(Accessible* obj);
42 };
43
44 namespace Internal
45 {
46 template<>
47 struct AtspiInterfaceTypeHelper<AtspiInterface::COLLECTION>
48 {
49   using Type = Collection;
50 };
51 } // namespace Internal
52
53 inline Collection* Collection::DownCast(Accessible* obj)
54 {
55   return Accessible::DownCast<AtspiInterface::COLLECTION>(obj);
56 }
57
58 } // namespace Dali::Accessibility
59
60 #endif // DALI_ADAPTOR_ATSPI_COLLECTION_H