Marsyas
0.6.0-alpha
|
00001 /* 00002 ** Copyright (C) 1998-2005 George Tzanetakis <gtzan@cs.uvic.ca> 00003 ** 00004 ** This program is free software; you can redistribute it and/or modify 00005 ** it under the terms of the GNU General Public License as published by 00006 ** the Free Software Foundation; either version 2 of the License, or 00007 ** (at your option) any later version. 00008 ** 00009 ** This program is distributed in the hope that it will be useful, 00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 ** GNU General Public License for more details. 00013 ** 00014 ** You should have received a copy of the GNU General Public License 00015 ** along with this program; if not, write to the Free Software 00016 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00019 00020 #include <marsyas/maroxml.h> 00021 #include <sstream> 00022 #include <iostream> 00023 00024 using namespace std; 00025 using namespace Marsyas; 00026 00027 maroxml::maroxml() : marostring() 00028 { 00029 } 00030 00031 maroxml::~maroxml() 00032 { 00033 clear(); 00034 } 00035 00036 void 00037 maroxml::begin_marsystem(bool isComposite, std::string type, std::string name) 00038 { 00039 (void) isComposite; 00040 result_ << "<marsystem>" << endl; 00041 result_ << " <type>" << type << "</type>" << endl; 00042 result_ << " <name>" << name << "</name>" << endl; 00043 } 00044 00045 void 00046 maroxml::end_marsystem(bool isComposite, std::string type, std::string name) 00047 { 00048 (void) isComposite; 00049 (void) type; 00050 (void) name; 00051 result_ << "</marsystem>" << endl; 00052 } 00053 00054 void 00055 maroxml::begin_controls(int num_controls) 00056 { 00057 result_ << " <controls count=\"" << num_controls << "\" >" << endl; 00058 } 00059 00060 void 00061 maroxml::begin_control(std::string type, std::string name, std::string value, bool has_state) 00062 { 00063 result_ << " <control>" << endl; 00064 result_ << " <type>" << type << "</type>" << endl; 00065 result_ << " <name>" << name << "</name>" << endl; 00066 result_ << " <value type=\"" << type << "\">" << value << "</value>" << endl; 00067 result_ << " <state>" << has_state << "</state>" << endl; 00068 } 00069 00070 void 00071 maroxml::begin_control_links_in(int num_links) 00072 { 00073 if(num_links>0) 00074 result_ << " <inlinks count=\"" << num_links << "\">" << endl; 00075 } 00076 void 00077 maroxml::put_control_link_in(std::string abspath, std::string type, std::string name) 00078 { 00079 result_ << " <link path=\"" << abspath << "\" type=\"" << type << "\" name=\"" << name << "\" />" << endl; 00080 } 00081 00082 void 00083 maroxml::end_control_links_in(int num_links) 00084 { 00085 if(num_links>0) 00086 result_ << " </inlinks>" << endl; 00087 } 00088 00089 void 00090 maroxml::begin_control_links_out(int num_links) 00091 { 00092 if(num_links>0) 00093 result_ << " <outlinks count=\"" << num_links << "\">" << endl; 00094 } 00095 void 00096 maroxml::put_control_link_out(std::string abspath, std::string type, std::string name) 00097 { 00098 result_ << " <link path=\"" << abspath << "\" type=\"" << type << "\" name=\"" << name << "\" />" << endl; 00099 } 00100 void 00101 maroxml::end_control_links_out(int num_links) 00102 { 00103 if(num_links>0) 00104 result_ << " </outlinks>" << endl; 00105 } 00106 00107 void 00108 maroxml::end_control(std::string type, std::string name, std::string value, bool has_state) 00109 { 00110 (void) type; 00111 (void) name; 00112 (void) value; 00113 (void) has_state; 00114 result_ << " </control>" << endl; 00115 } 00116 00117 void 00118 maroxml::end_controls(int num_controls) 00119 { 00120 (void) num_controls; 00121 result_ << " </controls>" << endl; 00122 } 00123 00124 void 00125 maroxml::begin_children(int num_children) 00126 { 00127 result_ << " <children count=\"" << num_children << "\" >" << endl; 00128 } 00129 00130 void 00131 maroxml::end_children(int num_children) 00132 { 00133 (void) num_children; 00134 result_ << " </children>" << endl; 00135 } 00136