Marsyas  0.5.0-beta1
/Users/jleben/code/marsyas/src/marsyas/marojson.h
Go to the documentation of this file.
00001 /*
00002 ** Copyright (C) 1998-2005 George Tzanetakis <gtzan@cs.uvic.ca>
00003 ** 2010 Paul Reimer <pdreimer@engr.uvic.ca>
00004 **
00005 ** This program is free software; you can redistribute it and/or modify
00006 ** it under the terms of the GNU General Public License as published by
00007 ** the Free Software Foundation; either version 2 of the License, or
00008 ** (at your option) any later version.
00009 **
00010 ** This program is distributed in the hope that it will be useful,
00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 ** GNU General Public License for more details.
00014 **
00015 ** You should have received a copy of the GNU General Public License
00016 ** along with this program; if not, write to the Free Software
00017 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef MARSYAS_OUTPUT_JSON_H
00021 #define MARSYAS_OUTPUT_JSON_H
00022 
00023 #include <string>
00024 #include <vector>
00025 #include <marsyas/marostring.h>
00026 
00027 
00028 namespace Marsyas
00029 {
00037 class marsyas_EXPORT marojson : public marostring
00038 {
00039 private:
00040 
00041 public:
00042   marojson();
00043   virtual ~marojson();
00044 
00045   virtual void begin_marsystem(bool isComposite, std::string type, std::string name);
00046   virtual void end_marsystem(bool isComposite, std::string type, std::string name);
00047 
00048   virtual void begin_controls(int num_controls);
00049   virtual void begin_control(std::string type, std::string name, std::string value, bool has_state);
00050   virtual void begin_control_links_in(int num_links);
00051   virtual void put_control_link_in(std::string abspath, std::string type, std::string name);
00052   virtual void end_control_links_in(int num_links);
00053   virtual void begin_control_links_out(int num_links);
00054   virtual void put_control_link_out(std::string abspath, std::string type, std::string name);
00055   virtual void end_control_links_out(int num_links);
00056   virtual void end_control(std::string type, std::string name, std::string value, bool has_state);
00057   virtual void end_controls(int num_controls);
00058 
00059   virtual void begin_children(int num_children);
00060   virtual void end_children(int num_children);
00061 
00062   virtual std::string str();
00063 
00064   bool prettyPrint;
00065   std::string& smart_indent(std::string& str,
00066                             const std::string& start, const std::string& end);
00067 
00068   std::string& replace_between(std::string& str,
00069                                const std::string &oldsubstr, const std::string &newsubstr,
00070                                std::string::size_type from_pos, std::string::size_type to_pos);
00071 
00072   std::string& replace_all(std::string& str,
00073                            const std::string& oldsubstr, const std::string& newsubstr);
00074 };
00075 
00076 }//namespace Marsyas
00077 
00078 #endif