Merge "Fix a heap-buffer-overflow issue." into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / atspi-interfaces / application.h
1 #ifndef DALI_ADAPTOR_ATSPI_APPLICATION_H
2 #define DALI_ADAPTOR_ATSPI_APPLICATION_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 <string>
22
23 // INTERNAL INCLUDES
24 #include <dali/devel-api/atspi-interfaces/accessible.h>
25
26 namespace Dali::Accessibility
27 {
28 /**
29  * @brief An interface identifying the root object
30  * associated with a running application.
31  *
32  * @note Provides global properties describing
33  * application's runtime environment.
34  */
35 class DALI_ADAPTOR_API Application : public virtual Accessible
36 {
37 public:
38   /**
39    * @brief Gets name of graphic user interface framework used by an application.
40    *
41    * @return String with name
42    */
43   virtual std::string GetToolkitName() const = 0;
44
45   /**
46    * @brief Gets version of graphic user interface framework used by an application.
47    *
48    * @return String with version
49    */
50   virtual std::string GetVersion() const = 0;
51
52   /**
53    * @brief Downcasts an Accessible to an Application.
54    *
55    * @param obj The Accessible
56    * @return An Application or null
57    *
58    * @see Dali::Accessibility::Accessible::DownCast()
59    */
60   static inline Application* DownCast(Accessible* obj);
61 };
62
63 namespace Internal
64 {
65 template<>
66 struct AtspiInterfaceTypeHelper<AtspiInterface::APPLICATION>
67 {
68   using Type = Application;
69 };
70 } // namespace Internal
71
72 inline Application* Application::DownCast(Accessible* obj)
73 {
74   return Accessible::DownCast<AtspiInterface::APPLICATION>(obj);
75 }
76
77 } // namespace Dali::Accessibility
78
79 #endif // DALI_ADAPTOR_ATSPI_APPLICATION_H