tizen 2.4 release
[framework/web/wrt-commons.git] / modules / localization / include / dpl / localization / localization_utils.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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  * @file    localization_utils.h
18  * @author  Bartosz Janiak (b.janiak@samsung.com)
19  * @version 1.0
20  */
21
22 #ifndef LOCALIZATION_UTILS_H
23 #define LOCALIZATION_UTILS_H
24
25 #include <list>
26
27 #include <dpl/log/wrt_log.h>
28 #include <boost/optional.hpp>
29 #include <dpl/read_write_mutex.h>
30 #include <dpl/string.h>
31
32 /**
33  * WidgetIcon
34  * Structure to hold information about widget icon.
35  */
36
37 struct WidgetIcon
38 {
39     WidgetIcon() :
40         width(boost::optional<int>()),
41         height(boost::optional<int>())
42     {}
43
44     /*
45      * a valid URI to an image file inside the widget package that represents an
46      * iconic representation of the widget
47      */
48     DPL::String src;
49     boost::optional<int> width;       /// the width of the icon in pixels
50     boost::optional<int> height;      /// the height of the icon in pixels
51
52     bool operator==(const WidgetIcon &other) const
53     {
54         return src == other.src;
55     }
56 };
57
58 struct WidgetStartFileInfo
59 {
60     DPL::String file;
61     DPL::String localizedPath;
62     DPL::String encoding;
63     DPL::String type;
64
65     bool operator==(const WidgetStartFileInfo& other) const
66     {
67         return file == other.file &&
68                localizedPath == other.localizedPath &&
69                encoding == other.encoding &&
70                type == other.type;
71     }
72 };
73
74 typedef boost::optional<WidgetIcon> OptionalWidgetIcon;
75 typedef boost::optional<WidgetStartFileInfo> OptionalWidgetStartFileInfo;
76
77 #endif //LOCALIZATION_UTILS_H