1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/locale/src/unix/nsDateTimeFormatUnix.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,70 @@ 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 nsDateTimeFormatUnix_h__ 1.11 +#define nsDateTimeFormatUnix_h__ 1.12 + 1.13 + 1.14 +#include "nsICharsetConverterManager.h" 1.15 +#include "nsCOMPtr.h" 1.16 +#include "nsIDateTimeFormat.h" 1.17 + 1.18 +#define kPlatformLocaleLength 64 1.19 + 1.20 +class nsDateTimeFormatUnix : 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 + 1.54 + nsDateTimeFormatUnix() {mLocale.Truncate();mAppLocale.Truncate();} 1.55 + 1.56 + virtual ~nsDateTimeFormatUnix() {} 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 + void LocalePreferred24hour(); 1.63 + 1.64 + nsString mLocale; 1.65 + nsString mAppLocale; 1.66 + nsCString mCharset; // in order to convert API result to unicode 1.67 + nsCString mPlatformLocale; // for setlocale 1.68 + bool mLocalePreferred24hour; // true if 24 hour format is preferred by current locale 1.69 + bool mLocaleAMPMfirst; // true if AM/PM string is preferred before the time 1.70 + nsCOMPtr <nsIUnicodeDecoder> mDecoder; 1.71 +}; 1.72 + 1.73 +#endif /* nsDateTimeFormatUnix_h__ */