Changeset 124
- Timestamp:
- 02/23/2006 05:58:10 AM
- Files:
-
- trunk/ssphys/SSPhys/Formatter.cpp (modified) (1 diff)
- trunk/ssphys/SSPhys/ssphys.vcproj (modified) (2 diffs)
- trunk/ssphys/SSPhysLib/SSPhysLib.vcproj (modified) (1 diff)
- trunk/ssphys/SSPhysLib/XML.cpp (added)
- trunk/ssphys/SSPhysLib/XML.h (modified) (4 diffs)
- trunk/ssphys/utils/tinyxml.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ssphys/SSPhys/Formatter.cpp
r123 r124 55 55 { 56 56 TiXmlDeclaration decl ("1.0", "windows-1252", ""); 57 setlocale (LC_ALL, ".1252"); 57 58 m_Document.InsertEndChild (decl); 58 59 } trunk/ssphys/SSPhys/ssphys.vcproj
r110 r124 365 365 Name="VCCustomBuildTool" 366 366 Description="Performing Custom Build Step on ..\$(InputFileName)" 367 CommandLine="SubWCRev .. ..\$(InputFileName) ..\version.h "367 CommandLine="SubWCRev .. ..\$(InputFileName) ..\version.h
" 368 368 Outputs="..\version.h" 369 369 /> … … 375 375 Name="VCCustomBuildTool" 376 376 Description="Performing Custom Build Step on ..\$(InputFileName)" 377 CommandLine="SubWCRev .. ..\$(InputFileName) ..\version.h "377 CommandLine="SubWCRev .. ..\$(InputFileName) ..\version.h
" 378 378 Outputs="..\version.h" 379 379 /> trunk/ssphys/SSPhysLib/SSPhysLib.vcproj
r121 r124 209 209 </FileConfiguration> 210 210 </File> 211 <File 212 RelativePath=".\XML.cpp" 213 > 214 </File> 211 215 </Filter> 212 216 <Filter trunk/ssphys/SSPhysLib/XML.h
r123 r124 21 21 { 22 22 public: 23 XMLNode (XMLNode* pParent, std::string name, AttribMap attrib); 24 23 25 template <class T> 24 26 XMLNode (XMLNode* pParent, std::string name, const T& element) 25 27 : m_Node (name), m_pParent (pParent) 26 28 { 27 TiXmlText text (boost::lexical_cast<std::string>(element)); 28 m_Node.InsertEndChild(text); 29 } 30 31 XMLNode (XMLNode* pParent, std::string name, AttribMap attrib) 32 : m_Node (name), m_pParent (pParent) 33 { 34 AttribMap::iterator itor = attrib.begin (); 35 for (; itor != attrib.end (); ++itor) 36 { 37 m_Node.SetAttribute(itor->first, itor->second); 38 } 29 SetText (boost::lexical_cast<std::string>(element)); 39 30 } 40 31 … … 43 34 : m_Node (name), m_pParent (pParent) 44 35 { 45 AttribMap::iterator itor = attrib.begin (); 46 for (; itor != attrib.end (); ++itor) 47 { 48 m_Node.SetAttribute(itor->first, itor->second); 49 } 50 TiXmlText text (boost::lexical_cast<std::string>(element)); 51 m_Node.InsertEndChild(text); 36 SetAttributes (attrib); 37 SetText (boost::lexical_cast<std::string>(element)); 52 38 } 53 39 54 int AddChild (XMLNode* pChild) 55 { 56 m_Node.InsertEndChild(pChild->m_Node); 57 return 0; 58 } 40 ~XMLNode (); 59 41 42 void AddChild (XMLNode* pChild); 60 43 void AddText (XMLText* pContent); 61 44 62 ~XMLNode () 63 { 64 if (m_pParent) 65 m_pParent->AddChild (this); 66 } 45 void SetAttributes (AttribMap attrib); 46 void SetText (std::string text); 67 47 68 48 public: … … 95 75 : m_Text (""), m_pParent (pParent) 96 76 { 97 m_Text.SetValue (boost::lexical_cast<std::string>(element));77 SetValue (boost::lexical_cast<std::string>(element)); 98 78 } 99 ~XMLText () 100 {101 if (m_pParent) 102 m_pParent->AddText(this);103 } 79 80 ~XMLText (); 81 82 void SetValue (std::string value); 83 104 84 public: 105 85 XMLNode* m_pParent; … … 107 87 }; 108 88 109 110 inline void XMLNode::AddText (XMLText* pContent)111 {112 m_Node.InsertEndChild(pContent->m_Text);113 }114 115 89 #endif // !defined(AFX_XML_H__6602C07F_65ED_4FD7_A730_6D416805378A__INCLUDED_) trunk/ssphys/utils/tinyxml.cpp
r121 r124 96 96 outString->append( entity[4].str, entity[4].strLength ); 97 97 ++i; 98 } 99 else if ( c < 32 ) 98 } 99 else if ( c == 0x0d && ( (int)str.length() - 1 ) 100 && str[i+1] == 0x0a) 101 { 102 // insert \n 103 *outString += '\n'; 104 ++i; 105 ++i; 106 } 107 else if (isspace (c)) 108 { 109 // pass through unchagend 110 *outString += (char) c; // somewhat more efficient function call. 111 ++i; 112 } 113 else if (iscntrl (c)) // ( c < 32) 100 114 { 101 115 // Easy pass at non-alpha/numeric/symbol … … 114 128 ++i; 115 129 } 116 else 130 else if (isprint (c)) 117 131 { 118 132 //char realc = (char) c;
