apply FSL(Flora Software License)
[apps/home/libug-worldclock-efl.git] / clock-common / include / clock_fwk_define.h
1 /*
2   * Copyright 2012  Samsung Electronics Co., Ltd
3   * 
4   * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
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 #ifndef __CLK_FWK_DEFINE_H__
18 #define __CLK_FWK_DEFINE_H__
19
20 #include "clock_fwk_dlog.h"
21 #include <stdlib.h>
22 #include <stdbool.h>
23 #include <string.h>
24 #include <libintl.h>
25 #include <glib.h>
26 #include <glib.h>
27 #include <time.h>
28 //tag
29 #ifdef  LOG_TAG
30 #undef  LOG_TAG
31 #endif
32 #define LOG_TAG "CLK_COM"
33 //get str
34 #ifdef _
35 #undef _
36 #endif
37 #define _(s)  dgettext(PACKAGE, s)
38 #define S_(x) dgettext("sys_string", x)
39 //equal
40 #define IS_EQUAL(a, b) ((a) == (b))
41 #define NULL_CHECK(p) IS_EQUAL(p, NULL)
42 #define NOT_NULL(p) !NULL_CHECK(p)
43 #define IS_STR_EQUAL(a, b) (!strcmp(a, b))
44 #define IS_STR_NOT_EQUAL(a, b) (strcmp(a, b))
45 #define ASSERT(p) assert(p)
46 //
47 #define CALLOC(num, type) (type *)calloc(num, sizeof(type))
48 //******************define:free *************************************
49 #define FREEIF(p) if (p) {free(p); p = NULL; }
50 #define FREERIF_FN(p, fn) if (p) {fn(p); p = NULL; }
51 #define EVAS_OBJECT_DELIF(p) if (p) {evas_object_del(p); p = NULL; }
52 #define ELM_GENLIST_ITEM_DELIF(p) if (p) {elm_object_item_del(p); p = NULL; }
53 #define EVAS_OBJECT_SHOWIF(p) if (p) {evas_object_show(p); }
54 #define ECORE_TIMER_DELIF(p) if (p) {ecore_timer_del(p); p = NULL; }
55 #define ECORE_FILE_MONITOR_DELIF(p) if (p) {ecore_file_monitor_del(p); p = NULL; }
56 #define ECORE_EVENT_HANDLER_DELIF(p) if (p) {ecore_event_handler_del(p); p = NULL; }
57 #define ELM_SLIDER_VALUE_GET(p) (elm_slider_value_get(p)+0.5)
58 //edj
59 #ifndef _EDJ
60 #define _EDJ(obj) elm_layout_edje_get(obj)
61 #endif
62 //******************set time *************************************
63 #define SET_TIME_DATA_T(pTime_data, YEAR, MONTH, DAY, HOUR, MIN, SEC) \
64 do {\
65     (pTime_data)->year = (YEAR);\
66     (pTime_data)->month = (MONTH);\
67     (pTime_data)->day = (DAY);\
68     (pTime_data)->hour = (HOUR);\
69     (pTime_data)->min = (MIN);\
70     (pTime_data)->sec = (SEC);\
71 } while (0);
72 //count
73 #define BUF_SIZE_32 (32)
74 #define BUF_SIZE_64 (64)
75 #define BUF_SIZE_128 (128)
76 #define BUF_SIZE_256 (256)
77 //
78 #ifndef SUCCESS
79 #define SUCCESS 0
80 #endif
81 #ifndef FAILED
82 #define FAILED -1
83 #endif
84 //
85 struct _tc {                    /* text class */
86         char *name;             /* text class name */
87         int size;               /* font size */
88 };
89 //
90 struct _ts {                    /* text set */
91         char *name;             /* part name */
92         char *msgid;            /* message ID */
93 };
94 //
95 struct text_part {
96         char *part;
97         char *msgid;
98 };
99 //
100 typedef struct _Edje_Color_Class {
101         const char *name;
102         int r, g, b, a;
103         int r2, g2, b2, a2;
104         int r3, g3, b3, a3;
105 } Edje_Color_Class;
106
107 #endif                          //__CLK_FWK_DEFINE_H__