aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/renderer/MCDateFormatter.h
blob: 6467aae63ed57a9db15f74ef4c7f3e11acfb4a03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
//  MCDateFormatter.h
//  testUI
//
//  Created by DINH Viêt Hoà on 1/28/13.
//  Copyright (c) 2013 MailCore. All rights reserved.
//

#ifndef __testUI__MCDateFormatter__
#define __testUI__MCDateFormatter__

#include <mailcore/MCBaseTypes.h>
#include <unicode/udat.h>

#ifdef __cplusplus

namespace mailcore {
    
    class String;
    
    enum DateFormatStyle {
        DateFormatStyleFull = UDAT_FULL,
        DateFormatStyleLong = UDAT_LONG,
        DateFormatStyleMedium = UDAT_MEDIUM,
        DateFormatStyleShort = UDAT_SHORT,
        DateFormatStyleNone = UDAT_NONE,
    };
    
    class DateFormatter : public Object {
    public:
		DateFormatter();
		virtual ~DateFormatter();
		
		static DateFormatter * dateFormatter();
        
        virtual void setDateStyle(DateFormatStyle style);
        virtual DateFormatStyle dateStyle();
        
        virtual void setTimeStyle(DateFormatStyle style);
        virtual DateFormatStyle timeStyle();
        
        virtual void setLocale(String * locale);
        virtual String * locale();
        
        virtual void setTimezone(String * timezone);
        virtual String * timezone();
        
        virtual void setDateFormat(String * dateFormat);
        virtual String * dateFormat();
        
        virtual String * stringFromDate(time_t date);
        virtual time_t dateFromString(String * dateString);
        
    private:
        UDateFormat * mDateFormatter;
        DateFormatStyle mDateStyle;
        DateFormatStyle mTimeStyle;
        String * mDateFormat;
        String * mTimezone;
        String * mLocale;
        
        void prepare();
    };
    
}

#endif

#endif /* defined(__testUI__MCDateFormatter__) */