Sync with tizen 2.4
[platform/core/messaging/msg-service.git] / vobject-engine / include / vobject.h
1 /*
2  * Copyright (c) 2014 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 #ifndef _VOBJECT_H
18 #define _VOBJECT_H
19
20 #include "stdio.h"
21 #include "stdbool.h"
22 #include "stdlib.h"
23 #include "string.h"
24 #include "ctype.h"
25 #include <glib.h>
26 #include <dlog.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31
32 //#define ORG_ENABLE_TRACE
33 #define FEATURE_SHIFT_JIS
34
35 #ifdef ORG_ENABLE_TRACE
36 #define USER_TAG "MSG_FW"
37 #define VDATA_TRACE(fmt, arg...) \
38         do\
39         {\
40                 SLOG(LOG_DEBUG, USER_TAG, "\n[calendarui] %s:%d: " fmt "\n", __FUNCTION__, __LINE__, ##arg); \
41         } while (0)
42
43
44 #define VDATA_TRACE_LINE() fprintf(stderr, "\n[calendarui] %s:%d\n", __FUNCTION__, __LINE__ )
45
46 #define SysRequireEx(expr, retValue) \
47         if (!(expr)) { \
48                 fprintf(stderr,"INVALID_PARAM (%d lines in %s)\n", __LINE__,__FILE__); \
49                 return retValue; }\
50         else {;}
51 #else
52 #define USER_TAG "MSG_SERVICE"
53 #define VDATA_TRACE(fmt, arg...) \
54         do\
55         {\
56                 SLOG(LOG_DEBUG, USER_TAG, "\n[calendarui] %s:%d: " fmt "\n", __FUNCTION__, __LINE__, ##arg); \
57         } while (0)
58
59 #define VDATA_TRACE_LINE()
60 #define SysRequireEx(expr, retValue)
61 #endif
62
63 #define VDATA_TRACE_BEGINE //VDATA_TRACE(">>>>>> start. >>>>>>"); //usleep(1000);
64 #define VDATA_TRACE_END //VDATA_TRACE(">>>>>> end. >>>>>>");
65
66 /****************************************************************************************************/
67 /*                                                                               FUNCTION DECLARATION                                                                           */
68 /****************************************************************************************************/
69 int             _VIsSpace( char );
70 int             _VRLSpace( char * );
71 int             _VRTSpace( char * );
72 int             _VUnescape( char* );
73 int             _VEscape(char*);
74 int             _VManySpace2Space( char * );
75 int             _VB64Decode( char *, char * );
76 int             _VB64Encode( char *, char *, int );
77 int             _VUnfolding( char * );
78 void    _VFolding( char *, char * );
79 int             _VQPDecode( char * );
80 int             _VQPEncode( char *, char * );
81
82 void _VFoldingQP( char *result, char *contentline );
83 void _VFoldingNoSpace( char *result, char *contentline );
84 int _VManyCRLF2CRLF(char *pIn);
85 int _VUnfoldingNoSpec( char *string, int vType );
86
87 #ifdef __cplusplus
88 }
89 #endif /* __cplusplus */
90
91 #endif