Back to index

lightning-sunbird  0.9+nobinonly
calIDateTime.idl
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is Oracle Corporation code.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Oracle Corporation.
00018  * Portions created by the Initial Developer are Copyright (C) 2004
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *   Vladimir Vukicevic <vladimir.vukicevic@oracle.com>
00023  *   Dan Mosedale <dan.mosedale@oracle.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #include "nsISupports.idl"
00040 
00041 interface calIDuration;
00042 interface calITimezone;
00043 [ptr] native icaltimetypeptr(struct icaltimetype);
00044 
00045 [scriptable, uuid(5678d4a3-2543-4ece-afbb-079292f2866e)]
00046 interface calIDateTime : nsISupports
00047 {
00053   readonly attribute boolean isMutable;
00054 
00058   void makeImmutable();
00059 
00064   calIDateTime clone();
00065 
00070   // true if this thing is set/valid
00071   readonly attribute boolean isValid;
00072 
00088   attribute PRTime nativeTime;
00089 
00093   attribute short year;
00094 
00098   attribute short month;
00099 
00103   attribute short day;
00104 
00108   attribute short hour;
00109 
00113   attribute short minute;
00114 
00118   attribute short second;
00119 
00127   attribute calITimezone timezone;
00128 
00145   void resetTo(in short year,
00146                in short month,
00147                in short day,
00148                in short hour,
00149                in short minute,
00150                in short second,
00151                in calITimezone timezone);
00152 
00157   readonly attribute long timezoneOffset;
00158 
00165   attribute PRBool isDate;
00166 
00167   /*
00168    * computed values
00169    */
00170 
00174   readonly attribute short weekday;
00175 
00179   readonly attribute short yearday;
00180 
00181   /*
00182    * Methods
00183    */
00184 
00188   void reset();
00189 
00193   AUTF8String toString();
00194 
00200   void setTimeInTimezone(in PRTime aTime, in calITimezone aTimezone);
00201 
00209   calIDateTime getInTimezone(in calITimezone aTimezone);
00210 
00211   // add the given calIDateTime, treating it as a duration, to
00212   // this item.
00213   // XXX will change
00214   void addDuration (in calIDuration aDuration);
00215 
00216   // Subtract two dates and return a duration
00217   // returns duration of this - aOtherDate
00218   // if aOtherDate is > this the duration will be negative
00219   calIDuration subtractDate (in calIDateTime aOtherDate);
00220 
00236   long compare (in calIDateTime aOther);
00237 
00238   //
00239   // Some helper getters for calculating useful ranges
00240   //
00241 
00245   readonly attribute calIDateTime startOfWeek;
00246 
00250   readonly attribute calIDateTime endOfWeek;
00251 
00252   // the start/end of the current object's month
00253   readonly attribute calIDateTime startOfMonth;
00254   readonly attribute calIDateTime endOfMonth;
00255 
00256   // the start/end of the current object's year
00257   readonly attribute calIDateTime startOfYear;
00258   readonly attribute calIDateTime endOfYear;
00259 
00260   [noscript,notxpcom] void toIcalTime(in icaltimetypeptr itt);
00261 
00266   attribute ACString icalString;
00267 
00268   /* JS only:
00269    * // Setting jsDate via a JavaScript Date object will set
00270    * // the calIDateTime to the jsDate's time ***in UTC***.
00271    * // There's no way for us to recover TZ info from a jsDate,
00272    * // so we always pull it out as UTC, and force the calIDateTime's
00273    * // timezone to UTC.
00274    * attribute Date jsDate;
00275    *
00276    */
00277 };