Changeset 49
- Timestamp:
- 09/18/2007 11:15:21 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
README (modified) (1 diff)
-
include/nrEngine/Property.h (modified) (2 diffs)
-
include/nrEngine/PropertyManager.h (modified) (6 diffs)
-
src/nrEngine/Property.cpp (modified) (4 diffs)
-
src/nrEngine/PropertyManager.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/README
r41 r49 1 How to install: 1 First you have to compile the engine: 2 make 2 3 3 Install in default directory (/usr/local) 4 scons 5 scons install 6 7 Install in prefered directory (/bla/bla) 8 scons 9 scons prefix=/blah/blah install 4 if you want to install the engine later in a non default directory, then call 5 make prefix=/path/as/prefix 10 6 11 To build debug version call: 12 scons debug=1 7 To install engine type: 8 make install (to install into default directory /usr/local) 9 make INST_LOCATION=/path/to/install (to install into another directory) 13 10 14 For more help on parameters call 15 scons -h 16 17 by problems contact me on arti_tevs@yahoo.de 11 12 by problems contact me on arti_tevs@yahoo.de -
trunk/include/nrEngine/Property.h
r45 r49 74 74 * is not handled by manager, so fullname is equal name 75 75 **/ 76 NR_FORCEINLINE const std::string& getFull Name() const { return mFullName; }76 NR_FORCEINLINE const std::string& getFullname() const { return mFullname; } 77 77 78 78 /** … … 148 148 149 149 //! Full name of property (group.name) 150 std::string mFull Name;150 std::string mFullname; 151 151 152 152 //! Value holding by the property -
trunk/include/nrEngine/PropertyManager.h
r45 r49 58 58 59 59 /** 60 * Get number of properties in a certain group 61 * 62 * @param [group] Unique name of a property group 63 **/ 64 //int32 getPropertyCount(const std::string& group = std::string()); 60 * Check whenever a property exists in the database. 61 * @param name Name of the property 62 * @param [group] Unique name of the group, where to look for the property 63 **/ 64 bool isPropertyRegistered(const std::string& name, const std::string& group = std::string()) const; 65 bool isPropertyRegisteredByFullname(const std::string& fullname) const; 65 66 66 67 /** … … 78 79 **/ 79 80 Property& getProperty(const std::string& name, const std::string& group = std::string()); 80 Property& getPropertyByFull Name(const std::string& fullname);81 Property& getPropertyByFullname(const std::string& fullname); 81 82 82 83 /** … … 111 112 * @param fullname Fullname of the property (i.e. "group.name") 112 113 **/ 113 void setByFull Name(const boost::any& value, const std::string& fullname);114 void setByFull Name(const Property& property,const std::string& name);114 void setByFullname(const boost::any& value, const std::string& fullname); 115 void setByFullname(const Property& property,const std::string& name); 115 116 116 117 /** … … 130 131 **/ 131 132 template<typename T> 132 NR_FORCEINLINE T getByFullName(const std::string& name); 133 NR_FORCEINLINE T getByFullname(const std::string& name); 134 135 /** 136 * Extract the group name from a fullname of a property. The fullname is 137 * a combination like: "group.property". So this function will look for 138 * the first occurence of '.' and will return the group name back. 139 * If no group name exists, then empty string will be given back 140 * @param fullname Combined name of the property (also known as Fullname) 141 **/ 142 std::string getGroupName(const std::string& fullname) const; 143 144 /** 145 * Same as getGroupName(), but extracts the property name from the combination. 146 **/ 147 std::string getPropertyName(const std::string& fullname) const; 133 148 134 149 private: 135 150 136 151 //! This describey the type of our property map 137 152 typedef std::map<std::string, PropertyList> PropertyMap; … … 139 154 //! Here we store our properties 140 155 PropertyMap mPropertyMap; 156 141 157 }; 142 158 … … 168 184 //---------------------------------------------------------------------------------- 169 185 template<typename T> 170 NR_FORCEINLINE T PropertyManager::getByFull Name(const std::string& fullname)186 NR_FORCEINLINE T PropertyManager::getByFullname(const std::string& fullname) 171 187 { 172 188 try{ 173 189 // get property value 174 boost::any& v = getPropertyByFull Name(fullname).getValue();190 boost::any& v = getPropertyByFullname(fullname).getValue(); 175 191 176 192 // check if property is empty -
trunk/src/nrEngine/Property.cpp
r46 r49 27 27 28 28 //---------------------------------------------------------------------------------- 29 Property::Property(const std::string& name) : mName(name), mFull Name(name), mUserData(NULL)29 Property::Property(const std::string& name) : mName(name), mFullname(name), mUserData(NULL) 30 30 { 31 31 … … 33 33 34 34 //---------------------------------------------------------------------------------- 35 Property::Property (const std::string& name, const boost::any& value) : mName(name), mFull Name(name), mValue(value), mUserData(NULL)35 Property::Property (const std::string& name, const boost::any& value) : mName(name), mFullname(name), mValue(value), mUserData(NULL) 36 36 { 37 37 … … 39 39 40 40 //---------------------------------------------------------------------------------- 41 Property::Property(const Property& p):mName(p.getName()), mFull Name(p.getFullName()), mValue(p.getValue()), mUserData(p.mUserData)41 Property::Property(const Property& p):mName(p.getName()), mFullname(p.getFullname()), mValue(p.getValue()), mUserData(p.mUserData) 42 42 { 43 43 … … 54 54 bool Property::operator==(const Property& p) 55 55 { 56 return (p.getFull Name() == mFullName && p.getValue().type() == mValue.type());56 return (p.getFullname() == mFullname && p.getValue().type() == mValue.type()); 57 57 } 58 58 -
trunk/src/nrEngine/PropertyManager.cpp
r46 r49 51 51 52 52 //---------------------------------------------------------------------------------- 53 Property& PropertyManager::getPropertyByFull Name(const std::string& fullname)53 Property& PropertyManager::getPropertyByFullname(const std::string& fullname) 54 54 { 55 55 // iterate through all groups … … 60 60 PropertyList::iterator jt = it->second.begin(); 61 61 for (; jt != it->second.end(); jt++) 62 if (jt->getFull Name() == fullname)62 if (jt->getFullname() == fullname) 63 63 { 64 64 return *jt; … … 68 68 // we have not found any such element, so create one 69 69 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, ""); 70 return getProperty(fullname, ""); 71 } 72 73 //---------------------------------------------------------------------------------- 74 bool PropertyManager::isPropertyRegistered(const std::string& name, const std::string& group) const 75 { 76 // iterate through all groups 77 PropertyMap::const_iterator it = mPropertyMap.begin(); 78 for (; it != mPropertyMap.end(); it++) 79 { 80 // if we are checking in a certain group 81 if (it->first == group) 82 { 83 return it->second.exists(name); 84 } 85 } 86 return false; 87 } 88 89 //---------------------------------------------------------------------------------- 90 bool PropertyManager::isPropertyRegisteredByFullname(const std::string& fullname) const 91 { 92 // extract the group name 93 return isPropertyRegistered(getPropertyName(fullname), getGroupName(fullname)); 94 } 95 96 //---------------------------------------------------------------------------------- 97 std::string PropertyManager::getGroupName(const std::string& fullname) const 98 { 99 // find the first occurence of . character 100 uint32 pos = fullname.find('.'); 101 102 if (pos == std::string::npos || pos == 0) return std::string(); 103 104 return fullname.substr(0, pos - 1); 105 } 106 107 //---------------------------------------------------------------------------------- 108 std::string PropertyManager::getPropertyName(const std::string& fullname) const 109 { 110 // find the first occurence of . character 111 uint32 pos = fullname.find('.'); 112 113 if (pos == std::string::npos) return fullname; 114 if (pos == 0) pos = -1; 115 116 return fullname.substr(pos + 1); 71 117 } 72 118 … … 77 123 p.copyDataOnly(property); 78 124 p.mName = name; 79 p.mFull Name = group + std::string(".") + name;125 p.mFullname = group + std::string(".") + name; 80 126 } 81 127 82 128 //---------------------------------------------------------------------------------- 83 void PropertyManager::setByFull Name(const Property& property, const std::string& fullname)129 void PropertyManager::setByFullname(const Property& property, const std::string& fullname) 84 130 { 85 131 // get property by fullname 86 Property& p = getPropertyByFull Name(fullname);132 Property& p = getPropertyByFullname(fullname); 87 133 p.copyDataOnly(property); 88 p.mFull Name = fullname;134 p.mFullname = fullname; 89 135 if (p.mName.length() == 0) p.mName = fullname; 90 136 } … … 102 148 103 149 //---------------------------------------------------------------------------------- 104 void PropertyManager::setByFull Name(const boost::any& value, const std::string& fullname)150 void PropertyManager::setByFullname(const boost::any& value, const std::string& fullname) 105 151 { 106 152 // get property 107 Property& p = getPropertyByFull Name(fullname);153 Property& p = getPropertyByFullname(fullname); 108 154 109 155 // set new value
Note: See TracChangeset
for help on using the changeset viewer.
