/* -*- mode: c++; indent-tabs-mode: nil; -*-
 *
 * Copyright (c) 2000-2003, Roland Jesse
 * All rights reserved.
 *
 * This file is part of the Mango distribution.
 * For license and copyright information see the file COPYRIGHT or 
 * <http://www.opensource.org/licenses/bsd-license.html>.
 *
 * $Id: Ingredient.h,v 1.8 2003/05/11 14:45:02 rjesse Exp $
 */
 
#ifndef INGREDIENT_H
#define INGREDIENT_H

#include <qstring.h>
#include "Measurement.h"

struct IngredientData;

/*
  That's what makes up an ingredient.
 */
class Ingredient {
public:
      Ingredient();
      Ingredient( const Ingredient&);
      ~Ingredient();
      Ingredient& operator=( const Ingredient&);
      void detach();

      //! Add / append everything from another ingredient spec.
      Ingredient& operator+=( const Ingredient&);
      //! Return whether or not both ingredients have identical data set.
      bool operator==( const Ingredient&) const;

      QString name() const;
      QString annotation() const;
      float amountQty() const;
      float amountRange() const;
      Measurement measurement() const;
      bool scalable() const;
      Q_UINT32 gram() const;
      QString bls() const;
      bool doCalc() const;
      float wwPoints() const;
      QString recipeId() const;
      bool doShopping() const;

      void setName( const QString&);
      void setAnnotation( const QString&);
      void setAmountQty( const float);
      void setAmountRange( const float);
      void setMeasurement( const Measurement&);
      void setGram( const Q_UINT32);
      void setBls( const QString&);
      void setCalc( const bool);
      void setWwPoints( const float);
      void setRecipeId( const QString&);
      void setShopping( const bool);

      void clear();
      bool isEmpty() const;

   private:
      IngredientData* d;
};

/*****************************************************************************
  Ingredient stream functions
 *****************************************************************************/
QDataStream& operator<<( QDataStream&, const Ingredient&);
QDataStream& operator>>( QDataStream&, Ingredient&);
QDataStream& operator<<( QDataStream&, const bool&);
QDataStream& operator>>( QDataStream&, bool&);
#endif // INGREDIENT_H
