#include <Source.h>
Public Methods | |
| Source (DOM_Document doc, const char *creator, const char *creatorCVSID) | |
| ~Source () | |
| void | add (const DOM_Element after=DOM_Element()) |
Private Attributes | |
| DOM_Document | m_doc |
| DOM_Element | m_me |
| std::string | m_creator |
| std::string | m_myCVSID |
Definition at line 16 of file Source.h.
|
||||||||||||||||
|
Definition at line 29 of file Source.cxx. References m_myCVSID, and stripDollar().
00030 : m_doc(doc), m_creator(creator) { 00031 00032 char * tmp = new char[strlen(creatorCVSID) + 1]; 00033 strcpy(tmp, creatorCVSID); 00034 m_myCVSID = std::string(stripDollar(tmp)); 00035 delete [] tmp; 00036 } |
|
|
Definition at line 20 of file Source.h.
00020 {};
|
|
|
Definition at line 38 of file Source.cxx. References m_creator, m_doc, m_myCVSID, and stripDollar(). Referenced by main().
00038 {
00039 static char * unknownId = "unidentified input file";
00040 DOM_Element docElt = m_doc.getDocumentElement();
00041 DOM_Element parent = parentArg;
00042 if (parent == DOM_Element()) {
00043 parent = docElt;
00044 }
00045
00046 DOM_Element source = m_doc.createElement("source");
00047
00048 // Document element should have a CVSid attribute
00049 DOMString idAtt = docElt.getAttribute("CVSid");
00050 char * strippedRaw;
00051 char * myRaw = 0;
00052
00053 if (idAtt != DOMString() ){
00054 const char * raw = xml::Dom::transToChar(idAtt);
00055 unsigned len = strlen(raw);
00056 if (len) {
00057 myRaw = new char[len+1];
00058 strcpy(myRaw, raw);
00059 strippedRaw = stripDollar(myRaw);
00060 }
00061 }
00062 else strippedRaw = unknownId;
00063
00064 DOMString newAtt = DOMString(strippedRaw);
00065
00066 source.setAttribute("inputId", newAtt);
00067
00068 // Already have creator ID as std::string
00069 source.setAttribute(DOMString("creatorId"),
00070 DOMString(m_myCVSID.c_str()));
00071
00072 std::string theText =
00073 std::string("Do not edit! This file automatically created by ");
00074 theText.append(m_creator);
00075 DOM_Text sourceText = m_doc.createTextNode(theText.c_str());
00076
00077
00078 source.appendChild(sourceText);
00079
00080 if (myRaw) delete [] myRaw;
00081 // Finally need to insert this node as the first child of specified elt
00082 parent.insertBefore(source, parent.getFirstChild());
00083 }
|
|
|
Definition at line 27 of file Source.h. Referenced by add(). |
|
|
Definition at line 25 of file Source.h. Referenced by add(). |
|
|
|
|
|
|
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001