[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenonbeta/krecipes/src/DBBackend
From:       Jason Kivlighn <confederacy2 () excite ! com>
Date:       2004-02-09 5:44:54
Message-ID: 20040209054454.C7DFA990A () office ! kde ! org
[Download RAW message or body]

CVS commit by jkivlighn: 

Don't use these two static variables


  M +5 -9      recipedb.cpp   1.10


--- kdenonbeta/krecipes/src/DBBackend/recipedb.cpp  #1.9:1.10
@@ -44,11 +44,7 @@ void RecipeDB::loadRecipes( RecipeList *
 void getIngredientNameAndID( std::multimap<int,QString> * );
 int createUnit(const QString &name, RecipeDB*);
-int createIngredient(const QString &name, RecipeDB*);
+int createIngredient(const QString &name, int unit_g_id, int unit_mg_id, RecipeDB*);
 void create_properties( RecipeDB* );
 
-//store these two lone units for speed
-static int unit_g_id;
-static int unit_mg_id;
-
 void RecipeDB::importUSDADatabase()
 {
@@ -101,6 +97,6 @@ void RecipeDB::importUSDADatabase()
 
         //since there are only two units used, lets just create them and store their \
                id for speed
-        unit_g_id = createUnit("g",this);
-        unit_mg_id = createUnit("mg",this);
+        int unit_g_id = createUnit("g",this);
+        int unit_mg_id = createUnit("mg",this);
 
         QValueList<ingredient_nutrient_data>::iterator it; const int total = \
data->count(); int counter = 0; @@ -110,5 +106,5 @@ void \
                RecipeDB::importUSDADatabase()
                 kdDebug()<<"Inserting ("<<counter<<" of "<<total<<"): \
"<<(*it).name<<endl;  
-                int assigned_id = createIngredient((*it).name,this);
+                int assigned_id = \
createIngredient((*it).name,unit_g_id,unit_mg_id,this);  
                 //for now, only check if there is any info on the ingredient to see \
whether or not we will import this data, @@ -134,5 +130,5 @@ void \
getIngredientNameAndID( std::multim  }
 
-int createIngredient(const QString &name, RecipeDB *database)
+int createIngredient(const QString &name, int unit_g_id, int unit_mg_id, RecipeDB \
*database)  {
         int assigned_id = database->findExistingIngredientByName( name );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic