зеркало из https://github.com/mozilla/gecko-dev.git
End Token created now.
Forgot to add dtstamp tag. Now added.
This commit is contained in:
Родитель
cc0e47a8da
Коммит
c0b58c647f
|
@ -31,6 +31,7 @@
|
|||
#include "nscalicalendarpars.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsDeque.h"
|
||||
#include "nsCalICalendarParserNode.h"
|
||||
//#include "nsCalICalendarParserCIID.h"
|
||||
//#include "nsCalICalendarStrings.h" // todo:
|
||||
|
||||
|
@ -111,8 +112,8 @@ private:
|
|||
//NS_IMETHOD_(eCalICalendarTags) ComponentTypeFromObject(const nsIParserNode& aNode);
|
||||
|
||||
protected:
|
||||
PRInt32 CollectPropertyValue(nsCParserNode& aNode, PRInt32 aCount);
|
||||
PRInt32 CollectAttributes(nsCParserNode& aNode, PRInt32 aCount);
|
||||
PRInt32 CollectPropertyValue(nsCalICalendarCParserNode& aNode, PRInt32 aCount);
|
||||
PRInt32 CollectAttributes(nsCalICalendarCParserNode& aNode, PRInt32 aCount);
|
||||
|
||||
nsParser* mParser;
|
||||
nsIContentSink* mSink;
|
||||
|
|
|
@ -33,35 +33,35 @@ enum nsCalICalendarTag {
|
|||
eCalICalendarTag_completed=9, eCalICalendarTag_contact=10,
|
||||
eCalICalendarTag_created=11, eCalICalendarTag_daylight=12,
|
||||
eCalICalendarTag_description=13, eCalICalendarTag_dtend=14,
|
||||
eCalICalendarTag_dtstart=15, eCalICalendarTag_due=16,
|
||||
eCalICalendarTag_duration=17, eCalICalendarTag_end=18,
|
||||
eCalICalendarTag_exdate=19, eCalICalendarTag_exrule=20,
|
||||
eCalICalendarTag_freebusy=21, eCalICalendarTag_geo=22,
|
||||
eCalICalendarTag_last_modified=23, eCalICalendarTag_location=24,
|
||||
eCalICalendarTag_method=25, eCalICalendarTag_organizer=26,
|
||||
eCalICalendarTag_percent_complete=27, eCalICalendarTag_priority=28,
|
||||
eCalICalendarTag_prodid=29, eCalICalendarTag_rdate=30,
|
||||
eCalICalendarTag_recurrence_id=31, eCalICalendarTag_related_to=32,
|
||||
eCalICalendarTag_repeat=33, eCalICalendarTag_request_status=34,
|
||||
eCalICalendarTag_resources=35, eCalICalendarTag_rrule=36,
|
||||
eCalICalendarTag_sequence=37, eCalICalendarTag_standard=38,
|
||||
eCalICalendarTag_status=39, eCalICalendarTag_summary=40,
|
||||
eCalICalendarTag_transp=41, eCalICalendarTag_trigger=42,
|
||||
eCalICalendarTag_tzid=43, eCalICalendarTag_tzname=44,
|
||||
eCalICalendarTag_tzoffsetfrom=45, eCalICalendarTag_tzoffsetto=46,
|
||||
eCalICalendarTag_tzurl=47, eCalICalendarTag_uid=48,
|
||||
eCalICalendarTag_url=49, eCalICalendarTag_valarm=50,
|
||||
eCalICalendarTag_vcalendar=51, eCalICalendarTag_version=52,
|
||||
eCalICalendarTag_vevent=53, eCalICalendarTag_vfreebusy=54,
|
||||
eCalICalendarTag_vjournal=55, eCalICalendarTag_vtimezone=56,
|
||||
eCalICalendarTag_vtodo=57,
|
||||
eCalICalendarTag_dtstamp=15, eCalICalendarTag_dtstart=16,
|
||||
eCalICalendarTag_due=17, eCalICalendarTag_duration=18,
|
||||
eCalICalendarTag_end=19, eCalICalendarTag_exdate=20,
|
||||
eCalICalendarTag_exrule=21, eCalICalendarTag_freebusy=22,
|
||||
eCalICalendarTag_geo=23, eCalICalendarTag_last_modified=24,
|
||||
eCalICalendarTag_location=25, eCalICalendarTag_method=26,
|
||||
eCalICalendarTag_organizer=27, eCalICalendarTag_percent_complete=28,
|
||||
eCalICalendarTag_priority=29, eCalICalendarTag_prodid=30,
|
||||
eCalICalendarTag_rdate=31, eCalICalendarTag_recurrence_id=32,
|
||||
eCalICalendarTag_related_to=33, eCalICalendarTag_repeat=34,
|
||||
eCalICalendarTag_request_status=35, eCalICalendarTag_resources=36,
|
||||
eCalICalendarTag_rrule=37, eCalICalendarTag_sequence=38,
|
||||
eCalICalendarTag_standard=39, eCalICalendarTag_status=40,
|
||||
eCalICalendarTag_summary=41, eCalICalendarTag_transp=42,
|
||||
eCalICalendarTag_trigger=43, eCalICalendarTag_tzid=44,
|
||||
eCalICalendarTag_tzname=45, eCalICalendarTag_tzoffsetfrom=46,
|
||||
eCalICalendarTag_tzoffsetto=47, eCalICalendarTag_tzurl=48,
|
||||
eCalICalendarTag_uid=49, eCalICalendarTag_url=50,
|
||||
eCalICalendarTag_valarm=51, eCalICalendarTag_vcalendar=52,
|
||||
eCalICalendarTag_version=53, eCalICalendarTag_vevent=54,
|
||||
eCalICalendarTag_vfreebusy=55, eCalICalendarTag_vjournal=56,
|
||||
eCalICalendarTag_vtimezone=57, eCalICalendarTag_vtodo=58,
|
||||
|
||||
/* The remaining enums are not for tags */
|
||||
eCalICalendarTag_text=58, eCalICalendarTag_whitespace=59,
|
||||
eCalICalendarTag_newline=60, eCalICalendarTag_entity=61,
|
||||
eCalICalendarTag_userdefined=62
|
||||
eCalICalendarTag_text=59, eCalICalendarTag_whitespace=60,
|
||||
eCalICalendarTag_newline=61, eCalICalendarTag_entity=62,
|
||||
eCalICalendarTag_userdefined=63
|
||||
};
|
||||
#define NS_CALICALENDAR_TAG_MAX 57
|
||||
#define NS_CALICALENDAR_TAG_MAX 58
|
||||
|
||||
extern NS_CALICALENDARPARS nsCalICalendarTag NS_CalICalendarTagToEnum(const char* aTag);
|
||||
extern NS_CALICALENDARPARS const char* NS_CalICalendarEnumToTag(nsCalICalendarTag aEnum);
|
||||
|
|
|
@ -89,7 +89,7 @@ class CCalICalendarBeginToken: public CCalICalendarToken {
|
|||
public:
|
||||
|
||||
CCalICalendarBeginToken(eCalICalendarTags aTag);
|
||||
CCalICalendarBeginToken(nsString& aName, eCalICalendarTags aTag=eCalICalendarTag_unknown);
|
||||
CCalICalendarBeginToken(const nsString& aName, eCalICalendarTags aTag=eCalICalendarTag_unknown);
|
||||
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
|
||||
virtual PRInt32 GetTypeID(void);
|
||||
virtual const char* GetClassName(void);
|
||||
|
@ -110,7 +110,7 @@ protected:
|
|||
class CCalICalendarEndToken: public CCalICalendarToken {
|
||||
public:
|
||||
CCalICalendarEndToken(eCalICalendarTags aTag);
|
||||
CCalICalendarEndToken(const nsString& aString);
|
||||
CCalICalendarEndToken(const nsString& aString, eCalICalendarTags aTag=eCalICalendarTag_unknown);
|
||||
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
|
||||
virtual PRInt32 GetTypeID(void);
|
||||
virtual const char* GetClassName(void);
|
||||
|
|
|
@ -117,11 +117,11 @@ NS_IMETHODIMP nsCalICalendarContentSink::OpenContainer(const nsIParserNode& aNod
|
|||
|
||||
NS_IMETHODIMP nsCalICalendarContentSink::CloseContainer(const nsIParserNode& aNode)
|
||||
{
|
||||
nsISupports * container = (nsISupports *)mXPFCStack->Pop();
|
||||
//nsISupports * container = (nsISupports *)mXPFCStack->Pop();
|
||||
|
||||
// todo: finish
|
||||
|
||||
NS_IF_RELEASE(container);
|
||||
//NS_IF_RELEASE(container);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID);
|
|||
static NS_DEFINE_IID(kClassIID, NS_ICALICALENDAR_DTD_IID);
|
||||
static NS_DEFINE_IID(kBaseClassIID, NS_ICALICALENDAR_DTD_IID);
|
||||
|
||||
static NS_DEFINE_IID(kCParserNodeCID, NS_PARSER_NODE_IID);
|
||||
static NS_DEFINE_IID(kCalICalendarCParserNodeCID, NS_CALICALENDARPARSER_NODE_IID);
|
||||
static NS_DEFINE_IID(kCParserNodeIID, NS_IPARSER_NODE_IID);
|
||||
|
||||
static const char* kNullToken = "Error: Null token given";
|
||||
|
@ -199,8 +199,8 @@ CToken * nsCalTokenRecycler::CreateTokenOfType(eCalICalendarTokenTypes aType,
|
|||
else {
|
||||
switch(aType) {
|
||||
//todo: finish
|
||||
case eCalICalendarToken_begin: result=new CCalICalendarBeginToken(aTag); break;
|
||||
case eCalICalendarToken_end: result=new CCalICalendarEndToken(aTag); break;
|
||||
case eCalICalendarToken_begin: result=new CCalICalendarBeginToken(aString, aTag); break;
|
||||
case eCalICalendarToken_end: result=new CCalICalendarEndToken(aString, aTag); break;
|
||||
case eCalICalendarToken_propertyname: result=new CCalICalendarIdentifierToken(aTag); break;
|
||||
case eCalICalendarToken_attribute: result=new CCalICalendarAttributeToken(); break;
|
||||
case eCalICalendarToken_propertyvalue: result=new CCalICalendarPropertyValueToken(); break;
|
||||
|
@ -338,13 +338,13 @@ nsresult nsCalICalendarDTD::HandleBeginToken(CToken* aToken)
|
|||
{
|
||||
CCalICalendarBeginToken * st = (CCalICalendarBeginToken*)aToken;
|
||||
eCalICalendarTags tokenTagType = (eCalICalendarTags) st->GetTypeID();
|
||||
nsCParserNode * attrNode = nsnull;
|
||||
nsCalICalendarCParserNode * attrNode = nsnull;
|
||||
|
||||
//Begin by gathering up attributes...
|
||||
static NS_DEFINE_IID(kCParserNodeCID, NS_PARSER_NODE_IID);
|
||||
static NS_DEFINE_IID(kCalICalendarCParserNodeCID, NS_CALICALENDARPARSER_NODE_IID);
|
||||
static NS_DEFINE_IID(kCParserNodeIID, NS_IPARSER_NODE_IID);
|
||||
|
||||
nsresult result = nsRepository::CreateInstance(kCParserNodeCID, nsnull, kCParserNodeIID,(void**) &attrNode);
|
||||
nsresult result = nsRepository::CreateInstance(kCalICalendarCParserNodeCID, nsnull, kCParserNodeIID,(void**) &attrNode);
|
||||
|
||||
if (NS_OK != result)
|
||||
return result;
|
||||
|
@ -372,7 +372,9 @@ nsresult nsCalICalendarDTD::HandleBeginToken(CToken* aToken)
|
|||
case eCalICalendarTag_valarm:
|
||||
case eCalICalendarTag_vtimezone:
|
||||
{
|
||||
mSink->OpenContainer(*attrNode);
|
||||
// todo: xxx: close any already open containers;
|
||||
if (eCalICalendarTag_begin == aToken->GetTypeID())
|
||||
mSink->OpenContainer(*attrNode);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -389,6 +391,7 @@ nsresult nsCalICalendarDTD::HandleBeginToken(CToken* aToken)
|
|||
case eCalICalendarTag_description:
|
||||
case eCalICalendarTag_dtend:
|
||||
case eCalICalendarTag_dtstart:
|
||||
case eCalICalendarTag_dtstamp:
|
||||
case eCalICalendarTag_due:
|
||||
case eCalICalendarTag_duration:
|
||||
case eCalICalendarTag_exdate:
|
||||
|
@ -446,21 +449,21 @@ nsresult nsCalICalendarDTD::HandleBeginToken(CToken* aToken)
|
|||
return result;
|
||||
}
|
||||
|
||||
PRInt32 nsCalICalendarDTD::CollectPropertyValue(nsCParserNode& aNode,PRInt32 aCount) {
|
||||
PRInt32 nsCalICalendarDTD::CollectPropertyValue(nsCalICalendarCParserNode& aNode,PRInt32 aCount) {
|
||||
|
||||
CToken* theToken=mParser->PeekToken();
|
||||
if(theToken) {
|
||||
eCalICalendarTokenTypes theType=eCalICalendarTokenTypes(theToken->GetTokenType());
|
||||
if(eCalICalendarToken_propertyvalue==theType){
|
||||
mParser->PopToken(); //pop it for real...
|
||||
aNode.SetSkippedContent(theToken);
|
||||
aNode.SetSkippedContent((CCalICalendarToken*)theToken);
|
||||
}
|
||||
else return kInterrupted;
|
||||
}
|
||||
return kNoError;
|
||||
}
|
||||
|
||||
PRInt32 nsCalICalendarDTD::CollectAttributes(nsCParserNode& aNode,PRInt32 aCount) {
|
||||
PRInt32 nsCalICalendarDTD::CollectAttributes(nsCalICalendarCParserNode& aNode,PRInt32 aCount) {
|
||||
int attr=0;
|
||||
for(attr=0;attr<aCount;attr++){
|
||||
CToken* theToken=mParser->PeekToken();
|
||||
|
@ -468,7 +471,7 @@ PRInt32 nsCalICalendarDTD::CollectAttributes(nsCParserNode& aNode,PRInt32 aCount
|
|||
eCalICalendarTokenTypes theType=eCalICalendarTokenTypes(theToken->GetTokenType());
|
||||
if(eCalICalendarToken_attribute==theType){
|
||||
mParser->PopToken(); //pop it for real...
|
||||
aNode.AddAttribute(theToken);
|
||||
aNode.AddAttribute((CCalICalendarToken*)theToken);
|
||||
}
|
||||
}
|
||||
else return kInterrupted;
|
||||
|
@ -483,10 +486,10 @@ nsresult nsCalICalendarDTD::HandleEndToken(CToken* aToken)
|
|||
eCalICalendarTags tokenTagType=(eCalICalendarTags)et->GetTypeID();
|
||||
nsCParserNode * attrNode = nsnull;
|
||||
|
||||
static NS_DEFINE_IID(kCParserNodeCID, NS_PARSER_NODE_IID);
|
||||
static NS_DEFINE_IID(kCalICalendarCParserNodeCID, NS_CALICALENDARPARSER_NODE_IID);
|
||||
static NS_DEFINE_IID(kCParserNodeIID, NS_IPARSER_NODE_IID);
|
||||
|
||||
result = nsRepository::CreateInstance(kCParserNodeCID, nsnull, kCParserNodeIID, (void**)&attrNode);
|
||||
result = nsRepository::CreateInstance(kCalICalendarCParserNodeCID, nsnull, kCParserNodeIID, (void**)&attrNode);
|
||||
|
||||
if (NS_OK != result)
|
||||
return result;
|
||||
|
@ -775,6 +778,15 @@ nsCalICalendarDTD::ConsumePropertyNameAndAttributes(PRUnichar aChar, CScanner& a
|
|||
}
|
||||
} //if
|
||||
} //if
|
||||
if (eCalICalendarTag_end == aToken->GetTypeID())
|
||||
{
|
||||
nsString endval = aToken->GetStringValueXXX();
|
||||
delete aToken;
|
||||
aToken = 0;
|
||||
//
|
||||
aToken=gCalTokenRecycler.CreateTokenOfType(eCalICalendarToken_end,
|
||||
eCalICalendarTag_end, endval);
|
||||
}
|
||||
}// if (eCalICalendar_begin ...)
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -24,13 +24,14 @@
|
|||
static char* tagTable[] = {
|
||||
"ACTION", "ATTACH", "ATTENDEE", "BEGIN", "CALSCALE", "CATEGORIES", "CLASS",
|
||||
"COMMENT", "COMPLETED", "CONTACT", "CREATED", "DAYLIGHT", "DESCRIPTION",
|
||||
"DTEND", "DTSTART", "DUE", "DURATION", "END", "EXDATE", "EXRULE",
|
||||
"FREEBUSY", "GEO", "LAST-MODIFIED", "LOCATION", "METHOD", "ORGANIZER",
|
||||
"PERCENT-COMPLETE", "PRIORITY", "PRODID", "RDATE", "RECURRENCE-ID",
|
||||
"RELATED-TO", "REPEAT", "REQUEST-STATUS", "RESOURCES", "RRULE", "SEQUENCE",
|
||||
"STANDARD", "STATUS", "SUMMARY", "TRANSP", "TRIGGER", "TZID", "TZNAME",
|
||||
"TZOFFSETFROM", "TZOFFSETTO", "TZURL", "UID", "URL", "VALARM", "VCALENDAR",
|
||||
"VERSION", "VEVENT", "VFREEBUSY", "VJOURNAL", "VTIMEZONE", "VTODO"
|
||||
"DTEND", "DTSTAMP", "DTSTART", "DUE", "DURATION", "END", "EXDATE",
|
||||
"EXRULE", "FREEBUSY", "GEO", "LAST-MODIFIED", "LOCATION", "METHOD",
|
||||
"ORGANIZER", "PERCENT-COMPLETE", "PRIORITY", "PRODID", "RDATE",
|
||||
"RECURRENCE-ID", "RELATED-TO", "REPEAT", "REQUEST-STATUS", "RESOURCES",
|
||||
"RRULE", "SEQUENCE", "STANDARD", "STATUS", "SUMMARY", "TRANSP", "TRIGGER",
|
||||
"TZID", "TZNAME", "TZOFFSETFROM", "TZOFFSETTO", "TZURL", "UID", "URL",
|
||||
"VALARM", "VCALENDAR", "VERSION", "VEVENT", "VFREEBUSY", "VJOURNAL",
|
||||
"VTIMEZONE", "VTODO"
|
||||
};
|
||||
|
||||
nsCalICalendarTag NS_CalICalendarTagToEnum(const char* aTag) {
|
||||
|
|
|
@ -193,7 +193,7 @@ CCalICalendarBeginToken::CCalICalendarBeginToken(eCalICalendarTags aTag) :
|
|||
mEmpty=PR_FALSE;
|
||||
}
|
||||
|
||||
CCalICalendarBeginToken::CCalICalendarBeginToken(nsString& aString,
|
||||
CCalICalendarBeginToken::CCalICalendarBeginToken(const nsString& aString,
|
||||
eCalICalendarTags aTag) :
|
||||
CCalICalendarToken(aString,aTag) {
|
||||
mAttributed=PR_FALSE;
|
||||
|
@ -302,10 +302,12 @@ void CCalICalendarBeginToken::DebugDumpSource(ostream& out) {
|
|||
out << "\r\n";
|
||||
}
|
||||
|
||||
CCalICalendarEndToken::CCalICalendarEndToken(eCalICalendarTags aTag) : CCalICalendarToken(aTag) {
|
||||
CCalICalendarEndToken::CCalICalendarEndToken(eCalICalendarTags aTag)
|
||||
: CCalICalendarToken(aTag) {
|
||||
}
|
||||
|
||||
CCalICalendarEndToken::CCalICalendarEndToken(const nsString& aName) : CCalICalendarToken(aName) {
|
||||
CCalICalendarEndToken::CCalICalendarEndToken(const nsString& aName, eCalICalendarTags aTag)
|
||||
: CCalICalendarToken(aName, aTag) {
|
||||
}
|
||||
|
||||
// todo: revisit
|
||||
|
|
|
@ -38,6 +38,7 @@ $tags[$i++] = "daylight";
|
|||
$tags[$i++] = "description";
|
||||
$tags[$i++] = "dtend";
|
||||
$tags[$i++] = "dtstart";
|
||||
$tags[$i++] = "dtstamp";
|
||||
$tags[$i++] = "due";
|
||||
$tags[$i++] = "duration";
|
||||
$tags[$i++] = "end";
|
||||
|
|
Загрузка…
Ссылка в новой задаче