Add LCOV remarkers to increase line coverage rate
[platform/core/api/maps-service.git] / src / view / overlay_constructor.cpp
1 /* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
2  *
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 #include "overlay_constructor.h"
19
20 extern int _maps_view_object_create(const maps_view_object_type_e type, maps_view_object_h *object);
21
22 extern int _maps_view_object_overlay_set_object(maps_view_object_h overlay, Evas_Object *object);
23
24 extern int _maps_view_object_overlay_set_type(maps_view_object_h overlay, maps_view_overlay_type_e type);
25
26 maps_view_object_h view::overlay_constructor::construct(maps_coordinates_h coordinates,
27         Evas_Object *object, maps_view_overlay_type_e type)
28 {
29         if (!coordinates || !object) {
30                 __error = MAPS_ERROR_INVALID_PARAMETER;
31                 return NULL;
32         }
33
34         __error = MAPS_ERROR_NONE;
35
36         maps_view_object_h overlay = NULL;
37         do {
38                 /* 1. Create a visual object for marker */
39                 __error = _maps_view_object_create(MAPS_VIEW_OBJECT_OVERLAY, &overlay);
40                 if (__error != MAPS_ERROR_NONE)
41                         break;
42
43                 /* 2. Set the overlay type */
44                 __error = _maps_view_object_overlay_set_type(overlay, type);
45                 if (__error != MAPS_ERROR_NONE)
46                         break;
47
48                 /* 3. Set the evas object to the overlay */
49                 __error = _maps_view_object_overlay_set_object(overlay, object);
50                 if (__error != MAPS_ERROR_NONE)
51                         break;
52
53                 /* 4. Move the overlay to the given coordinates */
54                 __error = maps_view_object_overlay_set_coordinates(overlay, coordinates);
55                 if (__error != MAPS_ERROR_NONE)
56                         break;
57
58                 /* SUCCESS */
59                 return overlay;
60         } while (false);
61
62         //LCOV_EXCL_START
63         /* FAILURE: Releasing objects */
64         maps_view_object_destroy(overlay);
65         return NULL;
66         //LCOV_EXCL_STOP
67 }