Style fixes to Storage Kit classes.

No functional changes intended.

* Some variable renaming for clarity and consistency.
* Pointer style fixes.
* Added private method documentation back to cpp files for some methods.
This commit is contained in:
John Scipione
2014-06-18 19:14:19 -04:00
parent d2d1af830b
commit a30a4a41f9
21 changed files with 1832 additions and 1295 deletions
+3 -3
View File
@@ -20,7 +20,7 @@ typedef enum {
B_SYSTEM_BOOT_DIRECTORY,
B_SYSTEM_FONTS_DIRECTORY,
B_SYSTEM_LIB_DIRECTORY,
B_SYSTEM_SERVERS_DIRECTORY,
B_SYSTEM_SERVERS_DIRECTORY,
B_SYSTEM_APPS_DIRECTORY,
B_SYSTEM_BIN_DIRECTORY,
B_SYSTEM_DOCUMENTATION_DIRECTORY = 1010,
@@ -86,7 +86,7 @@ typedef enum {
B_USER_NONPACKAGED_DEVELOP_DIRECTORY,
B_USER_DEVELOP_DIRECTORY,
B_USER_DOCUMENTATION_DIRECTORY,
B_USER_SERVERS_DIRECTORY,
B_USER_SERVERS_DIRECTORY,
B_USER_APPS_DIRECTORY,
B_USER_BIN_DIRECTORY,
B_USER_PREFERENCES_DIRECTORY,
@@ -108,7 +108,7 @@ typedef enum {
B_BEOS_BOOT_DIRECTORY,
B_BEOS_FONTS_DIRECTORY,
B_BEOS_LIB_DIRECTORY,
B_BEOS_SERVERS_DIRECTORY,
B_BEOS_SERVERS_DIRECTORY,
B_BEOS_APPS_DIRECTORY,
B_BEOS_BIN_DIRECTORY,
B_BEOS_ETC_DIRECTORY,
+95 -93
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2006, Haiku, Inc. All Rights Reserved.
* Copyright 2002-2006 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _MIME_TYPE_H
@@ -14,6 +14,7 @@
#include <File.h>
#include <Entry.h>
class BBitmap;
class BResources;
class BAppFileInfo;
@@ -32,12 +33,12 @@ enum app_verb {
B_OPEN
};
extern const char *B_APP_MIME_TYPE; // platform dependent
extern const char *B_PEF_APP_MIME_TYPE; // "application/x-be-executable"
extern const char *B_PE_APP_MIME_TYPE; // "application/x-vnd.be-peexecutable"
extern const char *B_ELF_APP_MIME_TYPE; // "application/x-vnd.be-elfexecutable"
extern const char *B_RESOURCE_MIME_TYPE;// "application/x-be-resource"
extern const char *B_FILE_MIME_TYPE; // "application/octet-stream"
extern const char* B_APP_MIME_TYPE; // platform dependent
extern const char* B_PEF_APP_MIME_TYPE; // "application/x-be-executable"
extern const char* B_PE_APP_MIME_TYPE; // "application/x-vnd.be-peexecutable"
extern const char* B_ELF_APP_MIME_TYPE; // "application/x-vnd.be-elfexecutable"
extern const char* B_RESOURCE_MIME_TYPE;// "application/x-be-resource"
extern const char* B_FILE_MIME_TYPE; // "application/octet-stream"
/* ------------------------------------------------------------- */
@@ -71,113 +72,114 @@ enum {
};
class BMimeType {
public:
BMimeType();
BMimeType(const char *mimeType);
virtual ~BMimeType();
public:
BMimeType();
BMimeType(const char* mimeType);
virtual ~BMimeType();
status_t SetTo(const char *mimeType);
void Unset();
status_t InitCheck() const;
status_t SetTo(const char* mimeType);
void Unset();
status_t InitCheck() const;
/* these functions simply perform string manipulations*/
const char *Type() const;
bool IsValid() const;
bool IsSupertypeOnly() const;
status_t GetSupertype(BMimeType *superType) const;
/* these functions simply perform string manipulations*/
const char* Type() const;
bool IsValid() const;
bool IsSupertypeOnly() const;
status_t GetSupertype(BMimeType* supertype) const;
bool operator==(const BMimeType &type) const;
bool operator==(const char *type) const;
bool operator==(const BMimeType &type) const;
bool operator==(const char* type) const;
bool Contains(const BMimeType *type) const;
bool Contains(const BMimeType* type) const;
/* These functions are for managing data in the meta mime file */
status_t Install();
status_t Delete();
bool IsInstalled() const;
status_t GetIcon(BBitmap* icon, icon_size size) const;
status_t GetIcon(uint8** _data, size_t* _size) const;
status_t GetPreferredApp(char *signature, app_verb verb = B_OPEN) const;
status_t GetAttrInfo(BMessage *info) const;
status_t GetFileExtensions(BMessage *extensions) const;
status_t GetShortDescription(char *description) const;
status_t GetLongDescription(char *description) const;
status_t GetSupportingApps(BMessage *signatures) const;
/* These functions are for managing data in the meta mime file */
status_t Install();
status_t Delete();
bool IsInstalled() const;
status_t GetIcon(BBitmap* icon, icon_size size) const;
status_t GetIcon(uint8** _data, size_t* _size) const;
status_t GetPreferredApp(char* signature, app_verb verb = B_OPEN) const;
status_t GetAttrInfo(BMessage* info) const;
status_t GetFileExtensions(BMessage* extensions) const;
status_t GetShortDescription(char* description) const;
status_t GetLongDescription(char* description) const;
status_t GetSupportingApps(BMessage* signatures) const;
status_t SetIcon(const BBitmap *icon, icon_size size);
status_t SetIcon(const uint8* data, size_t size);
status_t SetPreferredApp(const char *signature, app_verb verb = B_OPEN);
status_t SetAttrInfo(const BMessage *info);
status_t SetFileExtensions(const BMessage *extensions);
status_t SetShortDescription(const char *description);
status_t SetLongDescription(const char *description);
status_t SetIcon(const BBitmap* icon, icon_size size);
status_t SetIcon(const uint8* data, size_t size);
status_t SetPreferredApp(const char* signature, app_verb verb = B_OPEN);
status_t SetAttrInfo(const BMessage* info);
status_t SetFileExtensions(const BMessage* extensions);
status_t SetShortDescription(const char* description);
status_t SetLongDescription(const char* description);
static status_t GetInstalledSupertypes(BMessage *supertypes);
static status_t GetInstalledTypes(BMessage *types);
static status_t GetInstalledTypes(const char* supertype,
BMessage* subtypes);
static status_t GetWildcardApps(BMessage* wildcardApps);
static bool IsValid(const char *mimeType);
static status_t GetInstalledSupertypes(BMessage* supertypes);
static status_t GetInstalledTypes(BMessage* types);
static status_t GetInstalledTypes(const char* supertype,
BMessage* subtypes);
static status_t GetWildcardApps(BMessage* wildcardApps);
static bool IsValid(const char* mimeType);
status_t GetAppHint(entry_ref *ref) const;
status_t SetAppHint(const entry_ref *ref);
status_t GetAppHint(entry_ref* ref) const;
status_t SetAppHint(const entry_ref* ref);
/* for application signatures only. */
status_t GetIconForType(const char* type, BBitmap* icon,
icon_size which) const;
status_t GetIconForType(const char* type, uint8** _data,
size_t* _size) const;
status_t SetIconForType(const char* type, const BBitmap* icon,
icon_size which);
status_t SetIconForType(const char* type, const uint8* data,
size_t size);
/* for application signatures only. */
status_t GetIconForType(const char* type, BBitmap* icon,
icon_size which) const;
status_t GetIconForType(const char* type, uint8** _data,
size_t* _size) const;
status_t SetIconForType(const char* type, const BBitmap* icon,
icon_size which);
status_t SetIconForType(const char* type, const uint8* data,
size_t size);
/* sniffer rule manipulation */
status_t GetSnifferRule(BString *result) const;
status_t SetSnifferRule(const char *);
static status_t CheckSnifferRule(const char *rule, BString *parseError);
/* sniffer rule manipulation */
status_t GetSnifferRule(BString* result) const;
status_t SetSnifferRule(const char*);
static status_t CheckSnifferRule(const char* rule, BString* parseError);
/* calls to ask the sniffer to identify the MIME type of a file or data in
memory */
static status_t GuessMimeType(const entry_ref *file, BMimeType *type);
static status_t GuessMimeType(const void *buffer, int32 length,
BMimeType *type);
static status_t GuessMimeType(const char *filename, BMimeType *type);
/* calls to ask the sniffer to identify the MIME type of a file or data in
memory */
static status_t GuessMimeType(const entry_ref* file, BMimeType* type);
static status_t GuessMimeType(const void* buffer, int32 length,
BMimeType* type);
static status_t GuessMimeType(const char* filename, BMimeType* type);
static status_t StartWatching(BMessenger target);
static status_t StopWatching(BMessenger target);
static status_t StartWatching(BMessenger target);
static status_t StopWatching(BMessenger target);
/* Deprecated. Use SetTo() instead. */
status_t SetType(const char *mimeType);
/* Deprecated. Use SetTo() instead. */
status_t SetType(const char* mimeType);
private:
BMimeType(const char* mimeType, const char* mimePath);
// if mimePath is NULL, defaults to "/boot/home/config/settings/beos_mime/"
private:
BMimeType(const char* mimeType, const char* mimePath);
// if mimePath is NULL, defaults to "/boot/home/config/settings/beos_mime/"
friend class MimeTypeTest;
// for testing only
friend class MimeTypeTest;
// for testing only
friend class BAppFileInfo;
friend class BAppFileInfo;
virtual void _ReservedMimeType1();
virtual void _ReservedMimeType2();
virtual void _ReservedMimeType3();
virtual void _ReservedMimeType1();
virtual void _ReservedMimeType2();
virtual void _ReservedMimeType3();
BMimeType& operator=(const BMimeType& source);
BMimeType(const BMimeType& source);
BMimeType& operator=(const BMimeType& source);
BMimeType(const BMimeType& source);
status_t GetSupportedTypes(BMessage* types);
status_t SetSupportedTypes(const BMessage* types, bool fullSync = true);
status_t GetSupportedTypes(BMessage* types);
status_t SetSupportedTypes(const BMessage* types, bool fullSync = true);
static status_t GetAssociatedTypes(const char* extension, BMessage* types);
static status_t GetAssociatedTypes(const char* extension, BMessage* types);
private:
char* fType;
BFile* fMeta;
void* _unused;
entry_ref fRef;
status_t fCStatus;
uint32 _reserved[4];
private:
char* fType;
BFile* fMeta;
void* _unused;
entry_ref fRef;
status_t fCStatus;
uint32 _reserved[4];
};
#endif // _MIME_TYPE_H
+13 -9
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011, Haiku, Inc. All Rights Reserved.
* Copyright 2002-2011 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _NODE_H
@@ -18,12 +18,12 @@ struct entry_ref;
struct node_ref {
node_ref();
node_ref(dev_t device, ino_t node);
node_ref(const node_ref &ref);
node_ref(const node_ref &other);
bool operator==(const node_ref& ref) const;
bool operator!=(const node_ref& ref) const;
bool operator<(const node_ref& ref) const;
node_ref& operator=(const node_ref& ref);
bool operator==(const node_ref& other) const;
bool operator!=(const node_ref& other) const;
bool operator<(const node_ref& other) const;
node_ref& operator=(const node_ref& other);
dev_t device;
ino_t node;
@@ -100,17 +100,21 @@ private:
status_t _SetTo(int fd, const char* path, bool traverse);
status_t _SetTo(const entry_ref* ref, bool traverse);
virtual status_t set_stat(struct stat& st, uint32 what);
virtual status_t set_stat(struct stat& stat, uint32 what);
status_t _GetStat(struct stat* st) const;
virtual status_t _GetStat(struct stat_beos* st) const;
status_t _GetStat(struct stat* stat) const;
virtual status_t _GetStat(struct stat_beos* stat) const;
status_t InitAttrDir();
private:
uint32 rudeData[4];
int fFd;
// Ffile descriptor for the given node
int fAttrFd;
// file descriptor for the attribute directory of the node,
// initialized lazily
status_t fCStatus;
// the node's initialization status
};
+5 -5
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010, Haiku, Inc. All Rights Reserved.
* Copyright 2002-2010 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _NODE_INFO_H
@@ -31,9 +31,9 @@ public:
virtual status_t GetType(char* type) const;
virtual status_t SetType(const char* type);
virtual status_t GetIcon(BBitmap* icon,
icon_size size = B_LARGE_ICON) const;
icon_size which = B_LARGE_ICON) const;
virtual status_t SetIcon(const BBitmap* icon,
icon_size size = B_LARGE_ICON);
icon_size which = B_LARGE_ICON);
status_t GetIcon(uint8** data, size_t* size,
type_code* type) const;
status_t SetIcon(const uint8* data, size_t size);
@@ -46,10 +46,10 @@ public:
status_t SetAppHint(const entry_ref* ref);
status_t GetTrackerIcon(BBitmap* icon,
icon_size size = B_LARGE_ICON) const;
icon_size which = B_LARGE_ICON) const;
static status_t GetTrackerIcon(const entry_ref* ref,
BBitmap* icon,
icon_size size = B_LARGE_ICON);
icon_size which = B_LARGE_ICON);
private:
friend class BAppFileInfo;
+24 -17
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2010, Haiku Inc. All Rights Reserved.
* Copyright 2003-2010 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _NODE_MONITOR_H
@@ -32,25 +32,31 @@ enum {
// The presence and meaning of the other fields in that message specifying what
// exactly caused the notification depend on this value.
#define B_ENTRY_CREATED 1
#define B_ENTRY_REMOVED 2
#define B_ENTRY_MOVED 3
#define B_STAT_CHANGED 4
#define B_ATTR_CHANGED 5
#define B_DEVICE_MOUNTED 6
#define B_DEVICE_UNMOUNTED 7
enum {
B_ENTRY_CREATED = 1,
B_ENTRY_REMOVED,
B_ENTRY_MOVED,
B_STAT_CHANGED,
B_ATTR_CHANGED,
B_DEVICE_MOUNTED,
B_DEVICE_UNMOUNTED
};
// More specific info in the "cause" field of B_ATTR_CHANGED notification
// messages. (Haiku only)
#define B_ATTR_CREATED 1
#define B_ATTR_REMOVED 2
// B_ATTR_CHANGED is reused
enum {
B_ATTR_CREATED = 1,
B_ATTR_REMOVED,
// B_ATTR_CHANGED
};
// More specific info in the "fields" field of B_STAT_CHANGED notification
// messages, specifying what parts of the stat data have actually been
// changed. (Haiku only)
enum {
B_STAT_MODE = 0x0001,
B_STAT_UID = 0x0002,
@@ -82,16 +88,17 @@ class BHandler;
extern status_t watch_volume(dev_t volume, uint32 flags, BMessenger target);
extern status_t watch_volume(dev_t volume, uint32 flags,
const BHandler *handler, const BLooper *looper = NULL);
const BHandler* handler, const BLooper* looper = NULL);
extern status_t watch_node(const node_ref *node, uint32 flags,
BMessenger target);
extern status_t watch_node(const node_ref *node, uint32 flags,
const BHandler *handler, const BLooper *looper = NULL);
extern status_t watch_node(const node_ref* node, uint32 flags,
BMessenger target);
extern status_t watch_node(const node_ref* node, uint32 flags,
const BHandler* handler, const BLooper* looper = NULL);
extern status_t stop_watching(BMessenger target);
extern status_t stop_watching(const BHandler *handler, const BLooper *looper = NULL);
extern status_t stop_watching(const BHandler* handler, const BLooper* looper = NULL);
#endif // __cplusplus && !_KERNEL_MODE
#endif // _NODE_MONITOR_H
+33 -33
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009, Haiku, Inc. All Rights Reserved.
* Copyright 2002-2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _STATABLE_H
@@ -18,58 +18,58 @@ class BVolume;
class BStatable {
public:
public:
#if __GNUC__ > 3
virtual ~BStatable();
virtual ~BStatable();
#endif
private:
virtual status_t _GetStat(struct stat_beos *st) const = 0;
// provided for BeOS compatibility
virtual status_t _GetStat(struct stat_beos* stat) const = 0;
// provided for BeOS compatibility
public:
virtual status_t GetStat(struct stat *st) const = 0;
virtual status_t GetStat(struct stat* stat) const = 0;
bool IsFile() const;
bool IsDirectory() const;
bool IsSymLink() const;
bool IsFile() const;
bool IsDirectory() const;
bool IsSymLink() const;
status_t GetNodeRef(node_ref *ref) const;
status_t GetNodeRef(node_ref* ref) const;
status_t GetOwner(uid_t *owner) const;
status_t SetOwner(uid_t owner);
status_t GetOwner(uid_t* owner) const;
status_t SetOwner(uid_t owner);
status_t GetGroup(gid_t *group) const;
status_t SetGroup(gid_t group);
status_t GetGroup(gid_t* group) const;
status_t SetGroup(gid_t group);
status_t GetPermissions(mode_t *perms) const;
status_t SetPermissions(mode_t perms);
status_t GetPermissions(mode_t* permissions) const;
status_t SetPermissions(mode_t permissions);
status_t GetSize(off_t *size) const;
status_t GetSize(off_t* size) const;
status_t GetModificationTime(time_t *mtime) const;
status_t SetModificationTime(time_t mtime);
status_t GetModificationTime(time_t* mtime) const;
status_t SetModificationTime(time_t mtime);
status_t GetCreationTime(time_t *ctime) const;
status_t SetCreationTime(time_t ctime);
status_t GetCreationTime(time_t* ctime) const;
status_t SetCreationTime(time_t ctime);
status_t GetAccessTime(time_t *atime) const;
status_t SetAccessTime(time_t atime);
status_t GetAccessTime(time_t* atime) const;
status_t SetAccessTime(time_t atime);
status_t GetVolume(BVolume *vol) const;
status_t GetVolume(BVolume* volume) const;
class Private;
class Private;
private:
friend class BEntry;
friend class BNode;
friend class Private;
private:
friend class BEntry;
friend class BNode;
friend class Private;
virtual void _OhSoStatable2();
virtual void _OhSoStatable3();
uint32 _reserved[4];
virtual void _OhSoStatable2();
virtual void _OhSoStatable3();
uint32 _reserved[4];
virtual status_t set_stat(struct stat &st, uint32 what) = 0;
virtual status_t set_stat(struct stat &st, uint32 what) = 0;
};
#endif // _STATABLE_H
+12 -12
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007, Haiku, Inc. All Rights Reserved.
* Copyright 2002-2007 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SYM_LINK_H
@@ -16,20 +16,20 @@ class BPath;
class BSymLink : public BNode {
public:
BSymLink();
BSymLink(const BSymLink &link);
BSymLink(const entry_ref *ref);
BSymLink(const BEntry *entry);
BSymLink(const char *path);
BSymLink(const BDirectory *dir,
const char *path);
BSymLink(const BSymLink& other);
BSymLink(const entry_ref* ref);
BSymLink(const BEntry* entry);
BSymLink(const char* path);
BSymLink(const BDirectory* dir,
const char* path);
virtual ~BSymLink();
ssize_t ReadLink(char *buf, size_t size);
ssize_t ReadLink(char* buf, size_t size);
ssize_t MakeLinkedPath(const char *dirPath,
BPath *path);
ssize_t MakeLinkedPath(const BDirectory *dir,
BPath *path);
ssize_t MakeLinkedPath(const char* dirPath,
BPath* path);
ssize_t MakeLinkedPath(const BDirectory* dir,
BPath* path);
bool IsAbsolute();