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 nsDateTimeFormatUnix_h__ michael@0: #define nsDateTimeFormatUnix_h__ michael@0: michael@0: michael@0: #include "nsICharsetConverterManager.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIDateTimeFormat.h" michael@0: michael@0: #define kPlatformLocaleLength 64 michael@0: michael@0: class nsDateTimeFormatUnix : 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: michael@0: nsDateTimeFormatUnix() {mLocale.Truncate();mAppLocale.Truncate();} michael@0: michael@0: virtual ~nsDateTimeFormatUnix() {} 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: void LocalePreferred24hour(); michael@0: michael@0: nsString mLocale; michael@0: nsString mAppLocale; michael@0: nsCString mCharset; // in order to convert API result to unicode michael@0: nsCString mPlatformLocale; // for setlocale michael@0: bool mLocalePreferred24hour; // true if 24 hour format is preferred by current locale michael@0: bool mLocaleAMPMfirst; // true if AM/PM string is preferred before the time michael@0: nsCOMPtr mDecoder; michael@0: }; michael@0: michael@0: #endif /* nsDateTimeFormatUnix_h__ */