Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsDateTimeFormatUnix_h__
8 #define nsDateTimeFormatUnix_h__
11 #include "nsICharsetConverterManager.h"
12 #include "nsCOMPtr.h"
13 #include "nsIDateTimeFormat.h"
15 #define kPlatformLocaleLength 64
17 class nsDateTimeFormatUnix : public nsIDateTimeFormat {
19 public:
20 NS_DECL_THREADSAFE_ISUPPORTS
22 // performs a locale sensitive date formatting operation on the time_t parameter
23 NS_IMETHOD FormatTime(nsILocale* locale,
24 const nsDateFormatSelector dateFormatSelector,
25 const nsTimeFormatSelector timeFormatSelector,
26 const time_t timetTime,
27 nsAString& stringOut);
29 // performs a locale sensitive date formatting operation on the struct tm parameter
30 NS_IMETHOD FormatTMTime(nsILocale* locale,
31 const nsDateFormatSelector dateFormatSelector,
32 const nsTimeFormatSelector timeFormatSelector,
33 const struct tm* tmTime,
34 nsAString& stringOut);
36 // performs a locale sensitive date formatting operation on the PRTime parameter
37 NS_IMETHOD FormatPRTime(nsILocale* locale,
38 const nsDateFormatSelector dateFormatSelector,
39 const nsTimeFormatSelector timeFormatSelector,
40 const PRTime prTime,
41 nsAString& stringOut);
43 // performs a locale sensitive date formatting operation on the PRExplodedTime parameter
44 NS_IMETHOD FormatPRExplodedTime(nsILocale* locale,
45 const nsDateFormatSelector dateFormatSelector,
46 const nsTimeFormatSelector timeFormatSelector,
47 const PRExplodedTime* explodedTime,
48 nsAString& stringOut);
51 nsDateTimeFormatUnix() {mLocale.Truncate();mAppLocale.Truncate();}
53 virtual ~nsDateTimeFormatUnix() {}
55 private:
56 // init this interface to a specified locale
57 NS_IMETHOD Initialize(nsILocale* locale);
59 void LocalePreferred24hour();
61 nsString mLocale;
62 nsString mAppLocale;
63 nsCString mCharset; // in order to convert API result to unicode
64 nsCString mPlatformLocale; // for setlocale
65 bool mLocalePreferred24hour; // true if 24 hour format is preferred by current locale
66 bool mLocaleAMPMfirst; // true if AM/PM string is preferred before the time
67 nsCOMPtr <nsIUnicodeDecoder> mDecoder;
68 };
70 #endif /* nsDateTimeFormatUnix_h__ */