#ifndef H_CORAL_IO_IO_XMI_COMMON
#define H_CORAL_IO_IO_XMI_COMMON
// This file is part of the Coral project.
// Please read the copyright notice in the LICENSE file.

#include <string>
#include <coral/core/Element.h>
#include "io.h"
#include <map>

#ifdef SWIG
#error SWIG should not include coral/core/io/xmi_writer_common.h
#endif

namespace coral { namespace io {
	  std::string escape(const std::string& to_escape);
	  std::string qescape(const std::string& to_escape);
	  void writeField(std::ostream& out,
			  const coral::ElementPrimitive* e,
			  int margin);

	  class XMIStreamerCommon : public ModelStreamer {
	  private:
		  typedef std::map<const coral::Element*, int> e2id_type;
		  e2id_type e2id;
		  int id_ctr;
	  protected:
		  std::string getID(const coral::Element*);
	  public:
		  virtual ~XMIStreamerCommon() throw ();
		  XMIStreamerCommon();
		  virtual void saveModel(const coral::Collection*,
					 std::ostream& out = std::cout) = 0;
	  };
} }


#endif
