Back to index

lightning-sunbird  0.9+nobinonly
nsIDateTimeFormat.h
Go to the documentation of this file.
00001 
00002 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00003  *
00004  * ***** BEGIN LICENSE BLOCK *****
00005  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00006  *
00007  * The contents of this file are subject to the Mozilla Public License Version
00008  * 1.1 (the "License"); you may not use this file except in compliance with
00009  * the License. You may obtain a copy of the License at
00010  * http://www.mozilla.org/MPL/
00011  *
00012  * Software distributed under the License is distributed on an "AS IS" basis,
00013  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00014  * for the specific language governing rights and limitations under the
00015  * License.
00016  *
00017  * The Original Code is mozilla.org code.
00018  *
00019  * The Initial Developer of the Original Code is
00020  * Netscape Communications Corporation.
00021  * Portions created by the Initial Developer are Copyright (C) 1998
00022  * the Initial Developer. All Rights Reserved.
00023  *
00024  * Contributor(s):
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either of the GNU General Public License Version 2 or later (the "GPL"),
00028  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 #ifndef nsIDateTimeFormat_h__
00040 #define nsIDateTimeFormat_h__
00041 
00042 
00043 #include "nsISupports.h"
00044 #include "nscore.h"
00045 #include "nsString.h"
00046 #include "nsILocale.h"
00047 #include "nsIScriptableDateFormat.h"
00048 #include "prtime.h"
00049 #include <time.h>
00050 
00051 
00052 // {2BBAA0B0-A591-11d2-9119-006008A6EDF6}
00053 #define NS_IDATETIMEFORMAT_IID \
00054 { 0x2bbaa0b0, 0xa591, 0x11d2, \
00055 { 0x91, 0x19, 0x0, 0x60, 0x8, 0xa6, 0xed, 0xf6 } }
00056 
00057 
00058 // Locale sensitive date and time format interface
00059 // 
00060 class nsIDateTimeFormat : public nsISupports {
00061 
00062 public: 
00063   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDATETIMEFORMAT_IID)
00064 
00065   // performs a locale sensitive date formatting operation on the time_t parameter
00066   NS_IMETHOD FormatTime(nsILocale* locale, 
00067                         const nsDateFormatSelector  dateFormatSelector, 
00068                         const nsTimeFormatSelector timeFormatSelector, 
00069                         const time_t  timetTime,
00070                         nsString& stringOut) = 0; 
00071 
00072   // performs a locale sensitive date formatting operation on the struct tm parameter
00073   NS_IMETHOD FormatTMTime(nsILocale* locale, 
00074                           const nsDateFormatSelector  dateFormatSelector, 
00075                           const nsTimeFormatSelector timeFormatSelector, 
00076                           const struct tm*  tmTime, 
00077                           nsString& stringOut) = 0; 
00078 
00079   // performs a locale sensitive date formatting operation on the PRTime parameter
00080   NS_IMETHOD FormatPRTime(nsILocale* locale, 
00081                           const nsDateFormatSelector  dateFormatSelector, 
00082                           const nsTimeFormatSelector timeFormatSelector, 
00083                           const PRTime  prTime, 
00084                           nsString& stringOut) = 0;
00085 
00086   // performs a locale sensitive date formatting operation on the PRExplodedTime parameter
00087   NS_IMETHOD FormatPRExplodedTime(nsILocale* locale, 
00088                                   const nsDateFormatSelector  dateFormatSelector, 
00089                                   const nsTimeFormatSelector timeFormatSelector, 
00090                                   const PRExplodedTime*  explodedTime, 
00091                                   nsString& stringOut) = 0; 
00092 };
00093 
00094 #endif  /* nsIDateTimeFormat_h__ */