[xiph-commits] r8315 - in trunk/oggdsf/src:
lib/codecs/cmml/libCMMLTags tests/testCMMLParser
illiminable at motherfish-iii.xiph.org
illiminable at motherfish-iii.xiph.org
Tue Nov 30 07:53:29 PST 2004
Author: illiminable
Date: 2004-11-30 07:53:29 -0800 (Tue, 30 Nov 2004)
New Revision: 8315
Modified:
trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_AnchorTag.cpp
trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLRootTag.cpp
trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ClipTag.cpp
trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_DescTag.cpp
trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_HeadTag.cpp
trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_HumReadCMMLTag.cpp
trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_HumReadCMMLTag.h
trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ImageTag.cpp
trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ImageTag.h
trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ImportTag.cpp
trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_MetaTag.cpp
trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ParamTag.cpp
trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_TitleTag.cpp
trunk/oggdsf/src/tests/testCMMLParser/testCMMLParser.cpp
Log:
* Stringified CMML tag objects now appropriately show all fields.
Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_AnchorTag.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_AnchorTag.cpp 2004-11-30 15:35:50 UTC (rev 8314)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_AnchorTag.cpp 2004-11-30 15:53:29 UTC (rev 8315)
@@ -74,7 +74,7 @@
//Other
wstring C_AnchorTag::toString() {
- //TO DO:::
+
wstring retStr = L"<a";
//Put in the id element if there is one
@@ -82,6 +82,8 @@
retStr += makeElement(L"id", mId);
}
+ retStr += makeLangElements();
+
if (mCls.size() != 0) {
retStr += makeElement(L"class", mCls);
}
Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLRootTag.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLRootTag.cpp 2004-11-30 15:35:50 UTC (rev 8314)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLRootTag.cpp 2004-11-30 15:53:29 UTC (rev 8315)
@@ -103,13 +103,7 @@
retStr += makeElement(L"id", mId);
}
- if (mLang.size() != 0) {
- retStr += makeElement(L"lang", mLang);
- //Assuming that if lang is set then so is dirn.
- //Also lets dirn default to "ltr" and still not be displayed
- //unless the language is defined
- retStr += makeElement(L"dir", mDirn);
- }
+ retStr += makeLangElements();
retStr += L">\n";
Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ClipTag.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ClipTag.cpp 2004-11-30 15:35:50 UTC (rev 8314)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ClipTag.cpp 2004-11-30 15:53:29 UTC (rev 8315)
@@ -135,6 +135,8 @@
retStr += makeElement(L"id", mId);
}
+ retStr += makeLangElements();
+
//track Element
if (mTrack != L"") {
retStr += makeElement(L"track", mTrack);
Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_DescTag.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_DescTag.cpp 2004-11-30 15:35:50 UTC (rev 8314)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_DescTag.cpp 2004-11-30 15:53:29 UTC (rev 8315)
@@ -51,6 +51,9 @@
if (mId.size() != 0) {
retStr += makeElement(L"id", mId);
}
+
+ retStr += makeLangElements();
+
retStr += L">";
retStr += mText;
retStr += L"</desc>\n";
Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_HeadTag.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_HeadTag.cpp 2004-11-30 15:35:50 UTC (rev 8314)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_HeadTag.cpp 2004-11-30 15:53:29 UTC (rev 8315)
@@ -108,6 +108,8 @@
retStr += L"\"";
}
+ retStr += makeLangElements();
+
if (mProfile.size() != 0) {
retStr += L" profile=\"";
retStr += mProfile;
Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_HumReadCMMLTag.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_HumReadCMMLTag.cpp 2004-11-30 15:35:50 UTC (rev 8314)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_HumReadCMMLTag.cpp 2004-11-30 15:53:29 UTC (rev 8315)
@@ -64,4 +64,18 @@
C_HumReadCMMLTag* locTag = reinterpret_cast<C_HumReadCMMLTag*>(outTag);
locTag->setLang(mLang);
locTag->setDirn(mDirn);
+}
+
+wstring C_HumReadCMMLTag::makeLangElements() {
+ wstring retStr = L"";
+
+ if (mLang.size() != 0) {
+ retStr += makeElement(L"lang", mLang);
+ }
+
+ if (mDirn.size() != 0) {
+ retStr += makeElement(L"dir", mDirn);
+ }
+
+ return retStr;
}
\ No newline at end of file
Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_HumReadCMMLTag.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_HumReadCMMLTag.h 2004-11-30 15:35:50 UTC (rev 8314)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_HumReadCMMLTag.h 2004-11-30 15:53:29 UTC (rev 8315)
@@ -67,4 +67,6 @@
//Protected Helper Methods
virtual void privateClone(C_CMMLTag* outTag);
+ virtual wstring makeLangElements();
+
};
Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ImageTag.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ImageTag.cpp 2004-11-30 15:35:50 UTC (rev 8314)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ImageTag.cpp 2004-11-30 15:53:29 UTC (rev 8315)
@@ -82,6 +82,9 @@
if (mId.size() != 0) {
retStr += makeElement(L"id", mId);
}
+
+ retStr += makeLangElements();
+
retStr += makeElement(L"src", mSrc);
if (mAlt.size() != 0) {
Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ImageTag.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ImageTag.h 2004-11-30 15:35:50 UTC (rev 8314)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ImageTag.h 2004-11-30 15:53:29 UTC (rev 8315)
@@ -69,4 +69,6 @@
//Protected Helper Methods
virtual void privateClone(C_CMMLTag* outTag);
+
+
};
Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ImportTag.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ImportTag.cpp 2004-11-30 15:35:50 UTC (rev 8314)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ImportTag.cpp 2004-11-30 15:53:29 UTC (rev 8315)
@@ -81,7 +81,11 @@
mSrc = inSrc;
}
void C_ImportTag::setStart(wstring inStart) {
- mStart = inStart;
+ if (inStart != L"") {
+ mStart = inStart;
+ } else {
+ mStart = L"0";
+ }
}
void C_ImportTag::setEnd(wstring inEnd) {
mEnd = inEnd;
@@ -127,6 +131,8 @@
retStr += makeElement(L"id", mId);
}
+ retStr += makeLangElements();
+
if (mGranuleRate.size() != 0) {
retStr += makeElement(L"granulerate", mGranuleRate);
}
Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_MetaTag.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_MetaTag.cpp 2004-11-30 15:35:50 UTC (rev 8314)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_MetaTag.cpp 2004-11-30 15:53:29 UTC (rev 8315)
@@ -74,11 +74,19 @@
wstring C_MetaTag::toString() {
//QUERY ::: How are the internationalisation tags included
wstring retStr = L"<meta";
- retStr += L" name=\"";
- retStr += mName;
- retStr += L"\" content=\"";
- retStr += mContent;
- retStr += L"\"";
+
+ if (mId.size() != 0) {
+ retStr += makeElement(L"id", mId);
+ }
+
+ retStr += makeLangElements();
+ retStr += makeElement(L"name", mName);
+ retStr += makeElement(L"content", mContent);
+
+ if (mScheme != L"") {
+ retStr += makeElement(L"scheme", mScheme);
+ }
+
retStr += L"/>\n";
Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ParamTag.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ParamTag.cpp 2004-11-30 15:35:50 UTC (rev 8314)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_ParamTag.cpp 2004-11-30 15:53:29 UTC (rev 8315)
@@ -45,6 +45,11 @@
wstring C_ParamTag::toString() {
wstring retStr;
retStr = L"<param";
+ if (mId.size() != 0) {
+ retStr += makeElement(L"id", mId);
+ }
+
+ retStr += makeLangElements();
retStr += makeElement(L"name", mName);
retStr += makeElement(L"value", mContent);
retStr += L"/>\n";
Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_TitleTag.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_TitleTag.cpp 2004-11-30 15:35:50 UTC (rev 8314)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_TitleTag.cpp 2004-11-30 15:53:29 UTC (rev 8315)
@@ -46,6 +46,12 @@
wstring C_TitleTag::toString() {
//FIX ::: Make this do something
wstring retStr = L"<title";
+
+ if (mId.size() != 0) {
+ retStr += makeElement(L"id", mId);
+ }
+
+ retStr += makeLangElements();
retStr += L">";
retStr += mText;
retStr+= L"</title>\n";
Modified: trunk/oggdsf/src/tests/testCMMLParser/testCMMLParser.cpp
===================================================================
--- trunk/oggdsf/src/tests/testCMMLParser/testCMMLParser.cpp 2004-11-30 15:35:50 UTC (rev 8314)
+++ trunk/oggdsf/src/tests/testCMMLParser/testCMMLParser.cpp 2004-11-30 15:53:29 UTC (rev 8315)
@@ -29,16 +29,29 @@
int __cdecl _tmain(int argc, _TCHAR* argv[])
{
-
+ //Valid minimal
wstring head_1 = L"<head><title>Types of fish</title><meta name=\"Producer\" content=\"Joe Ordinary\"/><meta name=\"DC.Author\" content=\"Joe's friend\"/></head>";
testHeadParse(head_1);
+ //INVALID: Random data
wstring head_2 = L"asdfasdfasdfasdf";
testHeadParse(head_2);
+ //INVALID: Valid xml, invalid cmml
wstring head_3 = L"<blue><red>random stuff</red><green>But still valid XML</green></blue>";
testHeadParse(head_3);
+ //INVALID: No title tag
+ wstring head_4 = L"<head><meta name=\"Producer\" content=\"Joe Ordinary\"/><meta name=\"DC.Author\" content=\"Joe's friend\"/></head>";
+ testHeadParse(head_4);
+
+ //Valid use most
+ wstring head_5 = L"<head id=\"headID\" lang=\"en\" dir=\"ltr\" profile=\"some profile\"><base href=\"http://baseurl.com\"/><title lang=\"fr\">Types of fish</title><meta name=\"Producer\" content=\"Joe Ordinary\" scheme=\"some scheme\"/><meta name=\"DC.Author\" content=\"Joe's friend\"/></head>";
+ testHeadParse(head_5);
+
+ //INVALID: Missing closing xml tag on option element.
+ wstring head_6 = L"<head id=\"headID\" lang=\"en\" dir=\"ltr\" profile=\"some profile\"><base href=\"http://baseurl.com\"/><title lang=\"fr\">Types of fish</title><meta name=\"Producer\" content=\"Joe Ordinary\" scheme=\"some scheme\"/><meta name=\"DC.Author\" content=\"Joe's friend\"></head>";
+ testHeadParse(head_6);
return 0;
}
More information about the commits
mailing list