Added BAppFileInfo header, empty implementation with doxygen comments.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@796 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2002-08-17 23:59:41 +00:00
parent f8b7638264
commit d6b205f306
2 changed files with 588 additions and 0 deletions
+117
View File
@@ -0,0 +1,117 @@
//----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered
// by the OpenBeOS license.
//---------------------------------------------------------------------
/*!
\file AppFileInfo.h
BAppFileInfo and related structures' interface declarations.
*/
#ifndef _APP_FILE_INFO_H
#define _APP_FILE_INFO_H
#include <NodeInfo.h>
class BBitmap;
class BFile;
class BMessage;
class BResources;
struct version_info {
uint32 major;
uint32 middle;
uint32 minor;
uint32 variety;
uint32 internal;
char short_info[64];
char long_info[256];
};
enum info_location {
B_USE_ATTRIBUTES = 0x1,
B_USE_RESOURCES = 0x2,
B_USE_BOTH_LOCATIONS = 0x3 // == B_USE_ATTRIBUTES | B_USE_RESOURCES
};
enum version_kind {
B_APP_VERSION_KIND,
B_SYSTEM_VERSION_KIND
};
/*! \brief Executable meta information handling.
The BAppFileInfo class provides access to meta data that can be associated
with executables, libraries and add-ons.
\author <a href='[email protected]'>Ingo Weinhold</a>
\version 0.0.0
*/
class BAppFileInfo: public BNodeInfo {
public:
BAppFileInfo();
BAppFileInfo(BFile *file);
virtual ~BAppFileInfo();
status_t SetTo(BFile *file);
virtual status_t GetType(char *type) const;
virtual status_t SetType(const char *type);
status_t GetSignature(char *signature) const;
status_t SetSignature(const char *signature);
status_t GetAppFlags(uint32 *flags) const;
status_t SetAppFlags(uint32 flags);
status_t GetSupportedTypes(BMessage *types) const;
status_t SetSupportedTypes(const BMessage *types, bool syncAll);
status_t SetSupportedTypes(const BMessage *types);
bool IsSupportedType(const char *type) const;
bool Supports(BMimeType *type) const;
virtual status_t GetIcon(BBitmap *icon, icon_size which) const;
virtual status_t SetIcon(const BBitmap *icon, icon_size which);
status_t GetVersionInfo(version_info *info, version_kind kind) const;
status_t SetVersionInfo(const version_info *info, version_kind kind);
status_t GetIconForType(const char *type, BBitmap *icon,
icon_size which) const;
status_t SetIconForType(const char *type, const BBitmap *icon,
icon_size which);
void SetInfoLocation(info_location location);
bool IsUsingAttributes() const;
bool IsUsingResources() const;
private:
// uncomment when needed
// friend status_t _update_mime_info_(const char *, int32);
// friend status_t _real_update_app_(BAppFileInfo *, const char *, bool);
// friend status_t _query_for_app_(BMimeType *, const char *, entry_ref *,
// version_info *);
// friend class BRoster;
virtual void _ReservedAppFileInfo1();
virtual void _ReservedAppFileInfo2();
virtual void _ReservedAppFileInfo3();
// uncomment when needed
// static status_t SetSupTypesForAll(BMimeType *, const BMessage *);
BAppFileInfo &operator=(const BAppFileInfo &);
BAppFileInfo(const BAppFileInfo &);
// uncomment when needed
// status_t _SetSupportedTypes(const BMessage *types);
// status_t UpdateFromRsrc();
// status_t RealUpdateRsrcToAttr();
// status_t UpdateMetaMime(const char *path, bool force,
// uint32 *changesMask) const;
// bool IsApp();
// status_t GetMetaMime(BMimeType *meta) const;
BResources *fResources;
info_location fWhere;
uint32 _reserved[2];
};
#endif // _APP_FILE_INFO_H
+471
View File
@@ -0,0 +1,471 @@
// BAppFileInfo.cpp
#include <AppFileInfo.h>
enum {
NOT_IMPLEMENTED = B_ERROR,
};
// constructor
/*! \brief Creates an uninitialized BAppFileInfo object.
*/
BAppFileInfo::BAppFileInfo()
: fResources(NULL),
fWhere(B_USE_BOTH_LOCATIONS)
{
}
// constructor
/*! \brief Creates an BAppFileInfo object and initializes it to the supplied
file.
The caller retains ownership of the supplied BFile object. It must not
be deleted during the life time of the BAppFileInfo. It is not deleted
when the BAppFileInfo is destroyed.
\param file The file the object shall be initialized to.
*/
BAppFileInfo::BAppFileInfo(BFile *file)
: fResources(NULL),
fWhere(B_USE_BOTH_LOCATIONS)
{
}
// destructor
/*! \brief Frees all resources associated with this object.
The BFile the object is set to is not deleted.
*/
BAppFileInfo::~BAppFileInfo()
{
}
// SetTo
/*! \brief Initializes the BAppFileInfo to the supplied file.
The caller retains ownership of the supplied BFile object. It must not
be deleted during the life time of the BAppFileInfo. It is not deleted
when the BAppFileInfo is destroyed.
\param file The file the object shall be initialized to.
\return
- \c B_OK: Everything went fine.
- \c B_BAD_VALUE: \c NULL \a file or \a file is not properly initialized.
*/
status_t
BAppFileInfo::SetTo(BFile *file)
{
return NOT_IMPLEMENTED;
}
// GetType
/*! \brief Gets the file's MIME type.
\param type A pointer to a pre-allocated character buffer of size
\c B_MIME_TYPE_LENGTH or larger into which the MIME type of the
file shall be written.
\return
- \c B_OK: Everything went fine.
- \c B_NO_INIT: The object is not properly initialized.
- \c B_BAD_VALUE: \c NULL \a type or the type string stored in the
attribute/resources is longer than \c B_MIME_TYPE_LENGTH.
- \c B_BAD_TYPE: The attribute/resources the type string is stored in have
the wrong type.
- \c B_ENTRY_NOT_FOUND: No type is set on the file.
- other error codes
*/
status_t
BAppFileInfo::GetType(char *type) const
{
return NOT_IMPLEMENTED;
}
// SetType
/*! \brief Sets the file's MIME type.
If \a type is \c NULL the file's MIME type is unset.
\param type The MIME type to be assigned to the file. Must not be longer
than \c B_MIME_TYPE_LENGTH (including the terminating null).
May be \c NULL.
\return
- \c B_OK: Everything went fine.
- \c B_NO_INIT: The object is not properly initialized.
- \c B_BAD_VALUE: \a type is longer than \c B_MIME_TYPE_LENGTH.
- other error codes
*/
status_t
BAppFileInfo::SetType(const char *type)
{
return NOT_IMPLEMENTED;
}
// GetSignature
/*! \brief Gets the file's application signature.
\param signature A pointer to a pre-allocated character buffer of size
\c B_MIME_TYPE_LENGTH or larger into which the application
signature of the file shall be written.
\return
- \c B_OK: Everything went fine.
- \c B_NO_INIT: The object is not properly initialized.
- \c B_BAD_VALUE: \c NULL \a signature or the signature stored in the
attribute/resources is longer than \c B_MIME_TYPE_LENGTH.
- \c B_BAD_TYPE: The attribute/resources the signature is stored in have
the wrong type.
- \c B_ENTRY_NOT_FOUND: No signature is set on the file.
- other error codes
*/
status_t
BAppFileInfo::GetSignature(char *signature) const
{
return NOT_IMPLEMENTED;
}
// SetSignature
/*! \brief Sets the file's application signature.
If \a signature is \c NULL the file's application signature is unset.
\param signature The application signature to be assigned to the file.
Must not be longer than \c B_MIME_TYPE_LENGTH (including the
terminating null). May be \c NULL.
\return
- \c B_OK: Everything went fine.
- \c B_NO_INIT: The object is not properly initialized.
- \c B_BAD_VALUE: \a signature is longer than \c B_MIME_TYPE_LENGTH.
- other error codes
*/
status_t
BAppFileInfo::SetSignature(const char *signature)
{
return NOT_IMPLEMENTED;
}
// GetAppFlags
/*! \brief Gets the file's application flags.
\param flags A pointer to a pre-allocated uint32 into which the application
flags of the file shall be written.
\return
- \c B_OK: Everything went fine.
- \c B_NO_INIT: The object is not properly initialized.
- \c B_BAD_VALUE: \c NULL \a flags.
- \c B_BAD_TYPE: The attribute/resources the flags are stored in have
the wrong type.
- \c B_ENTRY_NOT_FOUND: No application flags are set on the file.
- other error codes
*/
status_t
BAppFileInfo::GetAppFlags(uint32 *flags) const
{
return NOT_IMPLEMENTED;
}
// SetAppFlags
/*! \brief Sets the file's application flags.
\param flags The application flags to be assigned to the file.
\return
- \c B_OK: Everything went fine.
- \c B_NO_INIT: The object is not properly initialized.
- other error codes
*/
status_t
BAppFileInfo::SetAppFlags(uint32 flags)
{
return NOT_IMPLEMENTED;
}
// GetSupportedTypes
/*! \brief Gets the MIME types supported by the application.
The supported MIME types are added to a field "types" of type
\c B_STRING_TYPE in \a types.
\param types A pointer to a pre-allocated BMessage into which the
MIME types supported by the appplication shall be written.
\return
- \c B_OK: Everything went fine.
- \c B_NO_INIT: The object is not properly initialized.
- \c B_BAD_VALUE: \c NULL \a types.
- \c B_BAD_TYPE: The attribute/resources the supported types are stored in
have the wrong type.
- \c B_ENTRY_NOT_FOUND: No supported types are set on the file.
- other error codes
*/
status_t
BAppFileInfo::GetSupportedTypes(BMessage *types) const
{
return NOT_IMPLEMENTED;
}
// SetSupportedTypes
/*! \brief Sets the MIME types supported by the application.
If \a types is \c NULL the application's supported types are unset.
The supported MIME types must be stored in a field "types" of type
\c B_STRING_TYPE in \a types.
\param types The supported types to be assigned to the file.
May be \c NULL.
\param syncAll ???
\return
- \c B_OK: Everything went fine.
- \c B_NO_INIT: The object is not properly initialized.
- other error codes
\todo What does \a syncAll mean?
*/
status_t
BAppFileInfo::SetSupportedTypes(const BMessage *types, bool syncAll)
{
return NOT_IMPLEMENTED;
}
// SetSupportedTypes
/*! \brief Sets the MIME types supported by the application.
If \a types is \c NULL the application's supported types are unset.
The supported MIME types must be stored in a field "types" of type
\c B_STRING_TYPE in \a types.
\param types The supported types to be assigned to the file.
May be \c NULL.
\return
- \c B_OK: Everything went fine.
- \c B_NO_INIT: The object is not properly initialized.
- other error codes
*/
status_t
BAppFileInfo::SetSupportedTypes(const BMessage *types)
{
return NOT_IMPLEMENTED;
}
// IsSupportedType
/*! \brief Returns whether the application supports the supplied MIME type.
If the application supports the wildcard type "application/octet-stream"
any this method returns \c true for any MIME type.
\param type The MIME type in question.
\return \c true, if \a type is a valid MIME type and it is supported by
the application, \c false otherwise.
*/
bool
BAppFileInfo::IsSupportedType(const char *type) const
{
return false; // not implemented
}
// Supports
/*! \brief Returns whether the application supports the supplied MIME type
explicitly.
Unlike IsSupportedType(), this method returns \c true, only if the type
is explicitly supported, regardless of whether it supports
"application/octet-stream".
\param type The MIME type in question.
\return \c true, if \a type is a valid MIME type and it is explicitly
supported by the application, \c false otherwise.
*/
bool
BAppFileInfo::Supports(BMimeType *type) const
{
return false; // not implemented
}
// GetIcon
/*! \brief Gets the file's icon.
\param icon A pointer to a pre-allocated BBitmap of the correct dimension
to store the requested icon (16x16 for the mini and 32x32 for the
large icon).
\param which Specifies the size of the icon to be retrieved:
\c B_MINI_ICON for the mini and \c B_LARGE_ICON for the large icon.
\return
- \c B_OK: Everything went fine.
- \c B_NO_INIT: The object is not properly initialized.
- \c B_BAD_VALUE: \c NULL \a icon, unsupported icon size \a which or bitmap
dimensions (\a icon) and icon size (\a which) do not match.
- other error codes
*/
status_t
BAppFileInfo::GetIcon(BBitmap *icon, icon_size which) const
{
return NOT_IMPLEMENTED;
}
// SetIcon
/*! \brief Sets the file's icon.
If \a icon is \c NULL the file's icon is unset.
\param icon A pointer to the BBitmap containing the icon to be set.
May be \c NULL.
\param which Specifies the size of the icon to be set: \c B_MINI_ICON
for the mini and \c B_LARGE_ICON for the large icon.
\return
- \c B_OK: Everything went fine.
- \c B_NO_INIT: The object is not properly initialized.
- \c B_BAD_VALUE: Unknown icon size \a which or bitmap dimensions (\a icon)
and icon size (\a which) do not match.
- other error codes
*/
status_t
BAppFileInfo::SetIcon(const BBitmap *icon, icon_size which)
{
return NOT_IMPLEMENTED;
}
// GetVersionInfo
/*! \brief Gets the file's version info.
\param info A pointer to a pre-allocated version_info structure into which
the version info should be written.
\param kind Specifies the kind of the version info to be retrieved:
\c B_APP_VERSION_KIND for the application's version info and
\c B_SYSTEM_VERSION_KIND for the suite's info the application
belongs to.
\return
- \c B_OK: Everything went fine.
- \c B_NO_INIT: The object is not properly initialized.
- \c B_BAD_VALUE: \c NULL \a info.
- other error codes
*/
status_t
BAppFileInfo::GetVersionInfo(version_info *info, version_kind kind) const
{
return NOT_IMPLEMENTED;
}
// SetVersionInfo
/*! \brief Sets the file's version info.
If \a info is \c NULL the file's version info is unset.
\param info The version info to be set. May be \c NULL.
\param kind Specifies kind of version info to be set:
\c B_APP_VERSION_KIND for the application's version info and
\c B_SYSTEM_VERSION_KIND for the suite's info the application
belongs to.
\return
- \c B_OK: Everything went fine.
- \c B_NO_INIT: The object is not properly initialized.
- other error codes
*/
status_t
BAppFileInfo::SetVersionInfo(const version_info *info, version_kind kind)
{
return NOT_IMPLEMENTED;
}
// GetIconForType
/*! \brief Gets the icon the application provides for a given MIME type.
\param type The MIME type in question.
\param icon A pointer to a pre-allocated BBitmap of the correct dimension
to store the requested icon (16x16 for the mini and 32x32 for the
large icon).
\param which Specifies the size of the icon to be retrieved:
\c B_MINI_ICON for the mini and \c B_LARGE_ICON for the large icon.
\return
- \c B_OK: Everything went fine.
- \c B_NO_INIT: The object is not properly initialized.
- \c B_BAD_VALUE: \c NULL \a type or \a icon, unsupported icon size
\a which or bitmap dimensions (\a icon) and icon size (\a which) do
not match.
- other error codes
*/
status_t
BAppFileInfo::GetIconForType(const char *type, BBitmap *icon,
icon_size which) const
{
return NOT_IMPLEMENTED;
}
// SetIconForType
/*! \brief Sets the icon the application provides for a given MIME type.
If \a icon is \c NULL the icon is unset.
\param type The MIME type in question.
\param icon A pointer to the BBitmap containing the icon to be set.
May be \c NULL.
\param which Specifies the size of the icon to be set: \c B_MINI_ICON
for the mini and \c B_LARGE_ICON for the large icon.
\return
- \c B_OK: Everything went fine.
- \c B_NO_INIT: The object is not properly initialized.
- \c B_BAD_VALUE: Unknown icon size \a which or bitmap dimensions (\a icon)
and icon size (\a which) do not match.
- other error codes
*/
status_t
BAppFileInfo::SetIconForType(const char *type, const BBitmap *icon,
icon_size which)
{
return NOT_IMPLEMENTED;
}
// SetInfoLocation
/*! \brief Specifies the location where the meta data shall be stored.
The options for \a location are:
- \c B_USE_ATTRIBUTES: Store the data in the attributes.
- \c B_USE_RESOURCES: Store the data in the resources.
- \c B_USE_BOTH_LOCATIONS: Store the data in attributes and resources.
\param location The location where the meta data shall be stored.
*/
void
BAppFileInfo::SetInfoLocation(info_location location)
{
}
// IsUsingAttributes
/*! \brief Returns whether the object stores the meta data (also) in the
file's attributes.
\return \c true, if the meta data are (also) stored in the file's
attributes, \c false otherwise.
*/
bool
BAppFileInfo::IsUsingAttributes() const
{
return false; // not implemented
}
// IsUsingResources
/*! \brief Returns whether the object stores the meta data (also) in the
file's resources.
\return \c true, if the meta data are (also) stored in the file's
resources, \c false otherwise.
*/
bool
BAppFileInfo::IsUsingResources() const
{
return false; // not implemented
}
// FBC
void BAppFileInfo::_ReservedAppFileInfo1() {}
void BAppFileInfo::_ReservedAppFileInfo2() {}
void BAppFileInfo::_ReservedAppFileInfo3() {}
// =
/*! \brief Privatized assignment operator to prevent usage.
*/
BAppFileInfo &
BAppFileInfo::operator=(const BAppFileInfo &)
{
return *this;
}
// copy constructor
/*! \brief Privatized copy constructor to prevent usage.
*/
BAppFileInfo::BAppFileInfo(const BAppFileInfo &)
{
}