/* -*- mode: c++; indent-tabs-mode: nil; -*-
 *
 * This file is part of the Mango recipe management distribution.
 * Copyright (c) 2001-2002, Roland Jesse
 * All rights reserved.
 *
 * For license and copyright information see the file COPYRIGHT or 
 * <http://www.opensource.org/licenses/bsd-license.html>.
 *
 * $Id: RecipeMLExporter.h,v 1.8 2003/01/05 16:35:24 rjesse Exp $
 */
 
#ifndef RECIPEML_EXPORTER_H
#define RECIPEML_EXPORTER_H

#include "Exporter.h"
#include <qdom.h>

/*!
  Class for writing RecipeML.

  \sa http://www.formatdata.com/recipeml/
*/
class RecipeMLExporter : public Exporter {
      Q_OBJECT
      
   public:
      RecipeMLExporter( RecipeModel*); //!< Constructor.
      RecipeMLExporter( const Recipe&); //!< Constructor.
	  virtual ~RecipeMLExporter(); //!< Destructor.

      QString getExtensions();
	  virtual void apply() throw( Error);

   protected:
	  virtual void createCookbookHeader();
      virtual void createRecipes();
	  virtual void createRecipeHeader();
      virtual void createRecipeBody();

   private:
      void buildXMLTree() throw( Error);
      void cookbook2XML();
      void recipe2XML();
      QDomElement createTextElement( const QString&, const QString&);
      
      /*! The cookbook to be saved. */
      QDomDocument* m_doc;
      /*! The root (recipeml) element of the document. */
      QDomElement* m_rootElement;
};
#endif // RECIPEML_EXPORTER_H
