00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "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 result_ << "<marsystem>" << endl;
00040 result_ << " <type>" << type << "</type>" << endl;
00041 result_ << " <name>" << name << "</name>" << endl;
00042 }
00043
00044 void
00045 maroxml::end_marsystem(bool isComposite, std::string type, std::string name)
00046 {
00047 result_ << "</marsystem>" << endl;
00048 }
00049
00050 void
00051 maroxml::begin_controls(int num_controls)
00052 {
00053 result_ << " <controls count=\"" << num_controls << "\" >" << endl;
00054 }
00055
00056 void
00057 maroxml::begin_control(std::string type, std::string name, std::string value, bool has_state)
00058 {
00059 result_ << " <control>" << endl;
00060 result_ << " <type>" << type << "</type>" << endl;
00061 result_ << " <name>" << name << "</name>" << endl;
00062 result_ << " <value type=\"" << type << "\">" << value << "</value>" << endl;
00063 result_ << " <state>" << has_state << "</state>" << endl;
00064 }
00065
00066 void
00067 maroxml::begin_control_links_in(int num_links)
00068 {
00069 if(num_links>0)
00070 result_ << " <inlinks count=\"" << num_links << "\">" << endl;
00071 }
00072 void
00073 maroxml::put_control_link_in(std::string abspath, std::string type, std::string name)
00074 {
00075 result_ << " <link path=\"" << abspath << "\" type=\"" << type << "\" name=\"" << name << "\" />" << endl;
00076 }
00077
00078 void
00079 maroxml::end_control_links_in(int num_links)
00080 {
00081 if(num_links>0)
00082 result_ << " </inlinks>" << endl;
00083 }
00084
00085 void
00086 maroxml::begin_control_links_out(int num_links)
00087 {
00088 if(num_links>0)
00089 result_ << " <outlinks count=\"" << num_links << "\">" << endl;
00090 }
00091 void
00092 maroxml::put_control_link_out(std::string abspath, std::string type, std::string name)
00093 {
00094 result_ << " <link path=\"" << abspath << "\" type=\"" << type << "\" name=\"" << name << "\" />" << endl;
00095 }
00096 void
00097 maroxml::end_control_links_out(int num_links)
00098 {
00099 if(num_links>0)
00100 result_ << " </outlinks>" << endl;
00101 }
00102
00103 void
00104 maroxml::end_control(std::string type, std::string name, std::string value, bool has_state)
00105 {
00106 result_ << " </control>" << endl;
00107 }
00108
00109 void
00110 maroxml::end_controls(int num_controls)
00111 {
00112 result_ << " </controls>" << endl;
00113 }
00114
00115 void
00116 maroxml::begin_children(int num_children)
00117 {
00118 result_ << " <children count=\"" << num_children << "\" >" << endl;
00119 }
00120
00121 void
00122 maroxml::end_children(int num_children)
00123 {
00124 result_ << " </children>" << endl;
00125 }
00126