00001 /* 00002 Copyright (C) 2003, 2004 Zentaro Kavanagh 00003 00004 Copyright (C) 2003, 2004 Commonwealth Scientific and Industrial Research 00005 Organisation (CSIRO) Australia 00006 00007 Redistribution and use in source and binary forms, with or without 00008 modification, are permitted provided that the following conditions 00009 are met: 00010 00011 - Redistributions of source code must retain the above copyright 00012 notice, this list of conditions and the following disclaimer. 00013 00014 - Redistributions in binary form must reproduce the above copyright 00015 notice, this list of conditions and the following disclaimer in the 00016 documentation and/or other materials provided with the distribution. 00017 00018 - Neither the name of CSIRO Australia nor the names of its 00019 contributors may be used to endorse or promote products derived from 00020 this software without specific prior written permission. 00021 00022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00025 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR 00026 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00027 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00028 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00029 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00030 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00031 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00032 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 */ 00034 #include "stdafx.h" 00035 #include <libCMMLTags/C_ImportTag.h> 00036 00037 C_ImportTag::C_ImportTag(void) 00038 { 00039 mTagType = C_CMMLTag::IMPORT; 00040 mStart = L"0"; 00041 mParamList = new C_ParamTagList; 00042 } 00043 00044 C_ImportTag::~C_ImportTag(void) 00045 { 00046 delete mParamList; 00047 } 00048 00049 00050 //Accessors 00051 wstring C_ImportTag::granuleRate() { 00052 return mGranuleRate; 00053 } 00054 wstring C_ImportTag::contentType() { 00055 return mContentType; 00056 } 00057 wstring C_ImportTag::src() { 00058 return mSrc; 00059 } 00060 wstring C_ImportTag::start() { 00061 return mStart; 00062 } 00063 wstring C_ImportTag::end() { 00064 return mEnd; 00065 } 00066 wstring C_ImportTag::title() { 00067 return mTitle; 00068 } 00069 C_ParamTagList* C_ImportTag::paramList() { 00070 return mParamList; 00071 } 00072 00073 //Mutators 00074 void C_ImportTag::setGranuleRate(wstring inGranuleRate) { 00075 mGranuleRate = inGranuleRate; 00076 } 00077 void C_ImportTag::setContentType(wstring inContentType) { 00078 mContentType = inContentType; 00079 } 00080 void C_ImportTag::setSrc(wstring inSrc) { 00081 mSrc = inSrc; 00082 } 00083 void C_ImportTag::setStart(wstring inStart) { 00084 if (inStart != L"") { 00085 mStart = inStart; 00086 } else { 00087 mStart = L"0"; 00088 } 00089 } 00090 void C_ImportTag::setEnd(wstring inEnd) { 00091 mEnd = inEnd; 00092 } 00093 void C_ImportTag::setTitle(wstring inTitle) { 00094 mTitle = inTitle; 00095 } 00096 void C_ImportTag::setParamList(C_ParamTagList* inParamList) { 00097 delete mParamList; 00098 mParamList = inParamList; 00099 } 00100 00101 //Other 00102 00103 void C_ImportTag::privateClone(C_CMMLTag* outTag) { 00104 00105 C_HumReadCMMLTag::privateClone(outTag); 00106 C_ImportTag* locTag = reinterpret_cast<C_ImportTag*>(outTag); 00107 locTag->setGranuleRate(mGranuleRate); 00108 locTag->setContentType(mContentType); 00109 locTag->setSrc(mSrc ); 00110 locTag->setStart(mStart); 00111 locTag->setEnd(mEnd); 00112 locTag->setTitle(mTitle); 00113 locTag->setParamList(mParamList->clone()); 00114 } 00115 C_ImportTag* C_ImportTag::clone() { 00116 C_ImportTag* retTag = new C_ImportTag; 00117 privateClone(retTag); 00118 return retTag; 00119 00120 } 00121 00122 C_CMMLTag* C_ImportTag::genericClone() { 00123 return clone(); 00124 } 00125 wstring C_ImportTag::toString() { 00126 00127 wstring retStr; 00128 retStr = L"<import"; 00129 00130 if (mId.size() != 0) { 00131 retStr += makeAttribute(L"id", mId); 00132 } 00133 00134 retStr += makeLangElements(); 00135 00136 if (mGranuleRate.size() != 0) { 00137 retStr += makeAttribute(L"granulerate", mGranuleRate); 00138 } 00139 00140 if (mContentType.size() != 0) { 00141 retStr += makeAttribute(L"contenttype", mContentType); 00142 } 00143 00144 retStr += makeAttribute(L"src", mSrc); 00145 retStr += makeAttribute(L"start", mStart); 00146 if (mEnd.size() != 0) { 00147 retStr += makeAttribute(L"end", mEnd); 00148 } 00149 00150 if (mTitle.size() != 0) { 00151 retStr += makeAttribute(L"title", mTitle); 00152 } 00153 00154 retStr += L">\n"; 00155 00156 retStr += mParamList->toString(); 00157 00158 retStr += L"</import>\n"; 00159 return retStr; 00160 00161 } 00162 00163