fix for using maps_view_handle in maps_plugin
[platform/core/location/maps-plugin-here.git] / inc / engine / common / ApplicationContext.h
1 /*
2  * Copyright (C) 2013 HERE Global B.V. All rights reserved.
3  * This software, including documentation, is protected by copyright controlled by
4  * HERE Global B.V. (“Software”). All rights are reserved. Copying, including reproducing,
5  * storing, adapting or translating, any or all of this material requires the prior
6  * written consent of HERE Global B.V. You may use this
7  * Software in accordance with the terms and conditions defined in the
8  * HERE Location Platform Services Terms and Conditions, available at
9  * http://developer.here.com/terms-conditions-base
10  *
11  * As an additional permission to the above, you may distribute Software,
12  * in object code format as part of an Application, according to, and subject to, terms and
13  * conditions defined in the Tizen Software Development kit (“SDK”) License Agreement.
14  * You may distribute such object code format Application under terms of your choice,
15  * provided that the header and source files of the Software have not been modified.
16  */
17
18 #ifndef APPLICATIONCONTEXT_H
19 #define APPLICATIONCONTEXT_H
20
21 #include "common/HereMaps_global.h"
22
23 #include <vector>
24
25 HERE_MAPS_BEGIN_NAMESPACE
26
27 /**
28  * This class encapsulates the credentials required to use the Geocoding API.
29  * The credentials consists of the app code and app id.
30  *
31  * The class is a singleton.
32  */
33 class EXPORT_API ApplicationContext
34 {
35 public:
36     /**
37      * This is the destructor.
38      */
39     ~ApplicationContext();
40
41     /**
42      * This method sets the preferred language, using a two-letter BCP-47 code
43      * supplied by the caller. 
44      *
45      * @param sLanguage A const reference to a string containing a two-letter
46      *        code identifying the preferred map language.
47      */
48     void SetPreferredLanguage(const String& sLanguage);
49
50     /**
51      * This method retrieves a string containing a BCP-47 code that indicates
52      * the preferred language.
53      *
54      * @return A constant reference to a string containing a two-letter BCP-47
55      *        code indicating the preferred language.
56      */
57     const String& GetPreferredLanguage() const;
58
59     /**
60      * This method retrieves the app code.
61      *
62      * @return A constant reference to a string containing the app code.
63      */
64     const String& GetAppCode() const;
65
66     /**
67      * This method retrieves the app id.
68      *
69      * @return A constant reference to a string containing the app id.
70      */
71     const String& GetAppId() const;
72
73 #ifdef TIZEN_MIGRATION
74     /**
75      * This method retrieves the request app id.
76      *
77      * @return A constant reference to a string containing the request app id.
78      */
79     const String& GetRequestAppId() const;
80 #endif
81
82     /**
83      * This is a static method which returns the singleton's instance.
84      *
85      * @return A static reference to the instance of this singleton class.
86      */
87     static ApplicationContext& GetInstance();
88
89 #ifdef TIZEN_MIGRATION
90     /**
91      * This method initialises the singleton object.
92      *
93      * @param sAppCode A constant reference to a string containing the app code.
94      *
95      * @param sAppId A constant reference to a string containing the app id.
96      *
97      * @param sRequestAppId A constant reference to a string containing the request app id.
98      *
99      * @return A Boolean indicating the result of initialization,
100      *        <code>true</code> on success, <code>false</code> on failure. Note
101      *        that if the object already exists and has been initialized,
102      *        further attempts to call this methods fail (the return value is
103      *        <code>false</code>.
104      */
105     bool Initialize(const String& sAppCode, const String& sAppId, const String& sRequestAppId = "");
106 #else
107     /**
108      * This method initialises the singleton object.
109      *
110      * @param sAppCode A constant reference to a string containing the app code.
111      *
112      * @param sAppId A constant reference to a string containing the app id.
113      *
114      * @return A Boolean indicating the result of initialization,
115      *        <code>true</code> on success, <code>false</code> on failure. Note
116      *        that if the object already exists and has been initialized,
117      *        further attempts to call this methods fail (the return value is
118      *        <code>false</code>.
119      */
120     bool Initialize(const String& sAppCode, const String& sAppId);
121 #endif
122
123     /**
124      * This method queries initialisation status.
125      *
126      * @return A Boolean indicating the status of initialization,
127      *        <code>true</code> if the object is initialized, otherwise
128      *        <code>false</code>.
129      */
130     bool IsInitialized() const;
131
132     /**
133      * This method sets a flag to indicate whether a high-resolution map is to be used.
134      * 
135      * @param haveHighResolution A Boolean, <code>true</code> to indicate that a
136      *        high-resolution map is to be used, otherwise <code>false</code>.
137      */
138     void SetHighResolutionMap(bool haveHighResolution);
139
140     /**
141      * This method retrieves a Boolean value indicating whether a high-resolution map is used.
142      * 
143      * @return A Boolean, <code>true</code> to indicate that a
144      *        high-resolution map is (to be) used, otherwise <code>false</code>.
145      */
146     bool HaveHighResolutionMap() const;
147
148 private:
149     /**
150      * This method is a private constructor for the singleton.
151      */
152     ApplicationContext();
153
154     HERE_MAPS_NO_COPY_NO_ASSIGN(ApplicationContext);
155
156     class ApplicationContextImpl;
157     ApplicationContextImpl* m_pImpl;
158 };
159
160 HERE_MAPS_END_NAMESPACE
161
162 #endif // APPLICATIONCONTEXT_H