//---------------------------------------------------------------- void PropertyList::SetProperty(const wxString& propname, const Property& prop) /** * \brief Sets the property with the given name. If the property does * not exists the property will be created. If the property already exists * the property will be overridden. * \param propname The property name. * \param prop The property. **/ { Property* setprop = GetProperty(propname, true); if (setprop->GetType() != prop.GetType()) { setprop->SetType(prop.GetType()); setprop->SetName(prop.GetName()); } switch (setprop->GetType()) { case penvPT_Boolean: setprop->SetBoolean(prop.GetBoolean()); break; case penvPT_Integer: setprop->SetInteger(prop.GetInteger()); break; case penvPT_Double: setprop->SetDouble(prop.GetDouble()); break; case penvPT_String: setprop->SetString(prop.GetString()); break; case penvPT_Properties: setprop->SetPropertyList(prop.GetPropertyList()); break; case penvPT_ArrayBoolean: NOT_IMPLEMENTED_YET(); break; case penvPT_ArrayInteger: NOT_IMPLEMENTED_YET(); break; case penvPT_ArrayDouble: NOT_IMPLEMENTED_YET(); break; case penvPT_ArrayString: NOT_IMPLEMENTED_YET(); break; default: wxString msg = wxString::Format(_T("Unknown type for property %s."), setprop->GetName().c_str()); break; } }
//---------------------------------------------------------------- const wxString& PropertyList::GetString(const wxString& propname) /** * \brief Returns the string value from a known property. * The method returns an empty string if the property does not exists and * a error will be generated. * \param propname The property name. * \return Value of that property. **/ { Property* prop = GetProperty(propname, false); if (prop == NULL) { wxLogError(_T("[penv::PropertyList::GetString] The property '%s' does not exists."), propname.c_str()); return (m_empty); } return (prop->GetString()); }