Renamed several classes that had Julian in front.

Changed them to nsCal.
i.e. Julian_Duration -> nsCalDuration.
     JulianRecurrenceID -> nsCalRecurrenceID.
This commit is contained in:
jsun%netscape.com 1998-09-28 20:46:22 +00:00
Родитель aab3b5a872
Коммит 652033e5f8
10 изменённых файлов: 132 добавлений и 132 удалений

Просмотреть файл

@ -412,19 +412,19 @@ public:
* adds a duration amount to this datetime * adds a duration amount to this datetime
* @param d the duration to add * @param d the duration to add
*/ */
void add(Julian_Duration d); void add(nsCalDuration d);
/** /**
* subtracts a duration amount from this datetime * subtracts a duration amount from this datetime
* @param d the duration to subtract * @param d the duration to subtract
*/ */
void subtract(Julian_Duration d); void subtract(nsCalDuration d);
/** /**
* given two datetimes, return the duration length between them. * given two datetimes, return the duration length between them.
* if end before start, return an invalid duration. * if end before start, return an invalid duration.
*/ */
static Julian_Duration & getDuration(DateTime start, DateTime end, Julian_Duration & out); static nsCalDuration & getDuration(DateTime start, DateTime end, nsCalDuration & out);
/** /**
* Clears all fields * Clears all fields

Просмотреть файл

@ -30,18 +30,18 @@
#include "nscalutilexp.h" #include "nscalutilexp.h"
/** /**
* The Julian_Duration class implements the "duration" data type. * The nsCalDuration class implements the "duration" data type.
* The "duration" data type is used to identify properties that contain * The "duration" data type is used to identify properties that contain
* a duration of time. * a duration of time.
* For example: * For example:
* *
* P10Y3M15DT5H30M20S * P10Y3M15DT5H30M20S
* *
* The Julian_Duration class models the duration datatype specified in the iCalendar document. * The nsCalDuration class models the duration datatype specified in the iCalendar document.
* Assertion: if week value is not equal is zero, then all other values must be zero * Assertion: if week value is not equal is zero, then all other values must be zero
* *
*/ */
class NS_CAL_UTIL Julian_Duration class NS_CAL_UTIL nsCalDuration
{ {
private: private:
@ -80,7 +80,7 @@ private:
void setInvalidDuration(); void setInvalidDuration();
/** /**
* parse an iCal Julian_Duration string and populate the data members * parse an iCal nsCalDuration string and populate the data members
* *
* @param us the iCal Duraton string * @param us the iCal Duraton string
*/ */
@ -95,34 +95,34 @@ public:
/** /**
* default constrctor, set duration to 5 min. * default constrctor, set duration to 5 min.
*/ */
Julian_Duration(); nsCalDuration();
/** /**
* Constructs a Julian_Duration object using the grammar * Constructs a nsCalDuration object using the grammar
* defined in the iCalendar spec. * defined in the iCalendar spec.
* *
* @param s String to parse * @param s String to parse
*/ */
Julian_Duration(UnicodeString & us); nsCalDuration(UnicodeString & us);
/** /**
* Constructs a copy of a Julian_Duration object. * Constructs a copy of a nsCalDuration object.
* *
* @param d Julian_Duration to copy * @param d nsCalDuration to copy
*/ */
Julian_Duration(Julian_Duration & aDuration); nsCalDuration(nsCalDuration & aDuration);
/** /**
* Constructs a Julian_Duration object with a single value set. * Constructs a nsCalDuration object with a single value set.
* Always yields a positive Duration * Always yields a positive Duration
* *
* @param type the field to set (uses <code>Recurrence</code> type constants) * @param type the field to set (uses <code>Recurrence</code> type constants)
* @param value value to assign the field * @param value value to assign the field
*/ */
Julian_Duration(t_int32 type, t_int32 value); nsCalDuration(t_int32 type, t_int32 value);
/** /**
* Constructs a Julian_Duration object with a single value set. * Constructs a nsCalDuration object with a single value set.
* Always yields a positive Duration * Always yields a positive Duration
* Setting the week != 0 automatically ignores other param values and sets them to 0. * Setting the week != 0 automatically ignores other param values and sets them to 0.
* Setting any param (year,month,day,hour,min,sec) < 0 automatically creates an invalid Duration. * Setting any param (year,month,day,hour,min,sec) < 0 automatically creates an invalid Duration.
@ -136,12 +136,12 @@ public:
* @param week intiial week value * @param week intiial week value
* @param isNegativeDuration TRUE if duration is negative, FALSE otherwise * @param isNegativeDuration TRUE if duration is negative, FALSE otherwise
*/ */
Julian_Duration(t_int32 year, t_int32 month, t_int32 day, t_int32 hour, t_int32 min, nsCalDuration(t_int32 year, t_int32 month, t_int32 day, t_int32 hour, t_int32 min,
t_int32 sec, t_int32 week, t_bool bNegativeDuration = FALSE); t_int32 sec, t_int32 week, t_bool bNegativeDuration = FALSE);
/** /**
* Destructor. * Destructor.
*/ */
~Julian_Duration(); ~nsCalDuration();
/*----------------------------- /*-----------------------------
** GETTERS and SETTERS ** GETTERS and SETTERS
@ -295,12 +295,12 @@ public:
/** /**
* Comparision method. * Comparision method.
* @param d Julian_Duration to compare to. * @param d nsCalDuration to compare to.
* *
* @return -1 if this is shorter, 0 if equal, 1 if longer * @return -1 if this is shorter, 0 if equal, 1 if longer
* length of duration * length of duration
*/ */
t_int32 compareTo(const Julian_Duration &d); t_int32 compareTo(const nsCalDuration &d);
/** /**
* Normalizes the current duration. This means rounding off * Normalizes the current duration. This means rounding off
@ -325,16 +325,16 @@ public:
t_bool isZeroLength(); t_bool isZeroLength();
/** /**
* returns this Julian_Duration object to a UnicodeString * returns this nsCalDuration object to a UnicodeString
* *
* @return a UnicodeString representing the human-readable format of this Julian_Duration * @return a UnicodeString representing the human-readable format of this nsCalDuration
*/ */
UnicodeString toString(); UnicodeString toString();
/** /**
* returns this Julian_Duration object to a UnicodeString * returns this nsCalDuration object to a UnicodeString
* *
* @return a UnicodeString representing the iCal format of this Julian_Duration * @return a UnicodeString representing the iCal format of this nsCalDuration
*/ */
UnicodeString toICALString(); UnicodeString toICALString();
@ -353,44 +353,44 @@ public:
/** /**
* assignment operator * assignment operator
* *
* @param d Julian_Duration to copy * @param d nsCalDuration to copy
* @return a copy of that Julian_Duration * @return a copy of that nsCalDuration
*/ */
const Julian_Duration &operator=(const Julian_Duration & d); const nsCalDuration &operator=(const nsCalDuration & d);
/** /**
* (==) equality operator * (==) equality operator
* *
* @param d Julian_Duration to copy * @param d nsCalDuration to copy
* @return TRUE if this is equal to d, otherwise FALSE * @return TRUE if this is equal to d, otherwise FALSE
*/ */
t_bool operator==(const Julian_Duration & that); t_bool operator==(const nsCalDuration & that);
/** /**
* (!=) in-equality operator * (!=) in-equality operator
* *
* @param d Julian_Duration to copy * @param d nsCalDuration to copy
* @return TRUE if this NOT equal to d, otherwise FALSE * @return TRUE if this NOT equal to d, otherwise FALSE
*/ */
t_bool operator!=(const Julian_Duration & that); t_bool operator!=(const nsCalDuration & that);
/*-- TODO - make normalize work so that >, < will work correctly */ /*-- TODO - make normalize work so that >, < will work correctly */
/** /**
* (>) greater than operator * (>) greater than operator
* *
* @param d Julian_Duration to copy * @param d nsCalDuration to copy
* @return TRUE if this is longer duration than d, otherwise FALSE * @return TRUE if this is longer duration than d, otherwise FALSE
*/ */
t_bool operator>(const Julian_Duration & that); t_bool operator>(const nsCalDuration & that);
/** /**
* (<) less than operator * (<) less than operator
* *
* @param d Julian_Duration to copy * @param d nsCalDuration to copy
* @return TRUE if this is shorter duration than d, otherwise FALSE * @return TRUE if this is shorter duration than d, otherwise FALSE
*/ */
t_bool operator<(const Julian_Duration & that); t_bool operator<(const nsCalDuration & that);
}; };
#endif /* __DURATION_H_ */ #endif /* __DURATION_H_ */

Просмотреть файл

@ -22,8 +22,8 @@
* 2/3/98 10:12:32 AM * 2/3/98 10:12:32 AM
*/ */
#ifndef __JULIANUTILITY_H_ #ifndef __NSCALUTILITY_H_
#define __JULIANUTILITY_H_ #define __NSCALUTILITY_H_
#include <unistring.h> #include <unistring.h>
#include <calendar.h> #include <calendar.h>
@ -36,14 +36,14 @@
* Also defines the RecurrenceType, which is used by the * Also defines the RecurrenceType, which is used by the
* generator and Recurrence classes for defining span and interval lengths. * generator and Recurrence classes for defining span and interval lengths.
*/ */
class NS_CAL_UTIL JulianUtility class NS_CAL_UTIL nsCalUtility
{ {
private: private:
/** /**
* Hide constructor from clients * Hide constructor from clients
*/ */
JulianUtility(); nsCalUtility();
public: public:
@ -124,5 +124,5 @@ public:
static UnicodeString & addDoubleQuotes(UnicodeString & us); static UnicodeString & addDoubleQuotes(UnicodeString & us);
}; };
#endif /* __JULIANUTILITY_H_ */ #endif /* __NSCALUTILITY_H_ */

Просмотреть файл

@ -48,13 +48,13 @@ public:
NS_IMETHOD SetMinute(PRUint32 aMinute); NS_IMETHOD SetMinute(PRUint32 aMinute);
NS_IMETHOD SetSecond(PRUint32 aSecond); NS_IMETHOD SetSecond(PRUint32 aSecond);
NS_IMETHOD_(Julian_Duration&) GetDuration(); NS_IMETHOD_(nsCalDuration&) GetDuration();
protected: protected:
~nsDuration(); ~nsDuration();
private: private:
Julian_Duration * mDuration; nsCalDuration * mDuration;
}; };

Просмотреть файл

@ -22,8 +22,8 @@
* 3/19/98 5:35:59 PM * 3/19/98 5:35:59 PM
*/ */
#ifndef __JULIANUIDRANDOMGENERATOR_H_ #ifndef __NSCALRANDOMGENERATOR_H_
#define __JULIANUIDRANDOMGENERATOR_H_ #define __NSCALRANDOMGENERATOR_H_
#include <unistring.h> #include <unistring.h>
#include "nscalutilexp.h" #include "nscalutilexp.h"
@ -31,14 +31,14 @@
/** /**
* Class that contains method to generate random UID strings. * Class that contains method to generate random UID strings.
*/ */
class NS_CAL_UTIL JulianUIDRandomGenerator class NS_CAL_UTIL nsCalUIDRandomGenerator
{ {
public: public:
/** default constructor. It's of no use */ /** default constructor. It's of no use */
JulianUIDRandomGenerator(); nsCalUIDRandomGenerator();
/** destructor. It's of no use */ /** destructor. It's of no use */
~JulianUIDRandomGenerator(); ~nsCalUIDRandomGenerator();
/** /**
* generates random UID strings by appending * generates random UID strings by appending
@ -63,5 +63,5 @@ public:
static UnicodeString generate(UnicodeString us); static UnicodeString generate(UnicodeString us);
}; };
#endif /*__JULIANUIDRANDOMGENERATOR_H_ */ #endif /*__NSCALRANDOMGENERATOR_H_ */

Просмотреть файл

@ -760,7 +760,7 @@ void DateTime::add(Calendar::EDateFields aField, t_int32 amount)
//--------------------------------------------------------------------- //---------------------------------------------------------------------
void DateTime::add(Julian_Duration d) void DateTime::add(nsCalDuration d)
{ {
add(Calendar::YEAR, d.getYear()); add(Calendar::YEAR, d.getYear());
add(Calendar::MONTH, d.getMonth()); add(Calendar::MONTH, d.getMonth());
@ -773,7 +773,7 @@ void DateTime::add(Julian_Duration d)
//--------------------------------------------------------------------- //---------------------------------------------------------------------
void DateTime::subtract(Julian_Duration d) void DateTime::subtract(nsCalDuration d)
{ {
add(Calendar::YEAR, - d.getYear()); add(Calendar::YEAR, - d.getYear());
add(Calendar::MONTH, - d.getMonth()); add(Calendar::MONTH, - d.getMonth());
@ -785,8 +785,8 @@ void DateTime::subtract(Julian_Duration d)
} }
//--------------------------------------------------------------------- //---------------------------------------------------------------------
Julian_Duration & DateTime::getDuration(DateTime start, DateTime end, nsCalDuration & DateTime::getDuration(DateTime start, DateTime end,
Julian_Duration & out) nsCalDuration & out)
{ {
t_int32 y = 0, mo = 0, d = 0, h = 0, m = 0, s = 0; t_int32 y = 0, mo = 0, d = 0, h = 0, m = 0, s = 0;
t_int32 toNextMonth = 0; t_int32 toNextMonth = 0;
@ -1370,15 +1370,15 @@ DateTime::IsParseable(UnicodeString & s, t_int32 & iYear, t_int32 & iMonth,
/* /*
// old way, works but slow and leaks // old way, works but slow and leaks
iYear = JulianUtility::atot_int32(s.extract(0, 4, temp).toCString(""), bParseError, 4); iYear = nsCalUtility::atot_int32(s.extract(0, 4, temp).toCString(""), bParseError, 4);
iMonth = JulianUtility::atot_int32(s.extract(4, 2, temp).toCString(""), bParseError, 2); iMonth = nsCalUtility::atot_int32(s.extract(4, 2, temp).toCString(""), bParseError, 2);
iDay = JulianUtility::atot_int32(s.extract(6, 2, temp).toCString(""), bParseError, 2); iDay = nsCalUtility::atot_int32(s.extract(6, 2, temp).toCString(""), bParseError, 2);
*/ */
// new way is faster, but uses ptr arithmetic // new way is faster, but uses ptr arithmetic
iYear = JulianUtility::atot_int32(c, bParseError, 4); iYear = nsCalUtility::atot_int32(c, bParseError, 4);
iMonth = JulianUtility::atot_int32(c + 4, bParseError, 2); iMonth = nsCalUtility::atot_int32(c + 4, bParseError, 2);
iDay = JulianUtility::atot_int32(c + 6, bParseError, 2); iDay = nsCalUtility::atot_int32(c + 6, bParseError, 2);
if (iMonth > 12 || iDay > 31) if (iMonth > 12 || iDay > 31)
{ {
@ -1394,15 +1394,15 @@ DateTime::IsParseable(UnicodeString & s, t_int32 & iYear, t_int32 & iMonth,
{ {
/* /*
// old way, works but slow // old way, works but slow
iHour = JulianUtility::atot_int32(s.extract(9, 2, temp).toCString(""), bParseError, 2); iHour = nsCalUtility::atot_int32(s.extract(9, 2, temp).toCString(""), bParseError, 2);
iMinute= JulianUtility::atot_int32(s.extract(11, 2, temp).toCString(""), bParseError, 2); iMinute= nsCalUtility::atot_int32(s.extract(11, 2, temp).toCString(""), bParseError, 2);
iSecond= JulianUtility::atot_int32(s.extract(13, 2, temp).toCString(""), bParseError, 2); iSecond= nsCalUtility::atot_int32(s.extract(13, 2, temp).toCString(""), bParseError, 2);
*/ */
// new way is faster, but uses ptr arithmetic // new way is faster, but uses ptr arithmetic
iHour = JulianUtility::atot_int32(c + 9, bParseError, 2); iHour = nsCalUtility::atot_int32(c + 9, bParseError, 2);
iMinute = JulianUtility::atot_int32(c + 11, bParseError, 2); iMinute = nsCalUtility::atot_int32(c + 11, bParseError, 2);
iSecond = JulianUtility::atot_int32(c + 13, bParseError, 2); iSecond = nsCalUtility::atot_int32(c + 13, bParseError, 2);
if (iHour > 23 || iMinute > 59 || iSecond > 59) if (iHour > 23 || iMinute > 59 || iSecond > 59)
{ {
@ -1459,12 +1459,12 @@ t_bool DateTime::IsParseableUTCOffset(UnicodeString & s,
/* /*
// old way, works but slow and leaks // old way, works but slow and leaks
iHour = JulianUtility::atot_int32(s.extract(1, 2, u).toCString(""), bParseError, 2); iHour = nsCalUtility::atot_int32(s.extract(1, 2, u).toCString(""), bParseError, 2);
iMin = JulianUtility::atot_int32(s.extract(3, 2, u).toCString(""), bParseError, 2); iMin = nsCalUtility::atot_int32(s.extract(3, 2, u).toCString(""), bParseError, 2);
*/ */
iHour = JulianUtility::atot_int32(cc + 1, bParseError, 2); iHour = nsCalUtility::atot_int32(cc + 1, bParseError, 2);
iMin = JulianUtility::atot_int32(cc + 3, bParseError, 2); iMin = nsCalUtility::atot_int32(cc + 3, bParseError, 2);
delete [] cc; delete [] cc;

Просмотреть файл

@ -30,10 +30,10 @@
#include "jutility.h" #include "jutility.h"
// turn this flag on to allow for parsing of year and month // turn this flag on to allow for parsing of year and month
#define JULIAN_DURATION_PARSING_YEAR_AND_MONTH 1 #define NSCALDURATION_PARSING_YEAR_AND_MONTH 1
//--------------------------------------------------------------------- //---------------------------------------------------------------------
void Julian_Duration::setInvalidDuration() void nsCalDuration::setInvalidDuration()
{ {
m_iYear = -1; m_iYear = -1;
m_iMonth = -1; m_iMonth = -1;
@ -46,7 +46,7 @@ void Julian_Duration::setInvalidDuration()
//--------------------------------------------------------------------- //---------------------------------------------------------------------
void Julian_Duration::parse(UnicodeString & us) void nsCalDuration::parse(UnicodeString & us)
{ {
// NOTE: use a better algorithm like a regexp scanf or something. // NOTE: use a better algorithm like a regexp scanf or something.
@ -56,7 +56,7 @@ void Julian_Duration::parse(UnicodeString & us)
t_bool bErrorInParse = FALSE; t_bool bErrorInParse = FALSE;
t_int32 startOfParse = 0, indexOfT = 0, endOfParse = 0; t_int32 startOfParse = 0, indexOfT = 0, endOfParse = 0;
t_int32 day = 0, hour = 0, minute = 0, second = 0, week = 0; t_int32 day = 0, hour = 0, minute = 0, second = 0, week = 0;
#if JULIAN_DURATION_PARSING_YEAR_AND_MONTH #if NSCALDURATION_PARSING_YEAR_AND_MONTH
t_int32 year = 0, month = 0; t_int32 year = 0, month = 0;
t_int32 indexOfY = 0, indexOfMo = 0; t_int32 indexOfY = 0, indexOfMo = 0;
#endif #endif
@ -98,14 +98,14 @@ void Julian_Duration::parse(UnicodeString & us)
startOfParse = 0; startOfParse = 0;
endOfParse = sSection.size(); endOfParse = sSection.size();
#if JULIAN_DURATION_PARSING_YEAR_AND_MONTH #if NSCALDURATION_PARSING_YEAR_AND_MONTH
indexOfY = sSection.indexOf('Y'); indexOfY = sSection.indexOf('Y');
if (indexOfY >= 0) if (indexOfY >= 0)
{ {
sVal = sSection.extractBetween(startOfParse, indexOfY, sVal); sVal = sSection.extractBetween(startOfParse, indexOfY, sVal);
cc = sVal.toCString(""); cc = sVal.toCString("");
PR_ASSERT(cc != 0); PR_ASSERT(cc != 0);
year = JulianUtility::atot_int32(cc, year = nsCalUtility::atot_int32(cc,
bErrorInParse, sVal.size()); bErrorInParse, sVal.size());
delete [] cc; delete [] cc;
startOfParse = indexOfY + 1; startOfParse = indexOfY + 1;
@ -116,7 +116,7 @@ void Julian_Duration::parse(UnicodeString & us)
sVal = sSection.extractBetween(startOfParse, indexOfMo, sVal); sVal = sSection.extractBetween(startOfParse, indexOfMo, sVal);
cc = sVal.toCString(""); cc = sVal.toCString("");
PR_ASSERT(cc != 0); PR_ASSERT(cc != 0);
month = JulianUtility::atot_int32(cc, month = nsCalUtility::atot_int32(cc,
bErrorInParse, sVal.size()); bErrorInParse, sVal.size());
delete [] cc; delete [] cc;
startOfParse = indexOfMo + 1; startOfParse = indexOfMo + 1;
@ -128,12 +128,12 @@ void Julian_Duration::parse(UnicodeString & us)
sVal = sSection.extractBetween(startOfParse, indexOfD, sVal); sVal = sSection.extractBetween(startOfParse, indexOfD, sVal);
cc = sVal.toCString(""); cc = sVal.toCString("");
PR_ASSERT(cc != 0); PR_ASSERT(cc != 0);
day = JulianUtility::atot_int32(cc, day = nsCalUtility::atot_int32(cc,
bErrorInParse, sVal.size()); bErrorInParse, sVal.size());
delete [] cc; delete [] cc;
startOfParse = indexOfD + 1; startOfParse = indexOfD + 1;
} }
#if JULIAN_DURATION_PARSING_YEAR_AND_MONTH #if NSCALDURATION_PARSING_YEAR_AND_MONTH
if (sSection.size() >= 1 && indexOfY == -1 && if (sSection.size() >= 1 && indexOfY == -1 &&
indexOfMo == -1 && indexOfD == -1) indexOfMo == -1 && indexOfD == -1)
{ {
@ -173,7 +173,7 @@ void Julian_Duration::parse(UnicodeString & us)
sVal = sSection.extractBetween(startOfParse, indexOfH, sVal); sVal = sSection.extractBetween(startOfParse, indexOfH, sVal);
cc = sVal.toCString(""); cc = sVal.toCString("");
PR_ASSERT(cc != 0); PR_ASSERT(cc != 0);
hour = JulianUtility::atot_int32(cc, hour = nsCalUtility::atot_int32(cc,
bErrorInParse, sVal.size()); bErrorInParse, sVal.size());
delete [] cc; delete [] cc;
startOfParse = indexOfH + 1; startOfParse = indexOfH + 1;
@ -184,7 +184,7 @@ void Julian_Duration::parse(UnicodeString & us)
sVal = sSection.extractBetween(startOfParse, indexOfMi, sVal); sVal = sSection.extractBetween(startOfParse, indexOfMi, sVal);
cc = sVal.toCString(""); cc = sVal.toCString("");
PR_ASSERT(cc != 0); PR_ASSERT(cc != 0);
minute = JulianUtility::atot_int32(cc, minute = nsCalUtility::atot_int32(cc,
bErrorInParse, sVal.size()); bErrorInParse, sVal.size());
delete [] cc; delete [] cc;
startOfParse = indexOfMi + 1; startOfParse = indexOfMi + 1;
@ -195,7 +195,7 @@ void Julian_Duration::parse(UnicodeString & us)
sVal = sSection.extractBetween(startOfParse, indexOfS, sVal); sVal = sSection.extractBetween(startOfParse, indexOfS, sVal);
cc = sVal.toCString(""); cc = sVal.toCString("");
PR_ASSERT(cc != 0); PR_ASSERT(cc != 0);
second = JulianUtility::atot_int32(cc, second = nsCalUtility::atot_int32(cc,
bErrorInParse, sVal.size()); bErrorInParse, sVal.size());
delete [] cc; delete [] cc;
startOfParse = indexOfS + 1; startOfParse = indexOfS + 1;
@ -228,13 +228,13 @@ void Julian_Duration::parse(UnicodeString & us)
sVal = us.extractBetween(1, us.size() - 1, sVal); sVal = us.extractBetween(1, us.size() - 1, sVal);
cc = sVal.toCString(""); cc = sVal.toCString("");
PR_ASSERT(cc != 0); PR_ASSERT(cc != 0);
week = JulianUtility::atot_int32(cc, week = nsCalUtility::atot_int32(cc,
bErrorInParse, sVal.size()); bErrorInParse, sVal.size());
delete [] cc; delete [] cc;
} }
} }
//if (FALSE) TRACE("parse: %d W, %d Y %d M %d D T %d H %d M %d S\r\n", week, year, month, day, hour, minute, second); //if (FALSE) TRACE("parse: %d W, %d Y %d M %d D T %d H %d M %d S\r\n", week, year, month, day, hour, minute, second);
#if JULIAN_DURATION_PARSING_YEAR_AND_MONTH #if NSCALDURATION_PARSING_YEAR_AND_MONTH
if (year < 0 || month < 0 || day < 0 || if (year < 0 || month < 0 || day < 0 ||
hour < 0 || minute < 0 || second < 0 || week < 0) hour < 0 || minute < 0 || second < 0 || week < 0)
bErrorInParse = TRUE; bErrorInParse = TRUE;
@ -251,7 +251,7 @@ void Julian_Duration::parse(UnicodeString & us)
} }
else else
{ {
#if JULIAN_DURATION_PARSING_YEAR_AND_MONTH #if NSCALDURATION_PARSING_YEAR_AND_MONTH
m_iYear = year; m_iYear = year;
m_iMonth = month; m_iMonth = month;
@ -276,7 +276,7 @@ void Julian_Duration::parse(UnicodeString & us)
//--------------------------------------------------------------------- //---------------------------------------------------------------------
Julian_Duration::Julian_Duration() nsCalDuration::nsCalDuration()
: :
m_iYear(0),m_iMonth(0),m_iDay(0),m_iHour(0), m_iYear(0),m_iMonth(0),m_iDay(0),m_iHour(0),
m_iMinute(0),m_iSecond(0), m_iWeek(0), m_iMinute(0),m_iSecond(0), m_iWeek(0),
@ -286,7 +286,7 @@ Julian_Duration::Julian_Duration()
//--------------------------------------------------------------------- //---------------------------------------------------------------------
Julian_Duration::Julian_Duration(UnicodeString & us) nsCalDuration::nsCalDuration(UnicodeString & us)
: :
m_iYear(0),m_iMonth(0),m_iDay(0),m_iHour(0), m_iYear(0),m_iMonth(0),m_iDay(0),m_iHour(0),
m_iMinute(0),m_iSecond(0), m_iWeek(0), m_iMinute(0),m_iSecond(0), m_iWeek(0),
@ -297,7 +297,7 @@ Julian_Duration::Julian_Duration(UnicodeString & us)
//--------------------------------------------------------------------- //---------------------------------------------------------------------
Julian_Duration::Julian_Duration(t_int32 type, t_int32 value) nsCalDuration::nsCalDuration(t_int32 type, t_int32 value)
: :
m_iYear(0),m_iMonth(0),m_iDay(0),m_iHour(0), m_iYear(0),m_iMonth(0),m_iDay(0),m_iHour(0),
m_iMinute(0),m_iSecond(0), m_iWeek(0), m_iMinute(0),m_iSecond(0), m_iWeek(0),
@ -305,22 +305,22 @@ Julian_Duration::Julian_Duration(t_int32 type, t_int32 value)
{ {
switch (type) switch (type)
{ {
case JulianUtility::RT_MINUTELY: case nsCalUtility::RT_MINUTELY:
m_iMinute = value; m_iMinute = value;
break; break;
case JulianUtility::RT_HOURLY: case nsCalUtility::RT_HOURLY:
m_iHour = value; m_iHour = value;
break; break;
case JulianUtility::RT_DAILY: case nsCalUtility::RT_DAILY:
m_iDay = value; m_iDay = value;
break; break;
case JulianUtility::RT_WEEKLY: case nsCalUtility::RT_WEEKLY:
m_iWeek = value; m_iWeek = value;
break; break;
case JulianUtility::RT_MONTHLY: case nsCalUtility::RT_MONTHLY:
m_iMonth = value; m_iMonth = value;
break; break;
case JulianUtility::RT_YEARLY: case nsCalUtility::RT_YEARLY:
m_iYear = value; m_iYear = value;
break; break;
default: default:
@ -330,7 +330,7 @@ Julian_Duration::Julian_Duration(t_int32 type, t_int32 value)
//--------------------------------------------------------------------- //---------------------------------------------------------------------
Julian_Duration::Julian_Duration(Julian_Duration & d) nsCalDuration::nsCalDuration(nsCalDuration & d)
: :
m_iYear(0),m_iMonth(0),m_iDay(0),m_iHour(0), m_iYear(0),m_iMonth(0),m_iDay(0),m_iHour(0),
m_iMinute(0),m_iSecond(0), m_iWeek(0), m_iMinute(0),m_iSecond(0), m_iWeek(0),
@ -360,7 +360,7 @@ Julian_Duration::Julian_Duration(Julian_Duration & d)
} }
//--------------------------------------------------------------------- //---------------------------------------------------------------------
Julian_Duration::Julian_Duration(t_int32 year, t_int32 month, t_int32 day, nsCalDuration::nsCalDuration(t_int32 year, t_int32 month, t_int32 day,
t_int32 hour, t_int32 min, t_int32 sec, t_int32 hour, t_int32 min, t_int32 sec,
t_int32 week, t_bool bNegativeDuration) t_int32 week, t_bool bNegativeDuration)
{ {
@ -382,7 +382,7 @@ Julian_Duration::Julian_Duration(t_int32 year, t_int32 month, t_int32 day,
//--------------------------------------------------------------------- //---------------------------------------------------------------------
Julian_Duration::~Julian_Duration() nsCalDuration::~nsCalDuration()
{ {
} }
@ -391,7 +391,7 @@ Julian_Duration::~Julian_Duration()
/////////////////////////////////// ///////////////////////////////////
// GETTERS AND SETTERS // GETTERS AND SETTERS
/////////////////////////////////// ///////////////////////////////////
void Julian_Duration::set(t_int32 year, t_int32 month, t_int32 day, void nsCalDuration::set(t_int32 year, t_int32 month, t_int32 day,
t_int32 hour, t_int32 min, t_int32 sec, t_bool t_int32 hour, t_int32 min, t_int32 sec, t_bool
bNegativeDuration) bNegativeDuration)
{ {
@ -405,7 +405,7 @@ void Julian_Duration::set(t_int32 year, t_int32 month, t_int32 day,
m_iWeek = 0; m_iWeek = 0;
} }
void Julian_Duration::set(t_int32 week, t_bool bNegativeDuration) void nsCalDuration::set(t_int32 week, t_bool bNegativeDuration)
{ {
m_iWeek = week; m_iWeek = week;
m_NegativeDuration = bNegativeDuration; m_NegativeDuration = bNegativeDuration;
@ -417,49 +417,49 @@ void Julian_Duration::set(t_int32 week, t_bool bNegativeDuration)
m_iSecond = 0; m_iSecond = 0;
} }
t_int32 Julian_Duration::getYear() const t_int32 nsCalDuration::getYear() const
{ {
if (m_NegativeDuration) if (m_NegativeDuration)
return (0 - m_iYear); return (0 - m_iYear);
return m_iYear; return m_iYear;
} }
t_int32 Julian_Duration::getMonth() const t_int32 nsCalDuration::getMonth() const
{ {
if (m_NegativeDuration) if (m_NegativeDuration)
return (0 - m_iMonth); return (0 - m_iMonth);
return m_iMonth; return m_iMonth;
} }
t_int32 Julian_Duration::getDay() const t_int32 nsCalDuration::getDay() const
{ {
if (m_NegativeDuration) if (m_NegativeDuration)
return (0 - m_iDay); return (0 - m_iDay);
return m_iDay; return m_iDay;
} }
t_int32 Julian_Duration::getHour() const t_int32 nsCalDuration::getHour() const
{ {
if (m_NegativeDuration) if (m_NegativeDuration)
return (0 - m_iHour); return (0 - m_iHour);
return m_iHour; return m_iHour;
} }
t_int32 Julian_Duration::getMinute() const t_int32 nsCalDuration::getMinute() const
{ {
if (m_NegativeDuration) if (m_NegativeDuration)
return (0 - m_iMinute); return (0 - m_iMinute);
return m_iMinute; return m_iMinute;
} }
t_int32 Julian_Duration::getSecond() const t_int32 nsCalDuration::getSecond() const
{ {
if (m_NegativeDuration) if (m_NegativeDuration)
return (0 - m_iSecond); return (0 - m_iSecond);
return m_iSecond; return m_iSecond;
} }
t_int32 Julian_Duration::getWeek() const t_int32 nsCalDuration::getWeek() const
{ {
if (m_NegativeDuration) if (m_NegativeDuration)
return (0 - m_iWeek); return (0 - m_iWeek);
@ -474,7 +474,7 @@ t_int32 Julian_Duration::getWeek() const
//--------------------------------------------------------------------- //---------------------------------------------------------------------
void Julian_Duration::setDurationString(UnicodeString & s) void nsCalDuration::setDurationString(UnicodeString & s)
{ {
parse(s); parse(s);
} }
@ -482,7 +482,7 @@ void Julian_Duration::setDurationString(UnicodeString & s)
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// TODO - will work if only normalize works // TODO - will work if only normalize works
t_int32 Julian_Duration::compareTo(const Julian_Duration & d) t_int32 nsCalDuration::compareTo(const nsCalDuration & d)
{ {
normalize(); normalize();
@ -505,7 +505,7 @@ t_int32 Julian_Duration::compareTo(const Julian_Duration & d)
//--------------------------------------------------------------------- //---------------------------------------------------------------------
void Julian_Duration::normalize() void nsCalDuration::normalize()
{ {
// TODO: RISKY, assumes 30 days in a month, 12 months in a year // TODO: RISKY, assumes 30 days in a month, 12 months in a year
t_int32 temp1 = 0, temp2 = 0, temp3 = 0, temp4 = 0, temp5 = 0; t_int32 temp1 = 0, temp2 = 0, temp3 = 0, temp4 = 0, temp5 = 0;
@ -539,7 +539,7 @@ void Julian_Duration::normalize()
//--------------------------------------------------------------------- //---------------------------------------------------------------------
void Julian_Duration::unnormalize() void nsCalDuration::unnormalize()
{ {
// TODO: watch out for overflow // TODO: watch out for overflow
if (m_iYear > 0) if (m_iYear > 0)
@ -557,7 +557,7 @@ void Julian_Duration::unnormalize()
//--------------------------------------------------------------------- //---------------------------------------------------------------------
t_bool t_bool
Julian_Duration::isZeroLength() nsCalDuration::isZeroLength()
{ {
if (m_iYear <= 0 && m_iMonth <= 0 && m_iDay <= 0 && if (m_iYear <= 0 && m_iMonth <= 0 && m_iDay <= 0 &&
m_iHour <= 0 && m_iMinute <= 0 && m_iSecond <= 0 && m_iHour <= 0 && m_iMinute <= 0 && m_iSecond <= 0 &&
@ -569,7 +569,7 @@ Julian_Duration::isZeroLength()
//--------------------------------------------------------------------- //---------------------------------------------------------------------
UnicodeString Julian_Duration::toString() UnicodeString nsCalDuration::toString()
{ {
char sBuf[100]; char sBuf[100];
char sBuf2[100]; char sBuf2[100];
@ -602,7 +602,7 @@ UnicodeString Julian_Duration::toString()
//--------------------------------------------------------------------- //---------------------------------------------------------------------
UnicodeString Julian_Duration::toICALString() UnicodeString nsCalDuration::toICALString()
{ {
//if (FALSE) TRACE("toString: %d W, %d Y %d M %d D T %d H %d M %d S\r\n", m_iYear, m_iMonth, m_iDay, m_iHour, m_im_iMinute, m_iSecond); //if (FALSE) TRACE("toString: %d W, %d Y %d M %d D T %d H %d M %d S\r\n", m_iYear, m_iMonth, m_iDay, m_iHour, m_im_iMinute, m_iSecond);
@ -625,7 +625,7 @@ UnicodeString Julian_Duration::toICALString()
#if 1 #if 1
// full form // full form
char sNum[100]; char sNum[100];
#if JULIAN_DURATION_PARSING_YEAR_AND_MONTH #if NSCALDURATION_PARSING_YEAR_AND_MONTH
sprintf(sNum, "%sP%dY%dM%dDT%dH%dM%dS", sprintf(sNum, "%sP%dY%dM%dDT%dH%dM%dS",
((m_NegativeDuration) ? "-" : ""), m_iYear, m_iMonth, m_iDay, m_iHour, m_iMinute, m_iSecond); ((m_NegativeDuration) ? "-" : ""), m_iYear, m_iMonth, m_iDay, m_iHour, m_iMinute, m_iSecond);
#else #else
@ -682,7 +682,7 @@ UnicodeString Julian_Duration::toICALString()
//--------------------------------------------------------------------- //---------------------------------------------------------------------
t_bool Julian_Duration::isValid() t_bool nsCalDuration::isValid()
{ {
if (m_iYear < 0 || m_iMonth < 0 || m_iDay < 0 || if (m_iYear < 0 || m_iMonth < 0 || m_iDay < 0 ||
m_iHour < 0 || m_iMinute < 0 || m_iSecond < 0 || m_iHour < 0 || m_iMinute < 0 || m_iSecond < 0 ||
@ -698,7 +698,7 @@ t_bool Julian_Duration::isValid()
//--------------------------------------------------------------------- //---------------------------------------------------------------------
const Julian_Duration & Julian_Duration::operator=(const Julian_Duration& d) const nsCalDuration & nsCalDuration::operator=(const nsCalDuration& d)
{ {
m_iYear = d.m_iYear; m_iYear = d.m_iYear;
m_iMonth = d.m_iMonth; m_iMonth = d.m_iMonth;
@ -714,14 +714,14 @@ const Julian_Duration & Julian_Duration::operator=(const Julian_Duration& d)
//--------------------------------------------------------------------- //---------------------------------------------------------------------
t_bool Julian_Duration::operator==(const Julian_Duration & that) t_bool nsCalDuration::operator==(const nsCalDuration & that)
{ {
return (compareTo(that) == 0); return (compareTo(that) == 0);
} }
//--------------------------------------------------------------------- //---------------------------------------------------------------------
t_bool Julian_Duration::operator!=(const Julian_Duration & that) t_bool nsCalDuration::operator!=(const nsCalDuration & that)
{ {
return (compareTo(that) != 0); return (compareTo(that) != 0);
} }

Просмотреть файл

@ -25,12 +25,12 @@
//--------------------------------------------------------------------- //---------------------------------------------------------------------
JulianUtility::JulianUtility() {} nsCalUtility::nsCalUtility() {}
//--------------------------------------------------------------------- //---------------------------------------------------------------------
//t_int32 JulianUtility::atot_int32(const char * nPtr, //t_int32 nsCalUtility::atot_int32(const char * nPtr,
t_int32 JulianUtility::atot_int32(char * nPtr, t_int32 nsCalUtility::atot_int32(char * nPtr,
t_bool & bParseError, t_bool & bParseError,
t_int32 size) t_int32 size)
{ {
@ -54,7 +54,7 @@ t_int32 JulianUtility::atot_int32(char * nPtr,
} }
//--------------------------------------------------------------------- //---------------------------------------------------------------------
#if 0 #if 0
t_int32 JulianUtility::atot_int32(const char * nPtr, t_int32 nsCalUtility::atot_int32(const char * nPtr,
t_bool & bParseError, t_bool & bParseError,
t_int32 size) t_int32 size)
{ {
@ -74,7 +74,7 @@ t_int32 JulianUtility::atot_int32(const char * nPtr,
} }
#endif #endif
//--------------------------------------------------------------------- //---------------------------------------------------------------------
t_bool JulianUtility::checkRange(t_int32 hashCode, JAtom range[], t_bool nsCalUtility::checkRange(t_int32 hashCode, JAtom range[],
t_int32 rangeSize) t_int32 rangeSize)
{ {
t_int32 i; t_int32 i;
@ -89,7 +89,7 @@ t_bool JulianUtility::checkRange(t_int32 hashCode, JAtom range[],
//--------------------------------------------------------------------- //---------------------------------------------------------------------
void void
JulianUtility::stripDoubleQuotes(UnicodeString & u) nsCalUtility::stripDoubleQuotes(UnicodeString & u)
{ {
if (u.size() > 0) if (u.size() > 0)
{ {
@ -110,7 +110,7 @@ JulianUtility::stripDoubleQuotes(UnicodeString & u)
//--------------------------------------------------------------------- //---------------------------------------------------------------------
UnicodeString & UnicodeString &
JulianUtility::addDoubleQuotes(UnicodeString & us) nsCalUtility::addDoubleQuotes(UnicodeString & us)
{ {
if (us.size() != 0) if (us.size() != 0)
{ {
@ -122,14 +122,14 @@ JulianUtility::addDoubleQuotes(UnicodeString & us)
//--------------------------------------------------------------------- //---------------------------------------------------------------------
/* /*
char * JulianUtility::unistrToStr(const UnicodeString & us) char * nsCalUtility::unistrToStr(const UnicodeString & us)
{ {
return us.toCString(""); return us.toCString("");
} }
*/ */
//--------------------------------------------------------------------- //---------------------------------------------------------------------
/* /*
UnicodeString & JulianUtility::ToUpper(const UnicodeString & eightBitString) UnicodeString & nsCalUtility::ToUpper(const UnicodeString & eightBitString)
{ {
t_int32 i; t_int32 i;
// //
@ -159,7 +159,7 @@ UnicodeString & JulianUtility::ToUpper(const UnicodeString & eightBitString)
//--------------------------------------------------------------------- //---------------------------------------------------------------------
/* /*
void JulianUtility::TRACE_DateTimeVector(JulianPtrArray & vector) void nsCalUtility::TRACE_DateTimeVector(JulianPtrArray & vector)
{ {
for (i = 0; i < vector.GetSize(); i++) for (i = 0; i < vector.GetSize(); i++)
{ {

Просмотреть файл

@ -45,7 +45,7 @@ NS_IMPL_RELEASE(nsDuration)
nsresult nsDuration :: Init() nsresult nsDuration :: Init()
{ {
mDuration = new Julian_Duration(); mDuration = new nsCalDuration();
return NS_OK ; return NS_OK ;
} }
@ -184,7 +184,7 @@ nsresult nsDuration :: SetSecond(PRUint32 aSecond)
return NS_OK; return NS_OK;
} }
Julian_Duration& nsDuration :: GetDuration() nsCalDuration& nsDuration :: GetDuration()
{ {
return (*mDuration); return (*mDuration);
} }

Просмотреть файл

@ -32,20 +32,20 @@
//--------------------------------------------------------------------- //---------------------------------------------------------------------
JulianUIDRandomGenerator::JulianUIDRandomGenerator() nsCalUIDRandomGenerator::nsCalUIDRandomGenerator()
{ {
} }
//--------------------------------------------------------------------- //---------------------------------------------------------------------
JulianUIDRandomGenerator::~JulianUIDRandomGenerator() nsCalUIDRandomGenerator::~nsCalUIDRandomGenerator()
{ {
} }
//--------------------------------------------------------------------- //---------------------------------------------------------------------
UnicodeString UnicodeString
JulianUIDRandomGenerator::generate(UnicodeString us) nsCalUIDRandomGenerator::generate(UnicodeString us)
{ {
#if 0 #if 0
char sBuf[10]; char sBuf[10];
@ -68,7 +68,7 @@ JulianUIDRandomGenerator::generate(UnicodeString us)
//--------------------------------------------------------------------- //---------------------------------------------------------------------
UnicodeString UnicodeString
JulianUIDRandomGenerator::generate() nsCalUIDRandomGenerator::generate()
{ {
return generate(""); return generate("");
} }