status_t Preferences::SetMessage (const char *name, const BMessage *message) { if (HasMessage (name) == true) return ReplaceMessage (name, 0, message); return AddMessage (name, message); }
status_t AttributeMessage::SetAttribute(const char* name, const BMessage* value) { if (ReplaceMessage(name, value) == B_OK) return B_OK; return AddMessage(name, value); }
status_t AttributeMessage::_SetFontAttribute(const char* name, const FontClass& font) { font_family family; font_style style; font.GetFamilyAndStyle(&family, &style); BMessage archivedFont; status_t ret = archivedFont.AddString("family", family); if (ret == B_OK) ret = archivedFont.AddString("style", style); if (ret == B_OK) ret = archivedFont.AddFloat("size", font.Size()); // TODO: Store more properties? if (ret != B_OK) return ret; if (ReplaceMessage(name, &archivedFont) == B_OK) return B_OK; return AddMessage(name, &archivedFont); }