Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

# recipe.h

    00001 /***************************************************************************
    00002  *   Copyright (C) 2005 by Bertrand Haut                                   *
    00003  *   bertrand.haut@gmail.com                                               *
    00004  *                                                                         *
    00005  *   This program is free software; you can redistribute it and/or modify  *
    00006  *   it under the terms of the GNU General Public License as published by  *
    00007  *   the Free Software Foundation; either version 2 of the License, or     *
    00008  *   (at your option) any later version.                                   *
    00009  *                                                                         *
    00010  *   This program is distributed in the hope that it will be useful,       *
    00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
    00013  *   GNU General Public License for more details.                          *
    00014  *                                                                         *
    00015  *   You should have received a copy of the GNU General Public License     *
    00016  *   along with this program; if not, write to the                         *
    00017  *   Free Software Foundation, Inc.,                                       *
    00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
    00019  ***************************************************************************/
    00020 #ifndef RECIPE_H
    00021 #define RECIPE_H
    00022 #include <qvaluevector.h>
    00023 #include <qstringlist.h>
    00024 #include "common.h"
    00025
    00026 // basic Element of a cocktail (a name + a quantity)
    00027 class Element{
    00028 public:
    00029         Element(QString name);
    00030         Element(QString name, double quantity);
    00031         QString getName();
    00032         double getQuantity();
    00033
    00034 protected:
    00035         QString name;
    00037         double quantity;
    00038 };
    00039
    00042 class liquidElement: public Element{
    00043 public:
    00044         liquidElement(QString name):Element(name){};
    00045         liquidElement(QString name, double quantity):Element(name,quantity){};
    00046 };
    00047
    00050 class otherElement: public Element{
    00051 public:
    00052         otherElement(QString name):Element(name){};
    00053         otherElement(QString name, double quantity):Element(name, quantity){};
    00054 };
    00055
    00057
    00068 class recipe{
    00069 public:
    00070         recipe(QString name, bool proportional, int nbrGlasses, QValueVector<liquidElement *> liquidElements, QValueVector<otherElement *> otherElements, QString comment);
    00071
    00072         QString getName();
    00073         QString getComment();
    00074         QString getGlassType();
    00075         bool getProportional();
    00076         int getNbrGlasses();
    00077         QStringList getLiquidElementsNameList();
    00078         QValueVector<liquidElement *> getLiquidElements();
    00079         QValueVector<otherElement *> getOtherElements();
    00080
    00082         QString toString();
    00083         QString toRichTextString(units userUnits);
    00084         ~recipe();
    00085
    00086 private:
    00087         QString name;
    00088         QString comment;
    00089         int nbrGlasses;
    00090         QString glassType;
    00091         bool proportional;
    00092         QValueVector<liquidElement *> liquidElements;
    00093         QValueVector<otherElement *> otherElements;
    00094 };
    00095
    00096 #endif