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.
michael@0 | 1 | |
michael@0 | 2 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 3 | * |
michael@0 | 4 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 5 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 6 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 7 | #ifndef nsDateTimeFormatWin_h__ |
michael@0 | 8 | #define nsDateTimeFormatWin_h__ |
michael@0 | 9 | |
michael@0 | 10 | |
michael@0 | 11 | #include "nsIDateTimeFormat.h" |
michael@0 | 12 | #include <windows.h> |
michael@0 | 13 | |
michael@0 | 14 | |
michael@0 | 15 | // Locale sensitive date and time format interface |
michael@0 | 16 | // |
michael@0 | 17 | class nsDateTimeFormatWin : public nsIDateTimeFormat { |
michael@0 | 18 | |
michael@0 | 19 | public: |
michael@0 | 20 | NS_DECL_THREADSAFE_ISUPPORTS |
michael@0 | 21 | |
michael@0 | 22 | // performs a locale sensitive date formatting operation on the time_t parameter |
michael@0 | 23 | NS_IMETHOD FormatTime(nsILocale* locale, |
michael@0 | 24 | const nsDateFormatSelector dateFormatSelector, |
michael@0 | 25 | const nsTimeFormatSelector timeFormatSelector, |
michael@0 | 26 | const time_t timetTime, |
michael@0 | 27 | nsAString& stringOut); |
michael@0 | 28 | |
michael@0 | 29 | // performs a locale sensitive date formatting operation on the struct tm parameter |
michael@0 | 30 | NS_IMETHOD FormatTMTime(nsILocale* locale, |
michael@0 | 31 | const nsDateFormatSelector dateFormatSelector, |
michael@0 | 32 | const nsTimeFormatSelector timeFormatSelector, |
michael@0 | 33 | const struct tm* tmTime, |
michael@0 | 34 | nsAString& stringOut); |
michael@0 | 35 | |
michael@0 | 36 | // performs a locale sensitive date formatting operation on the PRTime parameter |
michael@0 | 37 | NS_IMETHOD FormatPRTime(nsILocale* locale, |
michael@0 | 38 | const nsDateFormatSelector dateFormatSelector, |
michael@0 | 39 | const nsTimeFormatSelector timeFormatSelector, |
michael@0 | 40 | const PRTime prTime, |
michael@0 | 41 | nsAString& stringOut); |
michael@0 | 42 | |
michael@0 | 43 | // performs a locale sensitive date formatting operation on the PRExplodedTime parameter |
michael@0 | 44 | NS_IMETHOD FormatPRExplodedTime(nsILocale* locale, |
michael@0 | 45 | const nsDateFormatSelector dateFormatSelector, |
michael@0 | 46 | const nsTimeFormatSelector timeFormatSelector, |
michael@0 | 47 | const PRExplodedTime* explodedTime, |
michael@0 | 48 | nsAString& stringOut); |
michael@0 | 49 | |
michael@0 | 50 | nsDateTimeFormatWin() {mLocale.SetLength(0);mAppLocale.SetLength(0);} |
michael@0 | 51 | |
michael@0 | 52 | |
michael@0 | 53 | virtual ~nsDateTimeFormatWin() {} |
michael@0 | 54 | |
michael@0 | 55 | private: |
michael@0 | 56 | // init this interface to a specified locale |
michael@0 | 57 | NS_IMETHOD Initialize(nsILocale* locale); |
michael@0 | 58 | |
michael@0 | 59 | // call GetTimeFormatW or TimeFormatA |
michael@0 | 60 | int nsGetTimeFormatW(DWORD dwFlags, const SYSTEMTIME *lpTime, |
michael@0 | 61 | const char* format, char16_t *timeStr, int cchTime); |
michael@0 | 62 | |
michael@0 | 63 | // call GetDateFormatW or GetDateFormatA |
michael@0 | 64 | int nsGetDateFormatW(DWORD dwFlags, const SYSTEMTIME *lpDate, |
michael@0 | 65 | const char* format, char16_t *dateStr, int cchDate); |
michael@0 | 66 | |
michael@0 | 67 | nsString mLocale; |
michael@0 | 68 | nsString mAppLocale; |
michael@0 | 69 | uint32_t mLCID; // Windows platform locale ID |
michael@0 | 70 | }; |
michael@0 | 71 | |
michael@0 | 72 | #endif /* nsDateTimeFormatWin_h__ */ |