1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/locale/src/windows/nsDateTimeFormatWin.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,72 @@ 1.4 + 1.5 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.6 + * 1.7 + * This Source Code Form is subject to the terms of the Mozilla Public 1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.10 +#ifndef nsDateTimeFormatWin_h__ 1.11 +#define nsDateTimeFormatWin_h__ 1.12 + 1.13 + 1.14 +#include "nsIDateTimeFormat.h" 1.15 +#include <windows.h> 1.16 + 1.17 + 1.18 +// Locale sensitive date and time format interface 1.19 +// 1.20 +class nsDateTimeFormatWin : public nsIDateTimeFormat { 1.21 + 1.22 +public: 1.23 + NS_DECL_THREADSAFE_ISUPPORTS 1.24 + 1.25 + // performs a locale sensitive date formatting operation on the time_t parameter 1.26 + NS_IMETHOD FormatTime(nsILocale* locale, 1.27 + const nsDateFormatSelector dateFormatSelector, 1.28 + const nsTimeFormatSelector timeFormatSelector, 1.29 + const time_t timetTime, 1.30 + nsAString& stringOut); 1.31 + 1.32 + // performs a locale sensitive date formatting operation on the struct tm parameter 1.33 + NS_IMETHOD FormatTMTime(nsILocale* locale, 1.34 + const nsDateFormatSelector dateFormatSelector, 1.35 + const nsTimeFormatSelector timeFormatSelector, 1.36 + const struct tm* tmTime, 1.37 + nsAString& stringOut); 1.38 + 1.39 + // performs a locale sensitive date formatting operation on the PRTime parameter 1.40 + NS_IMETHOD FormatPRTime(nsILocale* locale, 1.41 + const nsDateFormatSelector dateFormatSelector, 1.42 + const nsTimeFormatSelector timeFormatSelector, 1.43 + const PRTime prTime, 1.44 + nsAString& stringOut); 1.45 + 1.46 + // performs a locale sensitive date formatting operation on the PRExplodedTime parameter 1.47 + NS_IMETHOD FormatPRExplodedTime(nsILocale* locale, 1.48 + const nsDateFormatSelector dateFormatSelector, 1.49 + const nsTimeFormatSelector timeFormatSelector, 1.50 + const PRExplodedTime* explodedTime, 1.51 + nsAString& stringOut); 1.52 + 1.53 + nsDateTimeFormatWin() {mLocale.SetLength(0);mAppLocale.SetLength(0);} 1.54 + 1.55 + 1.56 + virtual ~nsDateTimeFormatWin() {} 1.57 + 1.58 +private: 1.59 + // init this interface to a specified locale 1.60 + NS_IMETHOD Initialize(nsILocale* locale); 1.61 + 1.62 + // call GetTimeFormatW or TimeFormatA 1.63 + int nsGetTimeFormatW(DWORD dwFlags, const SYSTEMTIME *lpTime, 1.64 + const char* format, char16_t *timeStr, int cchTime); 1.65 + 1.66 + // call GetDateFormatW or GetDateFormatA 1.67 + int nsGetDateFormatW(DWORD dwFlags, const SYSTEMTIME *lpDate, 1.68 + const char* format, char16_t *dateStr, int cchDate); 1.69 + 1.70 + nsString mLocale; 1.71 + nsString mAppLocale; 1.72 + uint32_t mLCID; // Windows platform locale ID 1.73 +}; 1.74 + 1.75 +#endif /* nsDateTimeFormatWin_h__ */