/* -*- mode: c++; indent-tabs-mode: nil; -*-
 *
 * This file is part of the Mango recipe management distribution.
 * Copyright (c) 2000-2003, Roland Jesse
 * All rights reserved.
 *
 * For license and copyright information see the file COPYRIGHT or 
 * <http://www.opensource.org/licenses/bsd-license.html>.
 *
 * $Id: CMLExporter.h,v 1.1 2003/05/25 19:15:06 rjesse Exp $
 */
 
#ifndef CML_EXPORTER_H
#define CML_EXPORTER_H

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

/*!
  Class for writing CookML documents.
  Uses the DOM classes to build an internal tree representation which is
  than materialised into a valid CookML document.
*/
class CMLExporter : public Exporter {
      Q_OBJECT

   public:
      CMLExporter( RecipeModel*);
      CMLExporter( const Recipe&);
      virtual ~CMLExporter();

      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&);

      QDomDocument* m_doc;      //!< The cookbook to be exported.
      QDomElement* m_rootElement; //!< The root (cookml) element of the document.
};
#endif // 
