changed attributes of header files
[platform/core/location/maps-plugin-here.git] / inc / engine / common / ErrorBase.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 ERRORBASE_H
19 #define ERRORBASE_H
20
21 #include "common/HereMaps_global.h"
22
23 #include <iostream>
24
25 HERE_MAPS_BEGIN_NAMESPACE
26
27 class BaseReply;
28 class GeoCoderReplyParser;
29
30 /**
31  * This class is the base class for classes that encapsulate error conditions,
32  * for example <code>CommunicationError</code>.
33  */
34 class EXPORT_API ErrorBase
35 {
36 public:
37     /**
38      * This enumeration defines identifiers for error categories.
39      */
40     enum ErrorCategory
41     {
42         EC_None = 0,            ///< Indicates success.
43         EC_CommunicationsError, ///< Indicates a communications error.
44         EC_ParserError,         ///< Indicates a parser error.
45         EC_RouterError,         ///< Indicates a router error.
46         EC_TileMapError,        ///< Indicates a tile map error.
47         EC_FinderError          ///< Indicates a finder/places error.
48     };
49
50     /**
51      * This method is the (virtual) destructor.
52      */
53     virtual ~ErrorBase();
54
55     /**
56      * This method produces a string representation of the given instance of
57      * the class. The method must be implemented by derived classes. 
58      * 
59      * @return A string containing a text representation of the given instance
60      *        of the class.  
61      */
62     virtual String ToString() const = 0;
63
64     /**
65      * This method prints the text representation of the given instance of the
66      * class to the stream identified by the caller. 
67      * 
68      * \sa ToString
69      * 
70      * @param rSink A reference to the steam to which to output the (text
71      *        representeation) of the given instance.
72      */
73     void Print(std::ostream& rSink) const;
74
75     /**
76      * This method retrieves a value representing the error category assigned to
77      * the given instance of the class.
78      * 
79      * @return A value representing the error category assigned to
80      *        the given instance of the class.
81      */
82     ErrorCategory GetErrorCategory() const;
83
84 protected:
85     /**
86      * This method is the default constructor.
87      */
88     ErrorBase();
89
90     /**
91      * This method sets the error category for the given instance of the class.
92      * 
93      * @param aErrorCategory A value representing the error category to be
94      *        assigned to the given instance of the class.
95      */
96     void SetErrorCategory(ErrorCategory aErrorCategory);
97
98 private:
99    // HERE_MAPS_NO_COPY_NO_ASSIGN(ErrorBase);
100
101     friend class BaseReply;
102     friend class GeoCoderReplyParser;
103     friend class GeoRouterReplyParser;
104     friend class JsonParser;
105     friend class TestErrorBase;
106
107
108     /*
109      * \brief note ownership of parameter is transferred
110      * \param rError error that is appended to linked list of error - must be allocated on heap
111      */
112     void Append(ErrorBase& rError);
113
114     class ErrorBaseImpl;
115     ErrorBaseImpl* m_pImpl;
116 };
117
118 HERE_MAPS_END_NAMESPACE
119
120 #endif