Git Init
[profile/ivi/wrt-plugins-tizen.git] / src / platform / API / TimeUtil / ITZDate.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
18
19 #ifndef _ABSTRACT_LAYER_ITZDATE_H_
20 #define _ABSTRACT_LAYER_ITZDATE_H_
21
22 #include <ctime>
23 #include <string>
24 #include <dpl/shared_ptr.h>
25 #include "DurationProperties.h"
26 #include "TZDateProperties.h"
27
28 namespace TizenApis {
29 namespace Api {
30 namespace TimeUtil {
31
32 class ITZDate {
33 public:
34         enum TZDateFields {
35                 TZDATE_ERA,
36                 TZDATE_YEAR,
37                 TZDATE_MONTH,
38                 TZDATE_WEEK_OF_YEAR,
39                 TZDATE_WEEK_OF_MONTH,
40                 TZDATE_DATE,
41                 TZDATE_DAY_OF_YEAR,
42                 TZDATE_DAY_OF_WEEK,
43                 TZDATE_DAY_OF_WEEK_IN_MONTH,
44                 TZDATE_AM_PM,
45                 TZDATE_HOUR,
46                 TZDATE_HOUR_OF_DAY,
47                 TZDATE_MINUTE,
48                 TZDATE_SECOND,
49                 TZDATE_MILLISECOND,
50                 TZDATE_ZONE_OFFSET,
51                 TZDATE_DST_OFFSET,
52
53                 TZDATE_FIELDS_COUNT,
54         };
55         
56         enum DSTTransition {
57                 PREV_TRANSITION,
58                 NEXT_TRANSITION
59         };
60         
61         ITZDate() {
62                 ;
63         }
64         virtual ~ITZDate() {
65                 ;
66         }
67
68         virtual bool  isNull() =0;
69         virtual long get(const TZDateFields field) =0;
70         virtual std::string getTimezone() =0;
71         virtual TZDateProperties toTimezone(const std::string timezone) =0;
72         virtual void set(const TZDateFields field, const long value) = 0;
73                 
74         virtual long getUTC(const TZDateFields field) = 0;
75         virtual void setUTC(const TZDateFields field, const long value) = 0;
76
77         virtual long long difference(const TZDateProperties &prop) =0;
78         virtual TZDateProperties addDuration(const DurationProperties &duration) =0;
79         virtual TZDateProperties toUTC() =0;
80         virtual TZDateProperties toLocalTimezone() =0;
81         virtual double getTime() =0;
82         virtual std::string toDateString(bool bLocale = false) =0;
83         virtual std::string toTimeString(bool bLocale = false)=0;       
84         virtual std::string toString(bool bLocale = false) =0;
85
86         virtual std::string getTimezoneAbbreviation() =0;
87         virtual long secondsFromUTC() =0;               
88         virtual bool isDST() =0;
89         virtual TZDateProperties getDSTTransition(DSTTransition trans) =0;
90 };
91
92 typedef DPL::SharedPtr<ITZDate> ITZDatePtr;
93
94 }
95 }
96 }
97
98 #endif /* _ABSTRACT_LAYER_IDATETIME_H_ */