зеркало из https://github.com/mozilla/pjs.git
Initial nlsstub implementation to remove libnls dependency
for free source execution
This commit is contained in:
Родитель
5875cb774f
Коммит
b74f00e23b
|
@ -97,7 +97,7 @@ CPPSRCS=attendee.cpp bydmgntr.cpp bydwgntr.cpp \
|
|||
tmbevent.cpp tzpart.cpp unistrto.cpp uri.cpp valarm.cpp \
|
||||
vevent.cpp vfrbsy.cpp \
|
||||
vjournal.cpp vtimezne.cpp vtodo.cpp
|
||||
REQUIRES=julian nls nspr
|
||||
REQUIRES=julian nls nspr raptor
|
||||
CPP_OBJS=.\$(OBJDIR)\attendee.obj \
|
||||
.\$(OBJDIR)\bydmgntr.obj \
|
||||
.\$(OBJDIR)\bydwgntr.obj .\$(OBJDIR)\bydygntr.obj \
|
||||
|
@ -122,7 +122,7 @@ CPP_OBJS=.\$(OBJDIR)\attendee.obj \
|
|||
.\$(OBJDIR)\valarm.obj .\$(OBJDIR)\vevent.obj .\$(OBJDIR)\vfrbsy.obj \
|
||||
.\$(OBJDIR)\vjournal.obj .\$(OBJDIR)\vtimezne.obj \
|
||||
.\$(OBJDIR)\vtodo.obj
|
||||
LINCS=-I$(XPDIST)\public\julian -I$(XPDIST)\public\nls \
|
||||
LINCS=-I$(XPDIST)\public\julian -I$(XPDIST)\public\nls -I$(XPDIST)\public\raptor -I$(XPDIST)\public\xpcom \
|
||||
-I$(XPDIST)\public\nspr
|
||||
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "stdafx.h"
|
||||
#include "uri.h"
|
||||
#include "nspr.h"
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
|
@ -70,9 +71,9 @@ UnicodeString URI::getName()
|
|||
t_bool URI::IsValidURI(UnicodeString & s)
|
||||
{
|
||||
if (s.indexOf(':') > 0)
|
||||
return TRUE;
|
||||
return PR_TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
|
|
@ -56,7 +56,7 @@ CPP_OBJS=.\$(OBJDIR)\jatom.obj .\$(OBJDIR)\jlog.obj \
|
|||
.\$(OBJDIR)\jlogerr.obj .\$(OBJDIR)\jlogvctr.obj \
|
||||
.\$(OBJDIR)\julnstr.obj \
|
||||
.\$(OBJDIR)\ptrarray.obj .\$(OBJDIR)\uidrgntr.obj
|
||||
LINCS=-I$(XPDIST)\public\julian -I$(XPDIST)\public\nls \
|
||||
LINCS=-I$(XPDIST)\public\julian -I$(XPDIST)\public\nls -I$(XPDIST)\public\xpcom -I$(XPDIST)\public\raptor \
|
||||
-I$(XPDIST)\public\java -I$(XPDIST)\public\security
|
||||
|
||||
include <$(NS_DEPTH)/config/rules.mak>
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
#ifndef calendar_h__
|
||||
#define calendar_h__
|
||||
|
||||
#include "ptypes.h"
|
||||
#include "parsepos.h"
|
||||
|
||||
class TimeZone;
|
||||
class ParsePosition;
|
||||
|
||||
class Calendar
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
enum EMonths {
|
||||
JANUARY,
|
||||
FEBRUARY,
|
||||
MARCH,
|
||||
APRIL,
|
||||
MAY,
|
||||
JUNE,
|
||||
JULY,
|
||||
AUGUST,
|
||||
SEPTEMBER,
|
||||
OCTOBER,
|
||||
NOVEMBER,
|
||||
DECEMBER,
|
||||
UNDECIMBER
|
||||
};
|
||||
|
||||
enum EDateFields
|
||||
{
|
||||
SECOND,
|
||||
DAY_OF_WEEK_IN_MONTH,
|
||||
MINUTE,
|
||||
HOUR,
|
||||
DAY_OF_YEAR,
|
||||
WEEK_OF_YEAR,
|
||||
MONTH,
|
||||
DATE,
|
||||
DAY_OF_WEEK,
|
||||
DAY_OF_MONTH,
|
||||
HOUR_OF_DAY,
|
||||
YEAR
|
||||
};
|
||||
|
||||
enum EDaysOfWeek
|
||||
{
|
||||
SUNDAY = 1,
|
||||
MONDAY,
|
||||
TUESDAY,
|
||||
WEDNESDAY,
|
||||
THURSDAY,
|
||||
FRIDAY,
|
||||
SATURDAY
|
||||
};
|
||||
|
||||
public:
|
||||
Calendar();
|
||||
~Calendar();
|
||||
|
||||
static Date getNow();
|
||||
void setTimeZone(const TimeZone& aZone);
|
||||
Date getTime(ErrorCode& aStatus) const;
|
||||
PRInt32 get(EDateFields aField, ErrorCode& aStatus) const;
|
||||
void setTime(Date aDate, ErrorCode& aStatus);
|
||||
void set(EDateFields aField, PRInt32 aValue);
|
||||
void set(PRInt32 aYear, PRInt32 aMonth, PRInt32 aDate);
|
||||
void set(PRInt32 aYear, PRInt32 aMonth, PRInt32 aDate, PRInt32 aHour, PRInt32 aMinute);
|
||||
void set(PRInt32 aYear, PRInt32 aMonth, PRInt32 aDate, PRInt32 aHour, PRInt32 aMinute, PRInt32 aSecond);
|
||||
virtual void add(EDateFields aField, PRInt32 aAmount, ErrorCode& aStatus) = 0;
|
||||
|
||||
void clear();
|
||||
void clear(EDateFields aField);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef datefmt_h__
|
||||
#define datefmt_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "unistring.h"
|
||||
|
||||
class ParsePosition;
|
||||
class Format;
|
||||
|
||||
class DateFormat
|
||||
{
|
||||
|
||||
public:
|
||||
DateFormat();
|
||||
~DateFormat();
|
||||
|
||||
virtual void setLenient(PRBool aLenient);
|
||||
virtual void setTimeZone(const TimeZone& aZone);
|
||||
virtual Date parse(const UnicodeString& aUnicodeString, ErrorCode& aStatus) const;
|
||||
virtual Date parse(const UnicodeString& aUnicodeString, ParsePosition& aPosition) const = 0;
|
||||
|
||||
virtual PRBool operator==(const Format&) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,34 @@
|
|||
#ifndef gregocal_h__
|
||||
#define gregocal_h__
|
||||
|
||||
#include "ptypes.h"
|
||||
#include "calendar.h"
|
||||
|
||||
class TimeZone;
|
||||
class Locale;
|
||||
|
||||
class GregorianCalendar : public Calendar
|
||||
{
|
||||
|
||||
public:
|
||||
GregorianCalendar();
|
||||
~GregorianCalendar();
|
||||
|
||||
GregorianCalendar(ErrorCode& aSuccess);
|
||||
GregorianCalendar(TimeZone* aZoneToAdopt, ErrorCode& aSuccess);
|
||||
GregorianCalendar(const TimeZone& aZone, ErrorCode& aSuccess);
|
||||
GregorianCalendar(const Locale& aLocale, ErrorCode& aSuccess);
|
||||
GregorianCalendar(TimeZone* aZoneToAdopt, const Locale& aLocale, ErrorCode& aSuccess);
|
||||
GregorianCalendar(const TimeZone& aZone, const Locale& aLocale, ErrorCode& aSuccess);
|
||||
GregorianCalendar(PRInt32 aYear, PRInt32 aMonth, PRInt32 aDate, ErrorCode& aSuccess);
|
||||
GregorianCalendar(PRInt32 aYear, PRInt32 aMonth, PRInt32 aDate, PRInt32 aHour, PRInt32 aMinute, ErrorCode& aSuccess);
|
||||
GregorianCalendar(PRInt32 aYear, PRInt32 aMonth, PRInt32 aDate, PRInt32 aHour, PRInt32 aMinute, PRInt32 aSecond, ErrorCode& aSuccess);
|
||||
|
||||
virtual void add(EDateFields aField, PRInt32 aAmount, ErrorCode& aStatus);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef hashtab_h__
|
||||
#define hashtab_h__
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef locid_h__
|
||||
#define locid_h__
|
||||
|
||||
#include "ptypes.h"
|
||||
|
||||
class UnicodeString;
|
||||
|
||||
class Locale
|
||||
{
|
||||
|
||||
public:
|
||||
Locale();
|
||||
~Locale();
|
||||
|
||||
static const Locale& getDefault();
|
||||
UnicodeString& getName(UnicodeString& aName) const;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,32 @@
|
|||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Makefile to build the Julian tree
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify the NS_DEPTH of the current directory relative to the
|
||||
#// root of NS
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
NS_DEPTH=..\..\..\..\..\
|
||||
|
||||
DEPTH = $(NS_DEPTH)
|
||||
|
||||
MODULE = nls
|
||||
|
||||
LCFLAGS= -DMOZ_TREX -DLIBJULIAN $(LCFLAGS)
|
||||
CFLAGS= -DMOZ_TREX $(CFLAGS)
|
||||
|
||||
EXPORTS = unistring.h calendar.h ptypes.h locid.h hashtab.h timezone.h smpdtfmt.h gregocal.h datefmt.h simpletz.h parsepos.h unicode.h
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Include the common makefile rules
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
include <$(NS_DEPTH)/config/config.mak>
|
||||
include <$(NS_DEPTH)/config/rules.mak>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef parsepos_h__
|
||||
#define parsepos_h__
|
||||
|
||||
class ParsePosition
|
||||
{
|
||||
|
||||
public:
|
||||
ParsePosition();
|
||||
~ParsePosition();
|
||||
|
||||
ParsePosition(TextOffset aIndex);
|
||||
ParsePosition(const ParsePosition& aParsePosition);
|
||||
|
||||
PRBool operator==(const ParsePosition& aParsePosition) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef ptypes_h__
|
||||
#define ptypes_h__
|
||||
|
||||
typedef double Date;
|
||||
|
||||
#define ZERO_ERROR 0
|
||||
|
||||
typedef PRInt32 ErrorCode;
|
||||
typedef PRInt8 t_int8;
|
||||
typedef PRInt32 t_int32;
|
||||
typedef PRBool t_bool;
|
||||
typedef PRInt32 TextOffset;
|
||||
|
||||
#define NS_NLS NS_BASE
|
||||
|
||||
#define SUCCESS(x) ((x)<=ZERO_ERROR)
|
||||
#define FAILURE(x) ((x)>ZERO_ERROR)
|
||||
|
||||
#define kMillisPerSecond (PR_INT32(1000))
|
||||
#define kMillisPerMinute (PR_INT32(60) * kMillisPerSecond)
|
||||
#define kMillisPerHour (PR_INT32(60) * kMillisPerMinute)
|
||||
#define kMillisPerDay (PR_INT32(24) * kMillisPerHour)
|
||||
|
||||
#endif
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef simpletz_h__
|
||||
#define simpletz_h__
|
||||
|
||||
#include "timezone.h"
|
||||
|
||||
class SimpleTimeZone : public TimeZone
|
||||
{
|
||||
|
||||
public:
|
||||
SimpleTimeZone();
|
||||
~SimpleTimeZone();
|
||||
SimpleTimeZone(PRInt32 aRawOffset, const UnicodeString& aID);
|
||||
|
||||
SimpleTimeZone(PRInt32 aRawOffset, const UnicodeString& aID,
|
||||
PRInt8 aStartMonth, PRInt8 aStartDayOfWeekInMonth,
|
||||
PRInt8 aStartDayOfWeek, PRInt32 aStartTime,
|
||||
PRInt8 aEndMonth, PRInt8 aEndDayOfWeekInMonth,
|
||||
PRInt8 aEndDayOfWeek, PRInt32 aEndTime,
|
||||
PRInt32 aDstSavings = kMillisPerHour);
|
||||
|
||||
virtual TimeZone* clone() const;
|
||||
virtual void setRawOffset(PRInt32 aOffsetMillis);
|
||||
void setStartRule(PRInt32 aMonth, PRInt32 aDayOfWeekInMonth, PRInt32 aDayOfWeek, PRInt32 aTime);
|
||||
void setEndRule(PRInt32 aMonth, PRInt32 aDayOfWeekInMonth, PRInt32 aDayOfWeek, PRInt32 aTime);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef smpdtfmt_h__
|
||||
#define smpdtfmt_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "datefmt.h"
|
||||
|
||||
class UnicodeString;
|
||||
class Formattable;
|
||||
class ParsePosition;
|
||||
class Format;
|
||||
|
||||
class FieldPosition
|
||||
{
|
||||
public:
|
||||
FieldPosition();
|
||||
~FieldPosition();
|
||||
FieldPosition(PRInt32 aField);
|
||||
};
|
||||
|
||||
class SimpleDateFormat : public DateFormat
|
||||
{
|
||||
public:
|
||||
SimpleDateFormat();
|
||||
~SimpleDateFormat();
|
||||
SimpleDateFormat(ErrorCode& aStatus);
|
||||
|
||||
SimpleDateFormat(const UnicodeString& aPattern, const Locale& aLocale, ErrorCode& aStatus);
|
||||
|
||||
virtual UnicodeString& format(Date aDate, UnicodeString& aAppendTo, FieldPosition& aPosition) const;
|
||||
virtual UnicodeString& format(const Formattable& aObject, UnicodeString& aAppendTo, FieldPosition& aPosition, ErrorCode& aStatus) const;
|
||||
virtual void applyLocalizedPattern(const UnicodeString& aPattern, ErrorCode& aStatus);
|
||||
virtual Date parse(const UnicodeString& aUnicodeString, ParsePosition& aPosition) const;
|
||||
|
||||
virtual PRBool operator==(const Format& other) const;
|
||||
|
||||
};
|
||||
#endif
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef timezone_h__
|
||||
#define timezone_h__
|
||||
|
||||
#include "ptypes.h"
|
||||
|
||||
class TimeZone
|
||||
{
|
||||
|
||||
public:
|
||||
TimeZone();
|
||||
~TimeZone();
|
||||
|
||||
static TimeZone* createDefault();
|
||||
static TimeZone* createTimeZone(const UnicodeString& aID);
|
||||
void setID(const UnicodeString& aID);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef unicode_h__
|
||||
#define unicode_h__
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,78 @@
|
|||
#ifndef unistring_h__
|
||||
#define unistring_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsString.h"
|
||||
#include "nspr.h"
|
||||
#include "limits.h"
|
||||
|
||||
#include "ptypes.h"
|
||||
|
||||
class Locale;
|
||||
|
||||
class NS_NLS UnicodeString
|
||||
{
|
||||
|
||||
public:
|
||||
UnicodeString();
|
||||
~UnicodeString();
|
||||
|
||||
UnicodeString(const UnicodeString& aUnicodeString);
|
||||
UnicodeString(const char * aString);
|
||||
|
||||
PRUint32 size() { return mLength; }
|
||||
PRInt32 hashCode() const;
|
||||
|
||||
TextOffset indexOf(const UnicodeString& aUnicodeString, TextOffset aFromOffset = 0, PRUint32 aForLength = -1) const;
|
||||
TextOffset indexOf(PRUnichar aUnichar, TextOffset aFromOffset = 0, PRUint32 aForLength = -1) const;
|
||||
|
||||
UnicodeString& extractBetween(TextOffset aStart, TextOffset aLimit, UnicodeString& aExtractInto) const;
|
||||
|
||||
PRInt32 compareIgnoreCase(const UnicodeString& aUnicodeString) const;
|
||||
PRInt32 compareIgnoreCase(const PRUnichar* aUnichar, PRInt32 aLength) const;
|
||||
PRInt32 compareIgnoreCase(const PRUnichar* aUnichar) const;
|
||||
PRInt32 compareIgnoreCase(const char* aChar, const char* aEncoding) const;
|
||||
PRInt32 compareIgnoreCase(const char* aChar) const;
|
||||
UnicodeString& toUpper();
|
||||
UnicodeString& toUpper(const Locale& aLocale);
|
||||
|
||||
char* toCString(const char* aEncoding) const;
|
||||
|
||||
UnicodeString& trim(UnicodeString& aUnicodeString) const;
|
||||
void trim();
|
||||
UnicodeString& remove();
|
||||
UnicodeString& remove(TextOffset aOffset,PRInt32 aLength = LONG_MAX);
|
||||
UnicodeString& insert(TextOffset aThisOffset, const UnicodeString& aUnicodeString);
|
||||
PRBool startsWith(const UnicodeString& aUnicodeString) const;
|
||||
PRBool endsWith(const UnicodeString& aUnicodeString) const;
|
||||
UnicodeString& removeBetween(TextOffset aStart = 0, TextOffset aLimit = LONG_MAX);
|
||||
|
||||
|
||||
PRInt8 compare(const UnicodeString& aUnicodeString) const;
|
||||
PRInt8 compare(TextOffset aOffset, PRInt32 aThisLength, const UnicodeString& aUnicodeString, TextOffset aStringOffset, PRInt32 aLength) const;
|
||||
PRInt8 compare(const PRUnichar* aUnichar) const;
|
||||
PRInt8 compare(const PRUnichar* aUnichar, PRInt32 aLength) const;
|
||||
PRInt8 compare(const char* aChar) const;
|
||||
|
||||
UnicodeString& extract(TextOffset aOffset,PRInt32 aLength, UnicodeString& aExtractInto) const;
|
||||
void extract(TextOffset aOffset, PRInt32 aLength, PRUnichar*aExtractInto) const;
|
||||
void extract(TextOffset aOffset, PRInt32 aLength, char* aExtractInto) const;
|
||||
|
||||
|
||||
public:
|
||||
PRUnichar operator[](TextOffset aOffset) const;
|
||||
PRUnichar& operator[](TextOffset aOffset);
|
||||
UnicodeString& operator+=(const UnicodeString& aUnicodeString);
|
||||
UnicodeString& operator+=(PRUnichar aUnichar);
|
||||
PRBool operator==(const UnicodeString& aUnicodeString) const;
|
||||
PRBool operator!=(const UnicodeString& aUnicodeString) const;
|
||||
UnicodeString& operator=(const UnicodeString& aUnicodeString);
|
||||
|
||||
public:
|
||||
PRUint32 mLength;
|
||||
|
||||
private:
|
||||
nsString mString;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,26 @@
|
|||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Makefile to build the Julian tree
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify the NS_DEPTH of the current directory relative to the
|
||||
#// root of NS
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
NS_DEPTH=..\..\..\..\
|
||||
|
||||
DIRS=inc src
|
||||
|
||||
DEPTH = $(NS_DEPTH)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Include the common makefile rules
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
include <$(NS_DEPTH)/config/rules.mak>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Makefile to build the Julian tree
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify the NS_DEPTH of the current directory relative to the
|
||||
#// root of NS
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
NS_DEPTH=..\..\..\..\..\
|
||||
|
||||
DEPTH = $(NS_DEPTH)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Include the common makefile rules
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
include <$(NS_DEPTH)/config/rules.mak>
|
||||
|
Загрузка…
Ссылка в новой задаче