Documentation | StorageKit | AppFileInfo
NAME
AppFileInfo
VERSION
0.01
SYNOPSIS
Perl
use HaikuR1::AppFileInfo; my $info = HaikuR1::AppFileInfo->new($file); my $bitmap = $info->GetIcon(B_LARGE_ICON);
Python
from HaikuR1.StorageKit import HaikuR1.AppFileInfo info = AppFileInfo(file); bitmap = info.GetIcon(B_LARGE_ICON);
DESCRIPTION
Exposes the BAppFileInfo object.
For more information on AppFileInfo, see the Be Book class description, the Be Book overview, and the Haiku Book class description.
METHODS
Constructor
Creates an AppFileInfo.
Perl
HaikuR1::AppFileInfo->new($filename, $openMode); HaikuR1::AppFileInfo->new();
Python
AppFileInfo(file, openMode) AppFileInfo()
filenameA string, the name of the file.
openModeAn integer, one of the open mode constants; defaults to
B_READ_ONLY.
Application flags
GetAppFlags
SetAppFlags
RemoveAppFlags
Gets or sets the application flags.
Perl
$appfileinfo->GetAppFlags(); $appfileinfo->SetAppFlags($flags); $appfileinfo->RemoveAppFlags();
Python
appfileinfo.GetAppFlags() appfileinfo.SetAppFlags(flags) appfileinfo.RemoveAppFlags()
flagsAn integer, one or more of the application flag constants.
Catalog entry
GetCatalogEntry
SetCatalogEntry
Gets or sets the catalog entry, which is a colon-separated list of the following elements:
- signature
- context
- filename (without the path)
For example: x-vnd.Be-TRAK:System name:Tracker
Perl
$appfileinfo->GetCatalogEntry(); $appfileinfo->SetCatalogEntry($catalogEntry);
Python
appfileinfo.GetCatalogEntry() appfileinfo.SetCatalogEntry(catalogEntry)
catalogEntryA string
Icons
GetIcon
SetIcon
GetIconForType
SetIconForType
Gets the application's icon. If you pass a size, then it returns a Bitmap; otherwise, it the raw icon data.
The Type versions work on the icon that the application will use for the
given type.
Perl
$mimetype->GetIcon($size, $colorSpace); $mimetype->GetIcon(); $mimetype->SetIcon($icon, $updateMimeDB); $mimetype->SetIcon($data, $updateMimeDB); $mimetype->GetIconForType($type, $size, $colorSpace); $mimetype->GetIconForType(); $mimetype->SetIconForType($type, $icon, $updateMimeDB); $mimetype->SetIconForType($type, $data, $updateMimeDB);
Python
mimetype.GetIcon(size, colorSpace) mimetype.GetIcon() mimetype.SetIcon(icon, updateMimeDB) mimetype.SetIcon(data, updateMimeDB) mimetype.GetIconForType(type, size) mimetype.GetIconForType(type, size, colorSpace) mimetype.SetIconForType(type, icon, updateMimeDB) mimetype.SetIconForType(type, data, updateMimeDB)
sizeAn integer icon size constant. The version with this parameter returns a Bitmap object; the other version returns a byte string.
colorSpaceAn integer color space constant, the color space of the returned Bitmap; defaults to
B_RGBA32, but also acceptsB_RGBA32andB_CMAP8.iconA Bitmap, the new icon; should be a
32x32or16x16image.dataA byte string containing icon data.
typeA mime type string.
updateMimeDBA boolean; determines whether the system MIME database is updated; defaults to true.
Info location
SetInfoLocation
IsUsingAttributes
IsUsingResources
Gets or sets whether the AppFileInfo stores information in attributes or resources. (It can use both.)
Perl
$appfileinfo->SetInfoLocation($location); $appfileinfo->IsUsingAttributes(); $appfileinfo->IsUsingResources();
Python
appfileinfo.SetInfoLocation(location) appfileinfo.IsUsingAttributes() appfileinfo.IsUsingResources()
locationAn integer, one of the info location constants.
SetTo
Points the AppFileInfo at a file.
Perl
$appfileinfo->SetTo($file, $openMode);
Python
appfileinfo.SetTo(file, openMode)
filenameA string, the name of the file.
openModeAn integer, one of the open mode constants; defaults to
B_READ_ONLY.
Signature
GetSignature
SetSignature
Gets or sets the application signature.
Perl
$appfileinfo->GetSignature(); $appfileinfo->SetSignature($signature);
Python
appfileinfo.GetSignature() appfileinfo.SetSignature(signature)
signatureA MIME string.
Supported types
GetSupportedTypes
SetSupportedTypes
IsSupportedType
Supports
These methods do what you expect.
Note that IsSupportedType will always return true if the application
represented by the AppFileInfo supports the application/octet-stream type
(i.e., can support any type by treating it as a string of bytes), but
Supports will only return true when the application explicitly supports the
type.
Perl
$appfileinfo->GetSupportedTypes($types); $appfileinfo->SetSupportedTypes($types, $updateMimeDB, $syncAll); $appfileinfo->IsSupportedType($type); $appfileinfo->Supports($type);
Python
appfileinfo.GetSupportedTypes(types) appfileinfo.SetSupportedTypes(types, updateMimeDB, syncAll) appfileinfo.IsSupportedType(type) appfileinfo.Supports(type)
typesA native list of MIME type strings.
updateMimeDBA boolean; determines whether the system MIME database is updated; defaults to true.
syncAllA boolean; if true, then the previous list of supported types will be compared to the new list, and the application represented by the AppFileInfo will be added or deleted to that type's supporting apps; defaults to false. (Note that a later call may update them even if this parameter is false.)
typeA MIME type string (
IsSupportedType) or a MimeType (Supports).
Version info
GetVersionInfo
SetVersionInfo
Gets or sets the version info, which is a native map with the following fields:
major(integer) - the major version numbermiddle(integer) - the middle version numberminor(integer) - the minor version numbervariety(integer) - the variety of the versioninternal(internal) - an internal numbershort_info(string, max 64 bytes) - a short description of the versionlong_info(string, max 256 bytes) - a longer description of the version
Perl
$appfileinfo->GetVersionInfo($kind); $appfileinfo->SetVersionInfo($info, $kind);
Python
appfileinfo.GetVersionInfo(kind) appfileinfo.SetVersionInfo(info, kind)
kindAn integer, one of the version kind constants.
infoA native map.
CONSTANTS
Location
Perl
use HaikuR1::AppFileInfo qw(:info_location)
Python
Python does not support export tags.
- B_USE_ATTRIBUTES
- B_USE_RESOURCES
- B_USE_BOTH_LOCATIONS
Version kinds
Perl
use HaikuR1::AppFileInfo qw(:version_kind)
Python
Python does not support export tags.
B_APP_VERSION_KIND
The information concerns the application itself.
B_SYSTEM_VERSION_KIND
The information concerns the suite (or other grouping of applications) that the application is part of.
Version varieties
Perl
use HaikuR1::AppFileInfo qw(:info_variety)
Python
Python does not support export tags.
- B_DEVELOPMENT_VERSION
- B_ALPHA_VERSION
- B_BETA_VERSION
- B_GAMMA_VERSION
- B_GOLDEN_MASTER_VERSION
- B_FINAL_VERSION