Lines Matching refs:type

56 /*!	Opens a BNode on the given type, failing if the type has no
59 \param type The MIME type to open.
60 \param _node Node opened on the given MIME type.
63 DatabaseLocation::OpenType(const char* type, BNode& _node) const
65 if (type == NULL)
69 return _OpenType(type, _node, index);
73 /*! Opens a BNode on the given type, creating a node of the
78 \param type The MIME type to open.
79 \param _node Node opened on the given MIME type.
87 DatabaseLocation::OpenWritableType(const char* type, BNode& _node, bool create,
93 // See, if the type already exists.
95 status_t result = _OpenType(type, _node, index);
108 result = _CopyTypeNode(nodeToClone, type, _node);
121 // type doesn't exist yet -- create the respective node
122 result = _CreateTypeNode(type, _node);
126 // write the type attribute
127 size_t toWrite = strlen(type) + 1;
128 ssize_t bytesWritten = _node.WriteAttr(kTypeAttr, B_STRING_TYPE, 0, type,
147 for the given MIME type.
149 If no entry for the given type exists in the database, the function fails,
152 \param type The MIME type.
156 \param datatype The expected data type.
162 DatabaseLocation::ReadAttribute(const char* type, const char* attribute,
165 if (type == NULL || attribute == NULL || data == NULL)
169 status_t result = OpenType(type, node);
178 MIME type.
180 If no entry for the given type exists in the database, or if the data
184 \param type The MIME type.
192 DatabaseLocation::ReadMessageAttribute(const char* type, const char* attribute,
195 if (type == NULL || attribute == NULL)
201 status_t result = OpenType(type, node);
209 if (info.type != B_MESSAGE_TYPE)
226 /*! Reads a BString from the given attribute of the given MIME type.
228 If no entry for the given type exists in the database, the function fails
231 \param type The MIME type.
239 DatabaseLocation::ReadStringAttribute(const char* type, const char* attribute,
242 if (type == NULL || attribute == NULL)
246 status_t result = OpenType(type, node);
255 for the given MIME type.
257 If no entry for the given type exists in the database, it is created.
259 \param type The MIME type.
263 \param datatype The data type of the given data.
268 DatabaseLocation::WriteAttribute(const char* type, const char* attribute,
271 if (type == NULL || attribute == NULL || data == NULL)
275 status_t result = OpenWritableType(type, node, true, _didCreate);
288 of the given MIME type.
290 If no entry for the given type exists in the database, it is created.
292 \param type The MIME type.
299 DatabaseLocation::WriteMessageAttribute(const char* type, const char* attribute,
312 return WriteAttribute(type, attribute, data.Buffer(), data.BufferLength(),
317 /*! Deletes the given attribute for the given type
319 \param type The mime type
324 \retval B_ENTRY_NOT_FOUND No such type or attribute.
327 DatabaseLocation::DeleteAttribute(const char* type, const char* attribute) const
329 if (type == NULL || attribute == NULL)
333 status_t result = OpenWritableType(type, node, false);
341 /*! Fetches the application hint for the given MIME type.
345 \param type The MIME type of interest
351 \retval B_ENTRY_NOT_FOUND No app hint exists for the given type
354 DatabaseLocation::GetAppHint(const char* type, entry_ref& _ref)
356 if (type == NULL)
361 ssize_t status = ReadAttribute(type, kAppHintAttr, path, B_PATH_NAME_LENGTH,
374 typically associated with files of the given MIME type
382 about the MIME type's associated file attributes is stored.
387 DatabaseLocation::GetAttributesInfo(const char* type, BMessage& _info)
389 status_t result = ReadMessageAttribute(type, kAttrInfoAttr, _info);
400 result = _info.AddString("type", type);
407 /*! Fetches the short description for the given MIME type.
413 \param type The MIME type of interest
420 \retval B_ENTRY_NOT_FOUND No short description exists for the given type.
423 DatabaseLocation::GetShortDescription(const char* type, char* description)
425 ssize_t result = ReadAttribute(type, kShortDescriptionAttr, description,
432 /*! Fetches the long description for the given MIME type.
438 \param type The MIME type of interest
445 \retval B_ENTRY_NOT_FOUND No long description exists for the given type
448 DatabaseLocation::GetLongDescription(const char* type, char* description)
450 ssize_t result = ReadAttribute(type, kLongDescriptionAttr, description,
457 /*! Fetches a BMessage describing the MIME type's associated filename
466 type's associated file extensions will be stored.
471 DatabaseLocation::GetFileExtensions(const char* type, BMessage& _extensions)
473 status_t result = ReadMessageAttribute(type, kFileExtensionsAttr, _extensions);
482 result = _extensions.AddString("type", type);
489 /*! Fetches the icon of given size associated with the given MIME type.
495 \param type The mime type
504 DatabaseLocation::GetIcon(const char* type, BBitmap& _icon, icon_size size)
506 return GetIconForType(type, NULL, _icon, size);
510 /*! Fetches the vector icon associated with the given MIME type.
512 \param type The mime type
520 DatabaseLocation::GetIcon(const char* type, uint8*& _data, size_t& _size)
522 return GetIconForType(type, NULL, _data, _size);
526 /*! Fetches the large or mini icon used by an application of this type
527 for files of the given type.
529 The type of the \c BMimeType object is not required to actually be a subtype
531 \c GetIconForType() on a non-application type will likely return
538 \param type The MIME type
539 \param fileType Pointer to a pre-allocated string containing the MIME type
549 \retval B_ENTRY_NOT_FOUND No icon of the given size exists for the given type
552 DatabaseLocation::GetIconForType(const char* type, const char* fileType,
555 if (type == NULL)
558 // open the node for the given type
560 status_t result = OpenType(type, node);
587 /*! Fetches the vector icon used by an application of this type for files
588 of the given type.
590 The type of the \c BMimeType object is not required to actually be a subtype
592 \c GetIconForType() on a non-application type will likely return
597 \param type The MIME type
598 \param fileType Reference to a pre-allocated string containing the MIME type
606 \retval B_ENTRY_NOT_FOUND No vector icon existed for the given type.
609 DatabaseLocation::GetIconForType(const char* type, const char* fileType,
612 if (type == NULL)
615 // open the node for the given type
617 status_t result = OpenType(type, node);
634 // validate attribute type
636 result = (info.type == B_VECTOR_ICON_TYPE) ? B_OK : B_BAD_VALUE;
665 /*! Fetches signature of the MIME type's preferred application for the
674 \param type The MIME type of interest
685 DatabaseLocation::GetPreferredApp(const char* type, char* signature,
690 ssize_t result = ReadAttribute(type, kPreferredAppAttr, signature,
697 /*! Fetches the sniffer rule for the given MIME type.
698 \param type The MIME type of interest
699 \param _result Pointer to a pre-allocated BString into which the type's
707 DatabaseLocation::GetSnifferRule(const char* type, BString& _result)
709 return ReadStringAttribute(type, kSnifferRuleAttr, _result);
714 DatabaseLocation::GetSupportedTypes(const char* type, BMessage& _types)
716 status_t result = ReadMessageAttribute(type, kSupportedTypesAttr, _types);
724 result = _types.AddString("type", type);
731 //! Checks if the given MIME type is present in the database
733 DatabaseLocation::IsInstalled(const char* type)
736 return OpenType(type, node) == B_OK;
741 DatabaseLocation::_TypeToFilename(const char* type, int32 index) const
744 return path << '/' << BString(type).ToLower();
749 DatabaseLocation::_OpenType(const char* type, BNode& _node, int32& _index) const
753 status_t result = _node.SetTo(_TypeToFilename(type, i));
766 DatabaseLocation::_CreateTypeNode(const char* type, BNode& _node) const
768 const char* slash = strchr(type, '/');
771 superTypeName.SetTo(type, slash - type);
773 superTypeName = type;
810 DatabaseLocation::_CopyTypeNode(BNode& source, const char* type, BNode& _target)
813 status_t result = _CreateTypeNode(type, _target);
828 "type \"%s\": %s", attribute, type, strerror(result));
840 ssize_t bytesRead = source.ReadAttr(attribute, info.type, 0,
844 "type \"%s\": %s", attribute, type,
849 ssize_t bytesWritten = _target.WriteAttr(attribute, info.type, 0,
853 "type \"%s\": %s", attribute, type,