haiku-website/static/legacy-docs/bebook/BAppFileInfo.html

265 lines
37 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Be Book - Classes And Methods - The Storage Kit</title><link rel="stylesheet" href="be_book.css" type="text/css" media="all" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./images/favicon.ico" /><!--[if IE]>
<link rel="stylesheet" type="text/css" href="be_book_ie.css" />
<![endif]--><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="Access, BeOS, BeBook, API" /><link rel="start" href="index.html" title="The Be Book" /><link rel="up" href="TheStorageKit.html" title="The Storage Kit" /><link rel="prev" href="TheStorageKit.html" title="The Storage Kit" /><link rel="next" href="BDirectory.html" title="BDirectory" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="TheStorageKit.html" title="The Storage Kit"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheStorageKit.html" title="The Storage Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="BDirectory.html" title="BDirectory"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="headerTR"><div id="navigpeople"><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div><div class="navigboxed" id="navigindex"><a accesskey="i" href="ClassIndex.html" title="Index">I</a></div><div class="navigboxed" id="naviglang" title="English">en</div></div><div id="headerTC">The Be Book - Classes And Methods - The Storage Kit</div></div><div id="headerB">Prev: <a href="TheStorageKit.html">The Storage Kit</a>  Up: <a href="TheStorageKit.html">The Storage Kit</a>  Next: <a href="BDirectory.html">BDirectory</a></div><hr /></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h2 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BAppFileInfo"></a>BAppFileInfo</h2></div></div></div><a id="id1220949" class="indexterm"></a><div class="classheader"><table border="0"><colgroup><col /><col /></colgroup><tbody><tr><td><table width="100%" border="0"><colgroup><col /><col /></colgroup><tbody><tr><td>Derived From:</td><td><a class="link" href="BNodeInfo.html" title="BNodeInfo"><code class="classname">BNodeInfo</code></a></td></tr><tr><td>Mix-in Classes:</td><td>None</td></tr><tr><td>Declared In:</td><td><code class="filename">storage/AppFileInfo.h</code></td></tr><tr><td>Library:</td><td><code class="filename">libbe.so</code></td></tr><tr><td>Allocation:</td><td></td></tr></tbody></table></td><td>
<a class="link overview" href="BAppFileInfo_Overview.html" title="BAppFileInfo">Class Overview</a>
<div class="toc"><ul><li><span class="section"><a href="BAppFileInfo.html#BAppFileInfo_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BAppFileInfo.html#BAppFileInfo_MemberFunctions">Member Functions</a></span></li><li><span class="section"><a href="BAppFileInfo.html#BAppFileInfo_Constants">Constants</a></span></li><li><span class="section"><a href="BAppFileInfo.html#BAppFileInfo_DefinedTypes">Defined Types</a></span></li></ul></div>
</td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BAppFileInfo_ConstructorDestructor"></a>Constructor and Destructor</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BAppFileInfo_Constructor"></a>BAppFileInfo()</h4></div></div></div><div class="synopsisgroup">
<code class="constructorsynopsis cpp"><span class="methodname">BAppFileInfo</span>();</code>
<code class="constructorsynopsis cpp"><span class="methodname">BAppFileInfo</span>(<span class="methodparam"><span class="type"><a class="link" href="BFile.html" title="BFile"><code class="classname">BFile</code></a>* </span><span class="parameter">file</span></span>);</code>
</div><p>
The default constructor creates a new, uninitialized <code class="classname">BAppFileInfo</code> object.
To initialize you have to follow this construction with a call to
<a class="link" href="BAppFileInfo.html#BAppFileInfo_SetTo" title="SetTo()"><code class="methodname">SetTo()</code></a>.
</p><p>
The <a class="link" href="BFile.html" title="BFile"><code class="classname">BFile</code></a>
version intializes the <code class="classname">BAppFileInfo</code> by passing the argument to
<a class="link" href="BAppFileInfo.html#BAppFileInfo_SetTo" title="SetTo()"><code class="methodname">SetTo()</code></a>.
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BAppFileInfo_Destructor"></a>~BAppFileInfo()</h4></div></div></div><code class="destructorsynopsis cpp"><span class="methodname">~BAppFileInfo</span>();</code><p>
Destroys the object. The <a class="link" href="BFile.html" title="BFile"><code class="classname">BFile</code></a>
that was used to initialize this object isn't touched.
</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BAppFileInfo_MemberFunctions"></a>Member Functions</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BAppFileInfo_GetAppFlags"></a><a id="BAppFileInfo_SetAppFlags"></a>
GetAppFlags(), SetAppFlags()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">GetAppFlags</span>(<span class="methodparam"><span class="type">uint32* </span><span class="parameter">flags</span></span>) <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">SetAppFlags</span>(<span class="methodparam"><span class="type">uint32 </span><span class="parameter">flags</span></span>);</code><p>
These functions get and set the executable's "app flags." These are the
constants that determine whether an executable can only be launched once,
whether it runs in the background, and so on. The app flag constants are
defined in
<code class="filename">app/Roster.h</code>;
the flags must include one of the following…
</p><ul class="itemizedlist"><li><p>
<code class="constant">B_SINGLE_LAUNCH</code>
</p></li><li><p>
<code class="constant">B_MULTIPLE_LAUNCH</code>
</p></li><li><p>
<code class="constant">B_EXCLUSIVE_LAUNCH</code>
</p></li></ul><p>
…plus either of these two:
</p><ul class="itemizedlist"><li><p>
<code class="constant">B_BACKGROUND_APP</code>
</p></li><li><p>
<code class="constant">B_ARGV_ONLY</code>
</p></li></ul><p>
See the <a class="link" href="BApplication.html" title="BApplication"><code class="classname">BApplication</code></a>
class for details on the meanings of these constants.
</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code></span></p></td><td><p>
Everything went fine.
</p></td></tr><tr><td><p><span class="term"><code class="constant">B_NO_INIT</code></span></p></td><td><p>
The object is not properly initialized.
</p></td></tr><tr><td><p><span class="term"><code class="constant">B_BAD_VALUE</code></span></p></td><td><p>
<code class="constant">NULL</code> flags.
</p></td></tr><tr><td><p><span class="term"><code class="constant">B_BAD_TYPE</code></span></p></td><td><p>
The attribute/resources the flags are stored in have
the wrong type.
</p></td></tr><tr><td><p><span class="term"><code class="constant">B_ENTRY_NOT_FOUND</code></span></p></td><td><p>
No application flags are set on the file.
</p></td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BAppFileInfo_GetIcon"></a><a id="BAppFileInfo_SetIcon"></a>
<a id="BAppFileInfo_GetIconForType"></a>
<a id="BAppFileInfo_SetIconForType"></a>
GetIcon(), SetIcon(), GetIconForType(), SetIconForType()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">GetIcon</span>(<span class="methodparam"><span class="type"><a class="link" href="BBitmap.html" title="BBitmap"><code class="classname">BBitmap</code></a>* </span><span class="parameter">icon</span></span>,<br />                 <span class="methodparam"><span class="type">icon_size </span><span class="parameter">which</span></span>) <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">SetIcon</span>(<span class="methodparam"><span class="type"><a class="link" href="BBitmap.html" title="BBitmap"><code class="classname">BBitmap</code></a>* </span><span class="parameter">icon</span></span>,<br />                 <span class="methodparam"><span class="type">icon_size </span><span class="parameter">which</span></span>);</code><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">GetIconForType</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">file_type</span></span>,<br />                        <span class="methodparam"><span class="type"><a class="link" href="BBitmap.html" title="BBitmap"><code class="classname">BBitmap</code></a>* </span><span class="parameter">icon</span></span>,<br />                        <span class="methodparam"><span class="type">icon_size </span><span class="parameter">which</span></span>) <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">SetIconForType</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">file_type</span></span>,<br />                        <span class="methodparam"><span class="type"><a class="link" href="BBitmap.html" title="BBitmap"><code class="classname">BBitmap</code></a>* </span><span class="parameter">icon</span></span>,<br />                        <span class="methodparam"><span class="type">icon_size </span><span class="parameter">which</span></span>);</code><p>
<code class="methodname">GetIcon()</code> and <code class="methodname">SetIcon()</code>
get and set the icons that are represent the
executable. <code class="methodname">GetIconForType()</code> and <code class="methodname">SetIconForType()</code> get and set the icons
that the executable uses when it writes (or otherwise "takes possession
of") a file of the given type, identified by <code class="parameter">file_type</code>. You specify which
icon you want (large or small) by passing <code class="constant">B_LARGE_ICON</code> or <code class="constant">B_MINI_ICON</code> as
the <code class="parameter">which</code> argument.
</p><p>
The icon is passed in or returned through the icon argument. The bitmap
must be the proper size: 32x32 for the large icon, 16x16 for the small
one. In <a class="link" href="BRect.html" title="BRect"><code class="classname">BRect</code></a> lingo, that's
<span class="code"><code class="classname">BRect</code>(0, 0, 31, 31)</span> and
<span class="code"><code class="classname">BRect</code>(0, 0, 15, 15)</span>.
The bitmap's color space must be <code class="constant">B_CMAP8</code>. For example:
</p><pre class="programlisting example cpp"><code class="classname">BBitmap</code>* <code class="varname">bitmap</code> = new <code class="classname">BBitmap</code>(<code class="classname">BRect</code>(0,0,31,31), <code class="constant">B_CMAP8</code>);
<code class="varname">appFileInfo</code>.<code class="methodname">GetIcon</code>(<code class="varname">bitmap</code>, <code class="constant">B_LARGE_ICON</code>);</pre><p>
You can remove an icon by passing <code class="constant">NULL</code> as the <code class="parameter">icon</code>
argument to <code class="methodname">SetIcon()</code>.
</p><div class="admonition note"><div class="title">Note</div><div class="graphic"><img class="icon" alt="Note" width="32" src="./images/admonitions/Info_32.png" /><div class="text"><p>To create a <a class="link" href="BBitmap.html" title="BBitmap"><code class="classname">BBitmap</code></a>
you must have a <a class="link" href="BApplication.html#BApplication_be_app" title="be_app"><code class="varname">be_app</code></a>
object ; the object needn't be running.</p></div></div></div><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>
Success
</p></td></tr><tr><td><p><span class="term"><code class="constant">B_BAD_VALUE</code>.</span></p></td><td><p>
(<code class="methodname">Get…()</code>) <code class="constant">NULL</code>
<code class="classname">BBitmap</code>, or invalid <code class="parameter">file_type</code>.
</p></td></tr><tr><td><p><span class="term"><code class="constant">B_BAD_VALUE</code>.</span></p></td><td><p>
(<code class="methodname">Set…()</code>) The bitmap data isn't the proper size.
</p></td></tr><tr><td><p><span class="term"><code class="constant">B_NO_INIT</code>.</span></p></td><td><p>
The object is not properly initialized.
</p></td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BAppFileInfo_GetPreferredApp"></a><a id="BAppFileInfo_SetPreferredApp"></a>
GetPreferredApp(), SetPreferredApp()</h4></div></div></div><p>
An application's preferred app must be itself; an add-on is more flexible. For syntax, see
<a class="link" href="BNodeInfo.html#BNodeInfo_SetPreferredApp"><code class="methodname">BNodeInfo::SetPreferredApp()</code></a>.
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BAppFileInfo_GetSignature"></a><a id="BAppFileInfo_SetSignature"></a>
GetSignature() , SetSignature()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">GetSignature</span>(<span class="methodparam"><span class="type">char* </span><span class="parameter">signature</span></span>) <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">SetSignature</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">signature</span></span>);</code><p>
These functions get and set the executable's <acronym class="acronym">MIME</acronym> type signature. The
<code class="parameter">signature</code> buffer you pass to <code class="methodname">GetSignature()</code> should be at least
<code class="constant">B_MIME_TYPE_LENGTH</code> characters long; the
<code class="methodname">SetSignature()</code> buffer must be no
longer than that.
</p><p>
When you set an executable's signature, the signature is installed in the
File Type database if it's not there already. The old signature isn't
removed from the database.
</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>
Success.
</p></td></tr><tr><td><p><span class="term"><code class="constant">B_ENTRY_NOT_FOUND</code>.</span></p></td><td><p>
(<code class="methodname">Get…()</code>)
The executable doesn't have a signature.
</p></td></tr><tr><td><p><span class="term"><code class="constant">B_BAD_VALUE</code>.</span></p></td><td><p>
(<code class="methodname">Set…()</code>)
<code class="parameter">signature</code> is too long.
</p></td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BAppFileInfo_GetSupportedTypes"></a><a id="BAppFileInfo_SetSupportedTypes"></a>
GetSupportedTypes(), SetSupportedTypes()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">GetSupportedTypes</span>(<span class="methodparam"><span class="type"><a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a>* </span><span class="parameter">types</span></span>) <span class="modifier">const</span>;</code><div class="synopsisgroup">
<code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">SetSupportedTypes</span>(<span class="methodparam"><span class="modifier">const </span><span class="type"><a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a>* </span><span class="parameter">types</span></span>);</code>
<code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">SetSupportedTypes</span>(<span class="methodparam"><span class="modifier">const </span><span class="type"><a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a>* </span><span class="parameter">types</span></span>,<br />                           <span class="methodparam"><span class="type">bool </span><span class="parameter">sync_all</span></span>);</code>
</div><p>
These functions get and set the MIME file types that this executable can
read and/or write. The <code class="parameter">types</code>
<a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a> that you pass in looks like this:
</p><div class="informaltable"><table border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Field</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="varname">types</code> (array)</td><td><code class="constant">B_STRING_TYPE</code></td><td>An array of MIME strings.</td></tr></tbody></table></div><p>
<code class="methodname">GetSupportedTypes()</code> copies the types
into the <code class="varname">types</code> field;
<code class="methodname">SetSupportedTypes()</code> reads them from the field. The message's command
constants (its <code class="varname">what</code> value) is ignored.
</p><p>
Here we print an executable's supported types:
</p><pre class="programlisting example cpp"><code class="classname">BMessage</code> <code class="varname">msg</code>;
<span class="type">uint32</span> <code class="varname">i</code>=0;
<span class="type">char*</span> <code class="varname">ptr</code>;
if (<code class="varname">appFileInfo</code>.<code class="methodname">GetSupportedTypes</code>(&amp;<code class="varname">msg</code>) != <code class="constant">B_OK</code>)
<span class="comment">/* Handle the error. */</span>
while (<code class="varname">msg</code>.<code class="methodname">FindString</code>("types", <code class="varname">i</code>++, &amp;<code class="varname">ptr</code>) == <code class="constant">B_OK</code>)
<code class="function">printf</code>("&gt; Supported Type: %sn", <code class="varname">ptr</code>);</pre><p>
If <code class="methodname">SetSupportedTypes()</code> names a type that doesn't already appear in the
File Type database, the new type is added to the database and its
preferred handler is set to the executable that this <code class="classname">BAppFileInfo</code> object
represents.
</p><div class="admonition warning"><div class="title">Warning</div><div class="graphic"><img class="icon" alt="Warning" width="32" src="./images/admonitions/Stop_32.png" /><div class="text"><p><code class="methodname">SetSupportedTypes()</code> clobbers an executable's existing set of supported
types. If you want to augment an executable's supported types, you should
retrieve the existing set, add the new ones, and <span class="emphasis"><em>then</em></span> call
<code class="methodname">SetSupportedTypes()</code>.</p></div></div></div><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>
Success.
</p></td></tr><tr><td><p><span class="term"><code class="constant">B_NO_MEMORY</code>.</span></p></td><td><p>
Insufficient memory to copy the types.
</p></td></tr></tbody></table><p>
See Also:
<a class="link" href="BAppFileInfo.html#BAppFileInfo_Supports"><code class="methodname">Supports()</code></a>
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BAppFileInfo_GetType"></a><a id="BAppFileInfo_SetType"></a>
GetType(), SetType()</h4></div></div></div><p>
Implementation detail; see "<a class="xref" href="BAppFileInfo_Overview.html#BAppFileInfo_Functions_Inherited_From_BNodeInfo" title="Functions Inherited From BNodeInfo">Functions Inherited From BNodeInfo</a>". An
executable's default file type (for both applications and add-ons) is
<code class="constant">B_APP_MIME_TYPE</code>. This value mustn't be changed. For syntax, see
<a class="link" href="BNodeInfo.html#BNodeInfo_SetType"><code class="methodname">BNodeInfo::SetType()</code></a>.
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BAppFileInfo_GetVersionInfo"></a><a id="BAppFileInfo_SetVersionInfo"></a>
GetVersionInfo(), SetVersionInfo()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">GetVersionInfo</span>(<span class="methodparam"><span class="type">version_info* </span><span class="parameter">info</span></span>,<br />                        <span class="methodparam"><span class="type">version_kind </span><span class="parameter">kind</span></span>) <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">SetVersionInfo</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">version_info* </span><span class="parameter">info</span></span>,<br />                        <span class="methodparam"><span class="type">version_kind </span><span class="parameter">kind</span></span>);</code><p>
The functions get and set the application's "version info." The
information is recorded in the <span class="type">version_info</span> structure:
</p><pre class="programlisting definition c">struct <span class="type">version_info</span> {
<span class="type">uint32</span> <code class="varname">major</code>;
<span class="type">uint32</span> <code class="varname">middle</code>;
<span class="type">uint32</span> <code class="varname">minor</code>;
<span class="type">uint32</span> <code class="varname">variety</code>;
<span class="type">uint32</span> <code class="varname">internal</code>;
<span class="type">char</span> <code class="varname">short_info</code>[64];
<span class="type">char</span> <code class="varname">long_info</code>[256];
}</pre><p>
The field names (and types) provide suggestions for the type of info they
want to store.
</p><p>
There are two kinds of version info, as specified by the <code class="parameter">kind</code> argument:
</p><table class="variablelist constants"><thead><tr><th>Constant</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_APP_VERSION_KIND</code></span></p></td><td><p>Provides information about this specific app.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_SYSTEM_VERSION_KIND</code></span></p></td><td><p>Provides information about the "suite," or
other grouping of apps, that this app belongs to.</p></td></tr></tbody></table><p>
Again, the uses of the two kinds is up to the app
developer—currently, nothing in the BeOS depends on any information
being stored in either <span class="type">version_info</span> structure.
</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>
The <span class="type">version_info</span> was found or set.
</p></td></tr><tr><td><p><span class="term"><code class="constant">B_ENTRY_NOT_FOUND</code>.</span></p></td><td><p>
(<code class="methodname">Get…()</code>)
the app doesn't have the requested version info.
</p></td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BAppFileInfo_InitCheck"></a>InitCheck()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">InitCheck</span>() <span class="modifier">const</span>;</code><p>
Returns the status of the most recent initialization.
</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>
The object was successfully initialized.
</p></td></tr><tr><td><p><span class="term"><code class="constant">B_BAD_VALUE</code>.</span></p></td><td><p>
The object is uninitialized.
</p></td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BAppFileInfo_IsSupportedType"></a><a id="BAppFileInfo_Supports"></a>
IsSupportedType(), Supports()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">IsSupportedType</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">type</span></span>) <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">Supports</span>(<span class="methodparam"><span class="type"><a class="link" href="BMimeType.html" title="BMimeType"><code class="classname">BMimeType</code></a>* </span><span class="parameter">type</span></span>) <span class="modifier">const</span>;</code><p>
Returns <code class="constant">true</code> if the app supports the given MIME type and <code class="constant">false</code> if it
doesn't. <code class="methodname">IsSupportedType()</code> always returns <code class="constant">true</code> if the application
supports "application/octet-stream", while <code class="methodname">Supports()</code> returns <code class="constant">true</code> only
if <code class="parameter">type</code> is explicitly supported.
</p><p>
See Also:
<a class="link" href="BAppFileInfo.html#BAppFileInfo_GetSupportedTypes" title="GetSupportedTypes(), SetSupportedTypes()"><code class="methodname">GetSupportedTypes()</code></a>,
<a class="link" href="BAppFileInfo.html#BAppFileInfo_SetSupportedTypes"><code class="methodname">SetSupportedTypes()</code></a>
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BAppFileInfo_SetInfoLocation"></a><a id="BAppFileInfo_IsUsingAttributes"></a>
<a id="BAppFileInfo_IsUsingResources"></a>
SetInfoLocation(), IsUsingAttributes(), IsUsingResources()</h4></div></div></div><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">SetInfoLocation</span>(<span class="methodparam"><span class="type">info_location </span><span class="parameter">loc</span></span>);</code><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">IsUsingAttributes</span>() <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">IsUsingResources</span>() <span class="modifier">const</span>;</code><p>
<code class="methodname">SetInfoLocation()</code> sets the location where
the <code class="classname">BAppFileInfo</code> object stores
its information. It can store them as either attributes, resources, or
both. <code class="parameter">loc</code> takes the following values:
</p><ul class="itemizedlist"><li><p>
<code class="constant">B_USE_ATTRIBUTES</code>
</p></li><li><p>
<code class="constant">B_USE_RESOURCES</code>
</p></li><li><p>
<code class="constant">B_USE_BOTH</code>
</p></li></ul><p>
<code class="methodname">IsUsingAttributes()</code> and <code class="methodname">IsUsingResources()</code>
return <code class="constant">true</code> if the
<code class="classname">BAppFileInfo</code> object is storing information in the designated location and
<code class="constant">false</code> otherwise.
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BAppFileInfo_SetTo"></a>SetTo()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">SetTo</span>(<span class="methodparam"><span class="type"><a class="link" href="BFile.html" title="BFile"><code class="classname">BFile</code></a>* </span><span class="parameter">file</span></span>);</code><p>
Initializes the <code class="classname">BAppFileInfo</code> object by pointing it
to <code class="parameter">file</code>, which must be a valid (initialized)
<a class="link" href="BFile.html" title="BFile"><code class="classname">BFile</code></a> object, and
must not be locked. The <code class="classname">BFile</code> is
not copied, or re-opened by <code class="classname">BAppFileInfo</code>. In particular, the <code class="classname">BAppFileInfo</code>
uses <code class="parameter">file</code>'s file descriptor, and doesn't destroy the <code class="classname">BFile</code> object when it
(the <code class="classname">BAppFileInfo</code>) is destroyed or reinitialized.
</p><div class="admonition warning"><div class="title">Warning</div><div class="graphic"><img class="icon" alt="Warning" width="32" src="./images/admonitions/Stop_32.png" /><div class="text"><p>The <code class="classname">BAppFileInfo</code> object doesn't check to make sure that the file that
you pass in really is an executable. Passing in a non-executable (a plain
file, a directory, etc.) could corrupt the file.</p></div></div></div><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>
The object was successfully initialized.
</p></td></tr><tr><td><p><span class="term"><code class="constant">B_BAD_VALUE</code>.</span></p></td><td><p>
<code class="parameter">file</code> is invalid (uninitialized).
</p></td></tr></tbody></table></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BAppFileInfo_Constants"></a>Constants</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="Constants_Version_Kinds"></a><a id="B_APP_VERSION_KIND"></a>
<a id="B_SYSTEM_VERSION_KIND"></a>
Version Kinds</h4></div></div></div><a id="id1223579" class="indexterm"></a><a id="id1223589" class="indexterm"></a><p>
Declared in: <code class="filename">storage/AppFileInfo.h</code>
</p><table class="variablelist constants"><thead><tr><th>Constant</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_APP_VERSION_KIND</code></span></p></td><td><p>Records information about a specific application.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_SYSTEM_VERSION_KIND</code></span></p></td><td><p>Records information about a "suite," or other
grouping of applications, that the application belongs to.</p></td></tr></tbody></table><p>
These constants are used when setting or retrieving the version
information attached to an application. There are two version information
records for each application, and these two constants select which one
you wish to reference. Although there is no prescribed use for these
structures or their constants, it is suggested that <code class="constant">B_APP_VERSION_KIND</code> be
used for application-specific version information, and
<code class="constant">B_SYSTEM_VERSION_KIND</code> be used for information about the suite of
applications to which the application belongs.
</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BAppFileInfo_DefinedTypes"></a>Defined Types</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="version_info"></a>version_info</h4></div></div></div><a id="id1223690" class="indexterm"></a><p>
Declared in: <code class="filename">storage/AppFileInfo.h</code>
</p><pre class="programlisting definition cpp">struct version_info {
<span class="type">uint32</span> <code class="varname">major</code>;
<span class="type">uint32</span> <code class="varname">middle</code>;
<span class="type">uint32</span> <code class="varname">minor</code>;
<span class="type">uint32</span> <code class="varname">variety</code>;
<span class="type">uint32</span> <code class="varname">internal</code>;
<span class="type">char</span> <code class="varname">short_info</code>[64];
<span class="type">char</span> <code class="varname">long_info</code>[256];
}</pre><p>
The <span class="type">version_info</span> structure is used to contain version information about
an application. Although none of these fields have prescribed uses, and
you can use them for anything you want, their names do hint at their
suggested uses.
</p></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="TheStorageKit.html">The Storage Kit</a>  Up: <a href="TheStorageKit.html">The Storage Kit</a>  Next: <a href="BDirectory.html">BDirectory</a> </div><div id="footerB"><div id="footerBL"><a href="TheStorageKit.html" title="The Storage Kit"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheStorageKit.html" title="The Storage Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="BDirectory.html" title="BDirectory"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="footerBR"><div><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div></div><div id="footerBC"><a href="http://www.access-company.com/home.html" title="ACCESS Co."><img alt="Access Company" src="./images/access_logo.png" /></a></div></div></div><div id="licenseFooter"><div id="licenseFooterBL"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="Creative Commons License"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-nd/3.0/88x31.png" /></a></div><div id="licenseFooterBR"><a href="./LegalNotice.html">Legal Notice</a></div><div id="licenseFooterBC"><span id="licenseText">This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative
Commons Attribution-Non commercial-No Derivative Works 3.0 License</a>.</span></div></div></body></html>