Marsyas  0.6.0-alpha
/usr/src/RPM/BUILD/marsyas-0.6.0/src/marsyas/marosvg.h
Go to the documentation of this file.
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 #ifndef MARSYAS_OUTPUT_SVG_H
00020 #define MARSYAS_OUTPUT_SVG_H
00021 
00022 #include <string>
00023 #include <vector>
00024 #include <map>
00025 #include <marsyas/marostring.h>
00026 
00027 
00028 namespace Marsyas
00029 {
00037 class marsyas_EXPORT marosvg : public marostring
00038 {
00039 private:
00040   std::map<std::string, std::map<std::string,std::string> > style_;
00041   class Style_
00042   {
00043     Style_();
00044   };
00045   class SVGObj_
00046   {
00047   public:
00048     int x_, y_, w_, h_;
00049     std::string t, n_;
00050     SVGObj_* parent_;
00051     std::vector<SVGObj_*> children_;
00052 
00053     SVGObj_(SVGObj_* p, std::string t, std::string n);
00054     virtual ~SVGObj_();
00055 
00056     void addChild(SVGObj_* c);
00057 
00058     void posAdj(int x, int y);
00059     void sizeAdj();
00060     std::string str();
00061   };
00062   SVGObj_* curr_;
00063 
00064   void output_properties(std::string property);
00065   void load_properties();
00066 
00067 public:
00068   marosvg();
00069   virtual ~marosvg();
00070 
00071   virtual void begin_marsystem(bool isComposite, std::string type, std::string name);
00072   virtual void end_marsystem(bool isComposite, std::string type, std::string name);
00073   virtual void begin_control(std::string type, std::string name, std::string value, bool has_state);
00074   virtual void begin_controls(int num_controls);
00075   virtual void begin_children(int num_children);
00076 
00077   void style(std::string obj, std::string property, std::string value);
00078 
00079   virtual std::string str();
00080   virtual void clear();
00081 };
00082 
00083 }//namespace Marsyas
00084 
00085 #endif