Changeset 62 for trunk


Ignore:
Timestamp:
01/04/08 17:32:34 (12 years ago)
Author:
art
Message:

PropertManager? changes:

  • There was a bug that a property generated with PropertyManager::set(value, name, group), assuming property wasn't initialized before, do not setup correct fullname of the property. This is now solved
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/nrEngine/PropertyManager.cpp

    r49 r62  
    4747        Property& PropertyManager::getProperty(const std::string& name, const std::string& group) 
    4848        { 
    49                 return mPropertyMap[group][name]; 
     49        // get list which should contain the property 
     50        PropertyList& list = mPropertyMap[group]; 
     51 
     52        // check if such a property exists in the database 
     53        PropertyList::iterator it = list.begin(); 
     54        for (; it != list.end(); it++)  
     55            if (it->getName() == name) return *it; 
     56 
     57        // we haven't found this property hence generate new one 
     58        Property p; 
     59        p.mName = name; 
     60        p.mFullname = group + std::string(".") + name; 
     61 
     62        // some debug info 
     63        NR_Log(Log::LOG_ENGINE, Log::LL_DEBUG, "Property: Initialize new property '%s.%s'", group.c_str(), name.c_str()); 
     64 
     65        // add property into the list and return the reference 
     66        list.push_back(p); 
     67                return list.back(); 
    5068        } 
    5169 
     
    6886                // we have not found any such element, so create one 
    6987                NR_Log(Log::LOG_ENGINE, Log::LL_WARNING, "PropertyManager: Property with fullname '%s' is not registered, so create it in default group", fullname.c_str()); 
    70                 return getProperty(fullname, ""); 
     88                return getProperty(fullname, "."); 
    7189        } 
    7290 
Note: See TracChangeset for help on using the changeset viewer.