Google
Web alhem.net
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

Xml.cpp

Go to the documentation of this file.
00001 00006 /* 00007 Copyright (C) 2004 Anders Hedstrom 00008 00009 This program is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License 00011 as published by the Free Software Foundation; either version 2 00012 of the License, or (at your option) any later version. 00013 00014 This program is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 */ 00023 #include <stdio.h> 00024 #include <SDL.h> 00025 #ifdef WIN32 00026 #define STL_USING_ALL 00027 #include "stlhelper.h" 00028 #else 00029 #include <string> 00030 #endif 00031 00032 #include "Xml.h" 00033 00034 00035 namespace util 00036 { 00037 00038 00039 Xml::Xml(FILE *f) 00040 :m_fil(f) 00041 { 00042 } 00043 00044 00045 Xml::~Xml() 00046 { 00047 } 00048 00049 00050 void Xml::Write(const char *s,bool b) 00051 { 00052 fprintf(m_fil,"<%s>%s</%s>\n",s,b ? "true" : "false",s); 00053 } 00054 00055 00056 void Xml::Write(const char *s,char c) 00057 { 00058 fprintf(m_fil,"<%s>%c</%s>\n",s,c,s); 00059 } 00060 00061 00062 void Xml::Write(const char *s,long l) 00063 { 00064 fprintf(m_fil,"<%s>%ld</%s>\n",s,l,s); 00065 } 00066 00067 00068 void Xml::Write(const char *s,SDL_Color &color) 00069 { 00070 fprintf(m_fil,"<%s>\n",s); 00071 fprintf(m_fil,"<R>%d</R>\n",color.r); 00072 fprintf(m_fil,"<G>%d</G>\n",color.g); 00073 fprintf(m_fil,"<B>%d</B>\n",color.b); 00074 fprintf(m_fil,"<A>%d</A>\n",color.unused); 00075 fprintf(m_fil,"</%s>\n",s); 00076 } 00077 00078 00079 void Xml::Write(const char *s,std::string &str) 00080 { 00081 fprintf(m_fil,"<%s>%s</%s>\n",s,str.c_str(),s); 00082 } 00083 00084 00085 } // namespace util 00086 00087

Generated for My SDL C++ Gui by doxygen 1.3.6

www.TV-friendship.com
The matchmaking service with an all new twist.

Quantum 'Teleportation'
Some thoughts
Page, code, and content Copyright (C) 2004 by Anders Hedström