michael@0: michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #ifndef nsDateTimeFormatWin_h__ michael@0: #define nsDateTimeFormatWin_h__ michael@0: michael@0: michael@0: #include "nsIDateTimeFormat.h" michael@0: #include michael@0: michael@0: michael@0: // Locale sensitive date and time format interface michael@0: // michael@0: class nsDateTimeFormatWin : public nsIDateTimeFormat { michael@0: michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: michael@0: // performs a locale sensitive date formatting operation on the time_t parameter michael@0: NS_IMETHOD FormatTime(nsILocale* locale, michael@0: const nsDateFormatSelector dateFormatSelector, michael@0: const nsTimeFormatSelector timeFormatSelector, michael@0: const time_t timetTime, michael@0: nsAString& stringOut); michael@0: michael@0: // performs a locale sensitive date formatting operation on the struct tm parameter michael@0: NS_IMETHOD FormatTMTime(nsILocale* locale, michael@0: const nsDateFormatSelector dateFormatSelector, michael@0: const nsTimeFormatSelector timeFormatSelector, michael@0: const struct tm* tmTime, michael@0: nsAString& stringOut); michael@0: michael@0: // performs a locale sensitive date formatting operation on the PRTime parameter michael@0: NS_IMETHOD FormatPRTime(nsILocale* locale, michael@0: const nsDateFormatSelector dateFormatSelector, michael@0: const nsTimeFormatSelector timeFormatSelector, michael@0: const PRTime prTime, michael@0: nsAString& stringOut); michael@0: michael@0: // performs a locale sensitive date formatting operation on the PRExplodedTime parameter michael@0: NS_IMETHOD FormatPRExplodedTime(nsILocale* locale, michael@0: const nsDateFormatSelector dateFormatSelector, michael@0: const nsTimeFormatSelector timeFormatSelector, michael@0: const PRExplodedTime* explodedTime, michael@0: nsAString& stringOut); michael@0: michael@0: nsDateTimeFormatWin() {mLocale.SetLength(0);mAppLocale.SetLength(0);} michael@0: michael@0: michael@0: virtual ~nsDateTimeFormatWin() {} michael@0: michael@0: private: michael@0: // init this interface to a specified locale michael@0: NS_IMETHOD Initialize(nsILocale* locale); michael@0: michael@0: // call GetTimeFormatW or TimeFormatA michael@0: int nsGetTimeFormatW(DWORD dwFlags, const SYSTEMTIME *lpTime, michael@0: const char* format, char16_t *timeStr, int cchTime); michael@0: michael@0: // call GetDateFormatW or GetDateFormatA michael@0: int nsGetDateFormatW(DWORD dwFlags, const SYSTEMTIME *lpDate, michael@0: const char* format, char16_t *dateStr, int cchDate); michael@0: michael@0: nsString mLocale; michael@0: nsString mAppLocale; michael@0: uint32_t mLCID; // Windows platform locale ID michael@0: }; michael@0: michael@0: #endif /* nsDateTimeFormatWin_h__ */