Merged changes from branch build_system_redesign at revision 14573.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14574 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
/***************************************************************************
|
||||
//
|
||||
// File: Alias.h
|
||||
//
|
||||
// Description: path->alias->path functions
|
||||
//
|
||||
// Copyright 1992-98, Be Incorporated, All Rights Reserved.
|
||||
//
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _ALIAS_H
|
||||
#define _ALIAS_H
|
||||
|
||||
#ifndef _BE_BUILD_H
|
||||
#include <BeBuild.h>
|
||||
#endif
|
||||
#include <SupportDefs.h>
|
||||
|
||||
class BPath;
|
||||
class BDataIO;
|
||||
|
||||
_IMPEXP_BE status_t resolve_link(const char *path, BPath *result,
|
||||
bool block = false);
|
||||
_IMPEXP_BE status_t write_alias(const char *path, BDataIO *s,
|
||||
size_t *len = NULL);
|
||||
_IMPEXP_BE status_t write_alias(const char *path, void *buf, size_t *len);
|
||||
|
||||
_IMPEXP_BE status_t read_alias(BDataIO *s, BPath *result, size_t *len = NULL,
|
||||
bool block = false);
|
||||
_IMPEXP_BE status_t read_alias(const void *buf, BPath *result, size_t *len,
|
||||
bool block = false);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,125 @@
|
||||
//----------------------------------------------------------------------
|
||||
// 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;
|
||||
|
||||
status_t _ReadData(const char *name, int32 id, type_code type,
|
||||
void *buffer, size_t bufferSize,
|
||||
size_t &bytesRead, void **allocatedBuffer = NULL) const;
|
||||
status_t _WriteData(const char *name, int32 id, type_code type,
|
||||
const void *buffer, size_t bufferSize,
|
||||
bool findID = false);
|
||||
status_t _RemoveData(const char *name, type_code type);
|
||||
|
||||
BResources *fResources;
|
||||
info_location fWhere;
|
||||
uint32 _reserved[2];
|
||||
};
|
||||
|
||||
#endif // _APP_FILE_INFO_H
|
||||
@@ -0,0 +1,115 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file Directory.h
|
||||
BDirectory interface declaration.
|
||||
*/
|
||||
|
||||
#ifndef _DIRECTORY_H
|
||||
#define _DIRECTORY_H
|
||||
|
||||
#include <Node.h>
|
||||
#include <EntryList.h>
|
||||
#include <StorageDefs.h>
|
||||
#include <StorageDefs.Private.h>
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif
|
||||
|
||||
class BSymLink;
|
||||
|
||||
/*!
|
||||
\class BDirectory
|
||||
\brief A directory in the filesystem
|
||||
|
||||
Provides an interface for manipulating directories and their contents.
|
||||
|
||||
\author <a href='mailto:[email protected]'>Ingo Weinhold</a>
|
||||
\author <a href="mailto:[email protected]">Tyler Dauwalder</a>
|
||||
|
||||
\version 0.0.0
|
||||
*/
|
||||
class BDirectory : public BNode, public BEntryList {
|
||||
public:
|
||||
BDirectory();
|
||||
BDirectory(const BDirectory &dir);
|
||||
BDirectory(const entry_ref *ref);
|
||||
BDirectory(const node_ref *nref);
|
||||
BDirectory(const BEntry *entry);
|
||||
BDirectory(const char *path);
|
||||
BDirectory(const BDirectory *dir, const char *path);
|
||||
|
||||
virtual ~BDirectory();
|
||||
|
||||
status_t SetTo(const entry_ref *ref);
|
||||
status_t SetTo(const node_ref *nref);
|
||||
status_t SetTo(const BEntry *entry);
|
||||
status_t SetTo(const char *path);
|
||||
status_t SetTo(const BDirectory *dir, const char *path);
|
||||
|
||||
status_t GetEntry(BEntry *entry) const;
|
||||
|
||||
status_t FindEntry(const char *path, BEntry *entry,
|
||||
bool traverse = false) const;
|
||||
|
||||
bool Contains(const char *path, int32 nodeFlags = B_ANY_NODE) const;
|
||||
bool Contains(const BEntry *entry, int32 nodeFlags = B_ANY_NODE) const;
|
||||
|
||||
status_t GetStatFor(const char *path, struct stat *st) const;
|
||||
|
||||
virtual status_t GetNextEntry(BEntry *entry, bool traverse = false);
|
||||
virtual status_t GetNextRef(entry_ref *ref);
|
||||
virtual int32 GetNextDirents(dirent *buf, size_t bufSize,
|
||||
int32 count = INT_MAX);
|
||||
virtual status_t Rewind();
|
||||
virtual int32 CountEntries();
|
||||
|
||||
status_t CreateDirectory(const char *path, BDirectory *dir);
|
||||
status_t CreateFile(const char *path, BFile *file,
|
||||
bool failIfExists = false);
|
||||
status_t CreateSymLink(const char *path, const char *linkToPath,
|
||||
BSymLink *link);
|
||||
|
||||
BDirectory &operator=(const BDirectory &dir);
|
||||
|
||||
private:
|
||||
friend class BNode;
|
||||
|
||||
virtual void _ErectorDirectory1();
|
||||
virtual void _ErectorDirectory2();
|
||||
virtual void _ErectorDirectory3();
|
||||
virtual void _ErectorDirectory4();
|
||||
virtual void _ErectorDirectory5();
|
||||
virtual void _ErectorDirectory6();
|
||||
|
||||
private:
|
||||
virtual void close_fd();
|
||||
int get_fd() const;
|
||||
|
||||
status_t set_dir_fd(int fd);
|
||||
|
||||
private:
|
||||
uint32 _reservedData[7];
|
||||
int fDirFd;
|
||||
node_ref fDirNodeRef;
|
||||
|
||||
friend class BEntry;
|
||||
friend class BFile;
|
||||
};
|
||||
|
||||
|
||||
// C functions
|
||||
|
||||
status_t create_directory(const char *path, mode_t mode);
|
||||
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}; // namespace OpenBeOS
|
||||
#endif
|
||||
|
||||
#endif // _DIRECTORY_H
|
||||
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file Entry.h
|
||||
BEntry and entry_ref interface declarations.
|
||||
*/
|
||||
#ifndef _ENTRY_H
|
||||
#define _ENTRY_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include <Statable.h>
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif
|
||||
|
||||
class BDirectory;
|
||||
class BPath;
|
||||
|
||||
struct entry_ref {
|
||||
entry_ref();
|
||||
entry_ref(dev_t dev, ino_t dir, const char *name);
|
||||
entry_ref(const entry_ref &ref);
|
||||
~entry_ref();
|
||||
|
||||
status_t set_name(const char *name);
|
||||
|
||||
bool operator==(const entry_ref &ref) const;
|
||||
bool operator!=(const entry_ref &ref) const;
|
||||
entry_ref &operator=(const entry_ref &ref);
|
||||
|
||||
dev_t device;
|
||||
ino_t directory;
|
||||
char *name;
|
||||
};
|
||||
|
||||
class BEntry : public BStatable {
|
||||
public:
|
||||
BEntry();
|
||||
BEntry(const BDirectory *dir, const char *path, bool traverse = false);
|
||||
BEntry(const entry_ref *ref, bool traverse = false);
|
||||
BEntry(const char *path, bool traverse = false);
|
||||
BEntry(const BEntry &entry);
|
||||
virtual ~BEntry();
|
||||
|
||||
status_t InitCheck() const;
|
||||
bool Exists() const;
|
||||
|
||||
virtual status_t GetStat(struct stat *st) const;
|
||||
|
||||
status_t SetTo(const BDirectory *dir, const char *path,
|
||||
bool traverse = false);
|
||||
status_t SetTo(const entry_ref *ref, bool traverse = false);
|
||||
status_t SetTo(const char *path, bool traverse = false);
|
||||
void Unset();
|
||||
|
||||
status_t GetRef(entry_ref *ref) const;
|
||||
status_t GetPath(BPath *path) const;
|
||||
status_t GetParent(BEntry *entry) const;
|
||||
status_t GetParent(BDirectory *dir) const;
|
||||
status_t GetName(char *buffer) const;
|
||||
|
||||
status_t Rename(const char *path, bool clobber = false);
|
||||
status_t MoveTo(BDirectory *dir, const char *path = NULL,
|
||||
bool clobber = false);
|
||||
status_t Remove();
|
||||
|
||||
bool operator==(const BEntry &item) const;
|
||||
bool operator!=(const BEntry &item) const;
|
||||
|
||||
BEntry &operator=(const BEntry &item);
|
||||
|
||||
private:
|
||||
friend class BDirectory;
|
||||
friend class BFile;
|
||||
friend class BNode;
|
||||
friend class BSymLink;
|
||||
|
||||
virtual void _PennyEntry1();
|
||||
virtual void _PennyEntry2();
|
||||
virtual void _PennyEntry3();
|
||||
virtual void _PennyEntry4();
|
||||
virtual void _PennyEntry5();
|
||||
virtual void _PennyEntry6();
|
||||
|
||||
/*! Currently unused. */
|
||||
uint32 _pennyData[4];
|
||||
|
||||
/*! BEntry implementation of BStatable::set_stat() */
|
||||
virtual status_t set_stat(struct stat &st, uint32 what);
|
||||
|
||||
status_t set(int dir, const char *path, bool traverse);
|
||||
|
||||
/*! File descriptor for the entry's parent directory. */
|
||||
int fDirFd;
|
||||
|
||||
/*! Leaf name of the entry. */
|
||||
char *fName;
|
||||
|
||||
/*! The object's initialization status. */
|
||||
status_t fCStatus;
|
||||
|
||||
status_t set_name(const char *name);
|
||||
|
||||
status_t _Rename(BEntry& target, bool clobber);
|
||||
|
||||
void Dump(const char *name = NULL);
|
||||
};
|
||||
|
||||
// C functions
|
||||
|
||||
status_t get_ref_for_path(const char *path, entry_ref *ref);
|
||||
bool operator<(const entry_ref &a, const entry_ref &b);
|
||||
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}; // namespace OpenBeOS
|
||||
#endif
|
||||
|
||||
#endif // _ENTRY_H
|
||||
@@ -0,0 +1,62 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file EntryList.h
|
||||
BEntryList interface declaration.
|
||||
*/
|
||||
|
||||
#ifndef _ENTRY_LIST_H
|
||||
#define _ENTRY_LIST_H
|
||||
|
||||
#include <dirent.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif
|
||||
|
||||
// Forward declarations
|
||||
class BEntry;
|
||||
struct entry_ref;
|
||||
|
||||
//! Interface for iterating through a list of filesystem entries
|
||||
/*! Defines a general interface for iterating through a list of entries (i.e.
|
||||
files in a folder
|
||||
|
||||
@author <a href='mailto:[email protected]'>Tyler Dauwalder</a>
|
||||
@author Be Inc.
|
||||
@version 0.0.0
|
||||
*/
|
||||
class BEntryList {
|
||||
public:
|
||||
BEntryList();
|
||||
virtual ~BEntryList();
|
||||
|
||||
virtual status_t GetNextEntry(BEntry *entry, bool traverse = false) = 0;
|
||||
virtual status_t GetNextRef(entry_ref *ref) = 0;
|
||||
virtual int32 GetNextDirents(struct dirent *buf, size_t length,
|
||||
int32 count = INT_MAX) = 0;
|
||||
virtual status_t Rewind() = 0;
|
||||
virtual int32 CountEntries() = 0;
|
||||
|
||||
private:
|
||||
virtual void _ReservedEntryList1();
|
||||
virtual void _ReservedEntryList2();
|
||||
virtual void _ReservedEntryList3();
|
||||
virtual void _ReservedEntryList4();
|
||||
virtual void _ReservedEntryList5();
|
||||
virtual void _ReservedEntryList6();
|
||||
virtual void _ReservedEntryList7();
|
||||
virtual void _ReservedEntryList8();
|
||||
|
||||
};
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}; // namespace OpenBeOS
|
||||
#endif
|
||||
|
||||
#endif // _ENTRY_LIST_H
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file File.h
|
||||
BFile interface declaration.
|
||||
*/
|
||||
#ifndef _FILE_H
|
||||
#define _FILE_H
|
||||
|
||||
#include <DataIO.h>
|
||||
#include <Node.h>
|
||||
#include <StorageDefs.Private.h>
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\class BFile
|
||||
\brief BFile is a wrapper class for common operations on files providing
|
||||
access to the file's content data and its attributes.
|
||||
|
||||
A BFile represents a file in some file system. It implements the
|
||||
BPositionIO interface and thus the methods to read from and write to the
|
||||
file, and is derived of BNode to provide access to the file's attributes.
|
||||
|
||||
\author <a href='mailto:[email protected]'>Ingo Weinhold</a>
|
||||
|
||||
\version 0.0.0
|
||||
*/
|
||||
class BFile : public BNode, public BPositionIO {
|
||||
public:
|
||||
BFile();
|
||||
BFile(const BFile &file);
|
||||
BFile(const entry_ref *ref, uint32 openMode);
|
||||
BFile(const BEntry *entry, uint32 openMode);
|
||||
BFile(const char *path, uint32 openMode);
|
||||
BFile(const BDirectory *dir, const char *path, uint32 openMode);
|
||||
virtual ~BFile();
|
||||
|
||||
status_t SetTo(const entry_ref *ref, uint32 openMode);
|
||||
status_t SetTo(const BEntry *entry, uint32 openMode);
|
||||
status_t SetTo(const char *path, uint32 openMode);
|
||||
status_t SetTo(const BDirectory *dir, const char *path, uint32 openMode);
|
||||
|
||||
bool IsReadable() const;
|
||||
bool IsWritable() const;
|
||||
|
||||
virtual ssize_t Read(void *buffer, size_t size);
|
||||
virtual ssize_t ReadAt(off_t location, void *buffer, size_t size);
|
||||
virtual ssize_t Write(const void *buffer, size_t size);
|
||||
virtual ssize_t WriteAt(off_t location, const void *buffer, size_t size);
|
||||
|
||||
virtual off_t Seek(off_t offset, uint32 seekMode);
|
||||
virtual off_t Position() const;
|
||||
|
||||
virtual status_t SetSize(off_t size);
|
||||
|
||||
BFile &operator=(const BFile &file);
|
||||
|
||||
private:
|
||||
virtual void _PhiloFile1();
|
||||
virtual void _PhiloFile2();
|
||||
virtual void _PhiloFile3();
|
||||
virtual void _PhiloFile4();
|
||||
virtual void _PhiloFile5();
|
||||
virtual void _PhiloFile6();
|
||||
|
||||
uint32 _reservedData[8];
|
||||
|
||||
private:
|
||||
int get_fd() const;
|
||||
virtual void close_fd();
|
||||
|
||||
private:
|
||||
//! The file's open mode.
|
||||
uint32 fMode;
|
||||
};
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}; // namespace OpenBeOS
|
||||
#endif
|
||||
|
||||
#endif // _FILE_H
|
||||
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: FilePanel.h
|
||||
/
|
||||
/ Description: BFilePanel and BRefFilter classes, and
|
||||
/ run_open_panel()/run_save_panel functions.
|
||||
/
|
||||
/ Copyright 1993-98, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _FILE_PANEL_H
|
||||
#define _FILE_PANEL_H
|
||||
|
||||
#ifndef _BE_BUILD_H
|
||||
#include <BeBuild.h>
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <Entry.h>
|
||||
#include <Directory.h>
|
||||
#include <Node.h>
|
||||
|
||||
|
||||
/*- Old fashioned, one-shot, heavily-defaulted panel functions. -*/
|
||||
|
||||
extern _IMPEXP_TRACKER void run_open_panel();
|
||||
extern _IMPEXP_TRACKER void run_save_panel();
|
||||
|
||||
|
||||
/*---BRefFilter--------------------------------------------------*/
|
||||
|
||||
/* BRefFilter is used by BFilePanel. Every time the user selects
|
||||
* an item in a file panel, the Filter() func is sent to the
|
||||
* panel's BRefFilter object. Filter()'s return value determines
|
||||
* whether the item is admitted into the panel's list of
|
||||
* displayed items. Optional.
|
||||
*/
|
||||
class BRefFilter {
|
||||
public:
|
||||
virtual bool Filter(const entry_ref *, BNode *, struct stat *,
|
||||
const char *mimetype) = 0;
|
||||
};
|
||||
|
||||
|
||||
/*---File Panel constants etc------------------------------------*/
|
||||
|
||||
enum file_panel_mode {
|
||||
B_OPEN_PANEL,
|
||||
B_SAVE_PANEL
|
||||
};
|
||||
|
||||
enum file_panel_button {
|
||||
B_CANCEL_BUTTON,
|
||||
B_DEFAULT_BUTTON
|
||||
};
|
||||
|
||||
class BWindow;
|
||||
class BMessenger;
|
||||
class BMessage;
|
||||
|
||||
/*---------------------------------------------------------------*/
|
||||
/*----BFilePanel-------------------------------------------------*/
|
||||
|
||||
/* Most of the contructor parameters can also be set through individual
|
||||
* funcs. But these can't:
|
||||
*
|
||||
* file_panel_mode mode
|
||||
* uint32 node_flavors
|
||||
* bool modal
|
||||
*/
|
||||
|
||||
class BFilePanel {
|
||||
|
||||
public:
|
||||
BFilePanel(file_panel_mode mode = B_OPEN_PANEL,
|
||||
BMessenger *target = 0,
|
||||
const entry_ref *start_directory = 0,
|
||||
uint32 node_flavors = 0,
|
||||
bool allow_multiple_selection = true,
|
||||
BMessage *message = 0,
|
||||
BRefFilter * = 0,
|
||||
bool modal = false,
|
||||
bool hide_when_done = true);
|
||||
|
||||
virtual ~BFilePanel();
|
||||
|
||||
void Show();
|
||||
void Hide();
|
||||
bool IsShowing() const;
|
||||
|
||||
virtual void WasHidden();
|
||||
virtual void SelectionChanged();
|
||||
virtual void SendMessage(const BMessenger*, BMessage*);
|
||||
|
||||
BWindow* Window() const;
|
||||
BMessenger Messenger() const;
|
||||
BRefFilter* RefFilter() const;
|
||||
void GetPanelDirectory(entry_ref *) const;
|
||||
|
||||
file_panel_mode PanelMode() const;
|
||||
|
||||
void SetTarget(BMessenger);
|
||||
void SetMessage(BMessage *msg);
|
||||
|
||||
void SetRefFilter(BRefFilter* filter);
|
||||
void SetSaveText(const char* text);
|
||||
void SetButtonLabel(file_panel_button, const char *label);
|
||||
|
||||
void SetPanelDirectory(const BEntry *new_directory);
|
||||
void SetPanelDirectory(const BDirectory *new_directory);
|
||||
void SetPanelDirectory(const entry_ref *new_directory);
|
||||
void SetPanelDirectory(const char *new_directory);
|
||||
|
||||
void SetHideWhenDone(bool);
|
||||
bool HidesWhenDone(void) const;
|
||||
|
||||
void Refresh();
|
||||
void Rewind();
|
||||
status_t GetNextSelectedRef(entry_ref*);
|
||||
|
||||
private:
|
||||
|
||||
#if !_PR3_COMPATIBLE_
|
||||
virtual void _ReservedFilePanel1();
|
||||
virtual void _ReservedFilePanel2();
|
||||
virtual void _ReservedFilePanel3();
|
||||
virtual void _ReservedFilePanel4();
|
||||
virtual void _ReservedFilePanel5();
|
||||
virtual void _ReservedFilePanel6();
|
||||
virtual void _ReservedFilePanel7();
|
||||
virtual void _ReservedFilePanel8();
|
||||
#endif
|
||||
|
||||
BWindow *fWindow;
|
||||
|
||||
#if !_PR3_COMPATIBLE_
|
||||
uint32 _reserved[10];
|
||||
#endif
|
||||
|
||||
public:
|
||||
// deprecated calls, do not use
|
||||
BFilePanel(file_panel_mode mode, BMessenger *, entry_ref *,
|
||||
uint32 , bool, BMessage *, BRefFilter *, bool modal,
|
||||
bool hide_when_done);
|
||||
void SetPanelDirectory(BEntry*);
|
||||
void SetPanelDirectory(BDirectory*);
|
||||
void SetPanelDirectory(entry_ref*);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,137 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file FindDirectory.h
|
||||
Declarations of find_directory() functions and associated types.
|
||||
*/
|
||||
|
||||
#ifndef _FIND_DIRECTORY_H
|
||||
#define _FIND_DIRECTORY_H
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
/* ---
|
||||
Per volume directories. When asking for these
|
||||
directories, a volume must be specified, or the call will assume
|
||||
the boot volume.
|
||||
--- */
|
||||
|
||||
B_DESKTOP_DIRECTORY = 0,
|
||||
B_TRASH_DIRECTORY,
|
||||
|
||||
/* ---
|
||||
BeOS directories. These are mostly accessed read-only.
|
||||
--- */
|
||||
|
||||
B_BEOS_DIRECTORY = 1000,
|
||||
B_BEOS_SYSTEM_DIRECTORY,
|
||||
B_BEOS_ADDONS_DIRECTORY,
|
||||
B_BEOS_BOOT_DIRECTORY,
|
||||
B_BEOS_FONTS_DIRECTORY,
|
||||
B_BEOS_LIB_DIRECTORY,
|
||||
B_BEOS_SERVERS_DIRECTORY,
|
||||
B_BEOS_APPS_DIRECTORY,
|
||||
B_BEOS_BIN_DIRECTORY,
|
||||
B_BEOS_ETC_DIRECTORY,
|
||||
B_BEOS_DOCUMENTATION_DIRECTORY,
|
||||
B_BEOS_PREFERENCES_DIRECTORY,
|
||||
B_BEOS_TRANSLATORS_DIRECTORY,
|
||||
B_BEOS_MEDIA_NODES_DIRECTORY,
|
||||
B_BEOS_SOUNDS_DIRECTORY,
|
||||
|
||||
/* ---
|
||||
Common directories, shared among all users.
|
||||
--- */
|
||||
|
||||
B_COMMON_DIRECTORY = 2000,
|
||||
B_COMMON_SYSTEM_DIRECTORY,
|
||||
B_COMMON_ADDONS_DIRECTORY,
|
||||
B_COMMON_BOOT_DIRECTORY,
|
||||
B_COMMON_FONTS_DIRECTORY,
|
||||
B_COMMON_LIB_DIRECTORY,
|
||||
B_COMMON_SERVERS_DIRECTORY,
|
||||
B_COMMON_BIN_DIRECTORY,
|
||||
B_COMMON_ETC_DIRECTORY,
|
||||
B_COMMON_DOCUMENTATION_DIRECTORY,
|
||||
B_COMMON_SETTINGS_DIRECTORY,
|
||||
B_COMMON_DEVELOP_DIRECTORY,
|
||||
B_COMMON_LOG_DIRECTORY,
|
||||
B_COMMON_SPOOL_DIRECTORY,
|
||||
B_COMMON_TEMP_DIRECTORY,
|
||||
B_COMMON_VAR_DIRECTORY,
|
||||
B_COMMON_TRANSLATORS_DIRECTORY,
|
||||
B_COMMON_MEDIA_NODES_DIRECTORY,
|
||||
B_COMMON_SOUNDS_DIRECTORY,
|
||||
|
||||
|
||||
/* ---
|
||||
User directories. These are interpreted in the context
|
||||
of the user making the find_directory call.
|
||||
--- */
|
||||
|
||||
B_USER_DIRECTORY = 3000,
|
||||
B_USER_CONFIG_DIRECTORY,
|
||||
B_USER_ADDONS_DIRECTORY,
|
||||
B_USER_BOOT_DIRECTORY,
|
||||
B_USER_FONTS_DIRECTORY,
|
||||
B_USER_LIB_DIRECTORY,
|
||||
B_USER_SETTINGS_DIRECTORY,
|
||||
B_USER_DESKBAR_DIRECTORY,
|
||||
B_USER_PRINTERS_DIRECTORY,
|
||||
B_USER_TRANSLATORS_DIRECTORY,
|
||||
B_USER_MEDIA_NODES_DIRECTORY,
|
||||
B_USER_SOUNDS_DIRECTORY,
|
||||
|
||||
/* ---
|
||||
Global directories.
|
||||
--- */
|
||||
|
||||
B_APPS_DIRECTORY = 4000,
|
||||
B_PREFERENCES_DIRECTORY,
|
||||
B_UTILITIES_DIRECTORY
|
||||
|
||||
} directory_which;
|
||||
|
||||
/* ---
|
||||
The C interface
|
||||
--- */
|
||||
|
||||
status_t find_directory(directory_which which, dev_t volume, bool createIt,
|
||||
char *pathString, int32 length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
class BVolume;
|
||||
class BPath;
|
||||
|
||||
/* ---
|
||||
C++ interface
|
||||
--- */
|
||||
|
||||
status_t find_directory(directory_which which, BPath *path,
|
||||
bool createIt = false, BVolume *volume = NULL);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}; // namespace OpenBeOS
|
||||
#endif
|
||||
|
||||
#endif // _FIND_DIRECTORY_H
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file Mime.h
|
||||
Mime type C functions interface declarations.
|
||||
*/
|
||||
#ifndef _MIME_H
|
||||
#define _MIME_H
|
||||
|
||||
#ifndef _BE_BUILD_H
|
||||
#include <BeBuild.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <StorageDefs.h>
|
||||
|
||||
// C functions
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int update_mime_info(const char *path, int recursive, int synchronous,
|
||||
int force);
|
||||
|
||||
status_t create_app_meta_mime(const char *path, int recursive, int synchronous,
|
||||
int force);
|
||||
|
||||
status_t get_device_icon(const char *dev, void *icon, int32 size);
|
||||
|
||||
static const uint32 B_MIME_STRING_TYPE = 'MIMS';
|
||||
|
||||
enum icon_size {
|
||||
B_LARGE_ICON = 32,
|
||||
B_MINI_ICON = 16
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// OpenBeOS only!
|
||||
#ifdef __cplusplus
|
||||
|
||||
class BBitmap;
|
||||
|
||||
status_t get_device_icon(const char *dev, BBitmap *icon, icon_size which);
|
||||
|
||||
#endif
|
||||
|
||||
// include the C++ API
|
||||
#ifdef __cplusplus
|
||||
#include <MimeType.h>
|
||||
#endif
|
||||
|
||||
#endif // _MIME_H
|
||||
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file MimeType.h
|
||||
BMimeType interface declarations.
|
||||
*/
|
||||
#ifndef _MIME_TYPE_H
|
||||
#define _MIME_TYPE_H
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <StorageDefs.h>
|
||||
|
||||
#include <Messenger.h>
|
||||
#include <Mime.h>
|
||||
#include <File.h>
|
||||
#include <Entry.h>
|
||||
|
||||
class BBitmap;
|
||||
class BResources;
|
||||
class BAppFileInfo;
|
||||
class BMessenger;
|
||||
|
||||
namespace BPrivate {
|
||||
class MimeDatabase;
|
||||
}
|
||||
|
||||
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"
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
||||
// MIME Monitor BMessage::what value
|
||||
enum {
|
||||
B_META_MIME_CHANGED = 'MMCH'
|
||||
};
|
||||
|
||||
// MIME Monitor "be:which" values
|
||||
enum {
|
||||
B_ICON_CHANGED = 0x00000001,
|
||||
B_PREFERRED_APP_CHANGED = 0x00000002,
|
||||
B_ATTR_INFO_CHANGED = 0x00000004,
|
||||
B_FILE_EXTENSIONS_CHANGED = 0x00000008,
|
||||
B_SHORT_DESCRIPTION_CHANGED = 0x00000010,
|
||||
B_LONG_DESCRIPTION_CHANGED = 0x00000020,
|
||||
B_ICON_FOR_TYPE_CHANGED = 0x00000040,
|
||||
B_APP_HINT_CHANGED = 0x00000080,
|
||||
B_MIME_TYPE_CREATED = 0x00000100,
|
||||
B_MIME_TYPE_DELETED = 0x00000200,
|
||||
B_SNIFFER_RULE_CHANGED = 0x00000400,
|
||||
B_SUPPORTED_TYPES_CHANGED = 0x00000800,
|
||||
|
||||
B_EVERYTHING_CHANGED = (int)0xFFFFFFFF
|
||||
};
|
||||
|
||||
// MIME Monitor "be:action" values
|
||||
enum {
|
||||
B_META_MIME_MODIFIED = 'MMMD',
|
||||
B_META_MIME_DELETED = 'MMDL',
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
||||
//! File typing functionality.
|
||||
/*! The BMimeType class provides access to the file typing system, which
|
||||
provides the following functionality:
|
||||
- Basic MIME string manipulation
|
||||
- Access to file type information in the MIME database
|
||||
- Ways to receive notifications when parts of the MIME database are updated
|
||||
- Methods to determine/help determine the types of untyped files
|
||||
|
||||
\author <a href='mailto:tylerdauwalder@users.sf.net'>Tyler Dauwalder</a>
|
||||
\author <a href='bonefish@users.sf.net'>Ingo Weinhold</a>
|
||||
\version 0.0.0
|
||||
*/
|
||||
class BMimeType {
|
||||
public:
|
||||
BMimeType();
|
||||
BMimeType(const char *mimeType);
|
||||
virtual ~BMimeType();
|
||||
|
||||
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;
|
||||
|
||||
bool operator==(const BMimeType &type) const;
|
||||
bool operator==(const char *type) const;
|
||||
|
||||
bool Contains(const BMimeType *type) const;
|
||||
|
||||
/* These functions are for managing data in the meta mime file*/
|
||||
static bool IsValid(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/"
|
||||
|
||||
friend class MimeTypeTest;
|
||||
|
||||
// Uncomment, when needed...
|
||||
|
||||
friend class BAppFileInfo;
|
||||
// friend class BRoster;
|
||||
// friend class TRosterApp;
|
||||
// friend class TMimeWorker;
|
||||
|
||||
// friend status_t _update_mime_info_(const char *, int32);
|
||||
// friend status_t _real_update_app_(BAppFileInfo *, const char *, bool);
|
||||
|
||||
// static void _set_local_dispatch_target_(BMessenger *, void (*)(BMessage *));
|
||||
// void _touch_();
|
||||
|
||||
virtual void _ReservedMimeType1();
|
||||
virtual void _ReservedMimeType2();
|
||||
virtual void _ReservedMimeType3();
|
||||
|
||||
BMimeType &operator=(const BMimeType &);
|
||||
BMimeType(const BMimeType &);
|
||||
|
||||
|
||||
// void InitData(const char *type);
|
||||
// void InitData(const char *type);
|
||||
// status_t OpenFile(bool create_file = false, dev_t dev = -1) const;
|
||||
// status_t CloseFile() const;
|
||||
status_t GetSupportedTypes(BMessage *types);
|
||||
status_t SetSupportedTypes(const BMessage *types, bool fullSync = true);
|
||||
|
||||
static status_t GetAssociatedTypes(const char *extension, BMessage *types);
|
||||
|
||||
// void MimeChanged(int32 w, const char *type = NULL,
|
||||
// bool large = true) const;
|
||||
|
||||
|
||||
char *fType;
|
||||
BFile *fMeta;
|
||||
void *_unused;
|
||||
entry_ref fRef;
|
||||
int fWhere;
|
||||
status_t fCStatus;
|
||||
uint32 _reserved[3];
|
||||
};
|
||||
|
||||
|
||||
#endif // _MIME_TYPE_H
|
||||
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file Node.h
|
||||
BNode and node_ref interface declarations.
|
||||
*/
|
||||
|
||||
#ifndef _NODE_H
|
||||
#define _NODE_H
|
||||
|
||||
#include <Statable.h>
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// node_ref
|
||||
//---------------------------------------------------------------
|
||||
|
||||
//! Reference structure to a particular vnode on a particular device
|
||||
/*! <b>node_ref</b> - A node reference.
|
||||
|
||||
@author <a href="mailto:[email protected]">Tyler Dauwalder</a>
|
||||
@author Be Inc.
|
||||
@version 0.0.0
|
||||
*/
|
||||
struct node_ref {
|
||||
node_ref();
|
||||
node_ref(const node_ref &ref);
|
||||
|
||||
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 &ref) const
|
||||
{
|
||||
return (device < ref.device
|
||||
|| device == ref.device && node < ref.node);
|
||||
}
|
||||
|
||||
dev_t device;
|
||||
ino_t node;
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// BNode
|
||||
//---------------------------------------------------------------
|
||||
|
||||
//! A BNode represents a chunk of data in the filesystem.
|
||||
/*! The BNode class provides an interface for manipulating the data and attributes
|
||||
belonging to filesystem entries. The BNode is unaware of the name that refers
|
||||
to it in the filesystem (i.e. its entry); a BNode is solely concerned with
|
||||
the entry's data and attributes.
|
||||
|
||||
|
||||
@author <a href='mailto:tylerdauwalder@users.sf.net'>Tyler Dauwalder</a>
|
||||
@version 0.0.0
|
||||
|
||||
*/
|
||||
class BNode : public BStatable {
|
||||
public:
|
||||
|
||||
BNode();
|
||||
BNode(const entry_ref *ref);
|
||||
BNode(const BEntry *entry);
|
||||
BNode(const char *path);
|
||||
BNode(const BDirectory *dir, const char *path);
|
||||
BNode(const BNode &node);
|
||||
virtual ~BNode();
|
||||
|
||||
status_t InitCheck() const;
|
||||
|
||||
virtual status_t GetStat(struct stat *st) const;
|
||||
|
||||
status_t SetTo(const entry_ref *ref);
|
||||
status_t SetTo(const BEntry *entry);
|
||||
status_t SetTo(const char *path);
|
||||
status_t SetTo(const BDirectory *dir, const char *path);
|
||||
void Unset();
|
||||
|
||||
status_t Lock();
|
||||
status_t Unlock();
|
||||
|
||||
status_t Sync();
|
||||
|
||||
ssize_t WriteAttr(const char *name, type_code type, off_t offset,
|
||||
const void *buffer, size_t len);
|
||||
ssize_t ReadAttr(const char *name, type_code type, off_t offset,
|
||||
void *buffer, size_t len) const;
|
||||
status_t RemoveAttr(const char *name);
|
||||
status_t RenameAttr(const char *oldname, const char *newname);
|
||||
status_t GetAttrInfo(const char *name, struct attr_info *info) const;
|
||||
status_t GetNextAttrName(char *buffer);
|
||||
status_t RewindAttrs();
|
||||
status_t WriteAttrString(const char *name, const BString *data);
|
||||
status_t ReadAttrString(const char *name, BString *result) const;
|
||||
|
||||
BNode& operator=(const BNode &node);
|
||||
bool operator==(const BNode &node) const;
|
||||
bool operator!=(const BNode &node) const;
|
||||
|
||||
int Dup(); // This should be "const" but R5's is not... Ugggh.
|
||||
|
||||
private:
|
||||
friend class BFile;
|
||||
friend class BDirectory;
|
||||
friend class BSymLink;
|
||||
|
||||
virtual void _RudeNode1();
|
||||
virtual void _RudeNode2();
|
||||
virtual void _RudeNode3();
|
||||
virtual void _RudeNode4();
|
||||
virtual void _RudeNode5();
|
||||
virtual void _RudeNode6();
|
||||
|
||||
uint32 rudeData[4];
|
||||
|
||||
private:
|
||||
status_t set_fd(int fd);
|
||||
virtual void close_fd();
|
||||
void set_status(status_t newStatus);
|
||||
|
||||
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);
|
||||
|
||||
int fFd;
|
||||
int fAttrFd;
|
||||
status_t fCStatus;
|
||||
|
||||
status_t InitAttrDir();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}; // namespace OpenBeOS
|
||||
#endif
|
||||
|
||||
#endif // _NODE_H
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file NodeInfo.h
|
||||
BNodeInfo interface declaration.
|
||||
*/
|
||||
|
||||
#ifndef _NODE_INFO_H
|
||||
#define _NODE_INFO_H
|
||||
|
||||
#ifndef _BE_BUILD_H
|
||||
#include <BeBuild.h>
|
||||
#endif
|
||||
#include <SupportDefs.h>
|
||||
#include <Mime.h>
|
||||
#include <Message.h>
|
||||
#include <File.h>
|
||||
#include <Entry.h>
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif // USE_OPENBEOS_NAMESPACE
|
||||
|
||||
class BBitmap;
|
||||
class BResources;
|
||||
|
||||
|
||||
//! BNodeInfo provides file type information
|
||||
/*! BNodeInfo provides a nice wrapper to all sorts of usefull meta data.
|
||||
Like it's mime type, the files icon and the application which will load
|
||||
the file.
|
||||
|
||||
\see <a href="http://www.opensource.org/licenses/mit-license.html">MIT</a>
|
||||
\author <a href='mailto:bonefish@users.sf.net'>Ingo Weinhold</a>
|
||||
\author <a href="mailto:[email protected]"> Michael Lloyd Lee </a>
|
||||
\author Be Inc
|
||||
\version 0
|
||||
*/
|
||||
class BNodeInfo {
|
||||
public:
|
||||
|
||||
BNodeInfo();
|
||||
|
||||
BNodeInfo(BNode *node);
|
||||
virtual ~BNodeInfo();
|
||||
|
||||
status_t SetTo(BNode *node);
|
||||
|
||||
status_t InitCheck() const;
|
||||
|
||||
virtual status_t GetType(char *type) const;
|
||||
virtual status_t SetType(const char *type);
|
||||
virtual status_t GetIcon(BBitmap *icon, icon_size k = B_LARGE_ICON) const;
|
||||
virtual status_t SetIcon(const BBitmap *icon, icon_size k = B_LARGE_ICON);
|
||||
|
||||
status_t GetPreferredApp(char *signature,
|
||||
app_verb verb = B_OPEN) const;
|
||||
status_t SetPreferredApp(const char *signature,
|
||||
app_verb verb = B_OPEN);
|
||||
status_t GetAppHint(entry_ref *ref) const;
|
||||
status_t SetAppHint(const entry_ref *ref);
|
||||
|
||||
status_t GetTrackerIcon(BBitmap *icon,
|
||||
icon_size k = B_LARGE_ICON) const;
|
||||
static status_t GetTrackerIcon(const entry_ref *ref,
|
||||
BBitmap *icon,
|
||||
icon_size k = B_LARGE_ICON);
|
||||
private:
|
||||
friend class BAppFileInfo;
|
||||
|
||||
virtual void _ReservedNodeInfo1(); //< FBC
|
||||
virtual void _ReservedNodeInfo2(); //< FBC
|
||||
virtual void _ReservedNodeInfo3(); //< FBC
|
||||
|
||||
BNodeInfo &operator=(const BNodeInfo &);
|
||||
BNodeInfo(const BNodeInfo &);
|
||||
|
||||
BNode *fNode; //< The Node in question
|
||||
uint32 _reserved[2]; //< FBC
|
||||
status_t fCStatus; //< The status to return from InitCheck
|
||||
};
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}
|
||||
#endif // USE_OPENBEOS_NAMESPACE
|
||||
|
||||
#endif // _NODE_INFO_H
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
#ifndef _NODE_MONITOR_H
|
||||
#define _NODE_MONITOR_H
|
||||
/* Node monitor calls for kernel add-ons
|
||||
**
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include <StorageDefs.h>
|
||||
|
||||
|
||||
/* Flags for the watch_node() call.
|
||||
*
|
||||
* Note that B_WATCH_MOUNT is NOT included in B_WATCH_ALL.
|
||||
* You may prefer to use BVolumeRoster for volume watching.
|
||||
*/
|
||||
|
||||
enum {
|
||||
B_STOP_WATCHING = 0x0000,
|
||||
B_WATCH_NAME = 0x0001,
|
||||
B_WATCH_STAT = 0x0002,
|
||||
B_WATCH_ATTR = 0x0004,
|
||||
B_WATCH_DIRECTORY = 0x0008,
|
||||
B_WATCH_ALL = 0x000f,
|
||||
|
||||
B_WATCH_MOUNT = 0x0010
|
||||
};
|
||||
|
||||
|
||||
/* The "opcode" field of the B_NODE_MONITOR notification message you get.
|
||||
*
|
||||
* 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
|
||||
|
||||
|
||||
// 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
|
||||
|
||||
|
||||
// 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 = 0x01,
|
||||
B_STAT_UID = 0x02,
|
||||
B_STAT_GID = 0x04,
|
||||
B_STAT_SIZE = 0x08,
|
||||
B_STAT_ACCESS_TIME = 0x10,
|
||||
B_STAT_MODIFICATION_TIME = 0x20,
|
||||
B_STAT_CREATION_TIME = 0x40,
|
||||
B_STAT_CHANGE_TIME = 0x80,
|
||||
};
|
||||
|
||||
|
||||
/* C++ callable Prototypes
|
||||
*
|
||||
* Since you are not able to parse BMessages from plain C, there is no
|
||||
* API exported.
|
||||
*/
|
||||
|
||||
#if defined(__cplusplus) && !defined(_KERNEL_MODE)
|
||||
|
||||
// these are only needed for the function exports
|
||||
#include <Node.h>
|
||||
#include <Messenger.h>
|
||||
|
||||
class BLooper;
|
||||
class BHandler;
|
||||
|
||||
|
||||
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);
|
||||
|
||||
#endif /* __cplusplus && !_KERNEL_MODE */
|
||||
|
||||
#endif /* _NODE_MONITOR_H*/
|
||||
@@ -0,0 +1,103 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file Path.h
|
||||
BPath interface declaration.
|
||||
*/
|
||||
|
||||
#ifndef _PATH_H
|
||||
#define _PATH_H
|
||||
|
||||
#include <Flattenable.h>
|
||||
#include <StorageDefs.h>
|
||||
#include <Message.h> /* for convenience, as in R5 */
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif
|
||||
|
||||
// Forward declarations
|
||||
class BDirectory;
|
||||
class BEntry;
|
||||
struct entry_ref;
|
||||
|
||||
/*!
|
||||
\class BPath
|
||||
\brief An absolute pathname wrapper class
|
||||
|
||||
Provides a convenient means of managing pathnames.
|
||||
|
||||
\author <a href='mailto:bonefish@users.sf.net'>Ingo Weinhold</a>
|
||||
\author <a href="mailto:[email protected]">Tyler Dauwalder</a>
|
||||
|
||||
\version 0.0.0
|
||||
*/
|
||||
class BPath : public BFlattenable {
|
||||
public:
|
||||
|
||||
BPath();
|
||||
BPath(const BPath &path);
|
||||
BPath(const entry_ref *ref);
|
||||
BPath(const BEntry *entry);
|
||||
BPath(const char *dir, const char *leaf = NULL, bool normalize = false);
|
||||
BPath(const BDirectory *dir, const char *leaf, bool normalize = false);
|
||||
|
||||
virtual ~BPath();
|
||||
|
||||
status_t InitCheck() const;
|
||||
|
||||
status_t SetTo(const entry_ref *ref);
|
||||
status_t SetTo(const BEntry *entry);
|
||||
status_t SetTo(const char *path, const char *leaf = NULL,
|
||||
bool normalize = false);
|
||||
status_t SetTo(const BDirectory *dir, const char *path,
|
||||
bool normalize = false);
|
||||
void Unset();
|
||||
|
||||
status_t Append(const char *path, bool normalize = false);
|
||||
|
||||
const char *Path() const;
|
||||
const char *Leaf() const;
|
||||
status_t GetParent(BPath *path) const;
|
||||
|
||||
bool operator==(const BPath &item) const;
|
||||
bool operator==(const char *path) const;
|
||||
bool operator!=(const BPath &item) const;
|
||||
bool operator!=(const char *path) const;
|
||||
BPath& operator=(const BPath &item);
|
||||
BPath& operator=(const char *path);
|
||||
|
||||
// BFlattenable protocol
|
||||
virtual bool IsFixedSize() const;
|
||||
virtual type_code TypeCode() const;
|
||||
virtual ssize_t FlattenedSize() const;
|
||||
virtual status_t Flatten(void *buffer, ssize_t size) const;
|
||||
virtual bool AllowsTypeCode(type_code code) const;
|
||||
virtual status_t Unflatten(type_code c, const void *buf, ssize_t size);
|
||||
|
||||
private:
|
||||
virtual void _WarPath1();
|
||||
virtual void _WarPath2();
|
||||
virtual void _WarPath3();
|
||||
|
||||
uint32 _warData[4];
|
||||
|
||||
char *fName;
|
||||
status_t fCStatus;
|
||||
|
||||
class EBadInput { };
|
||||
|
||||
status_t set_path(const char *path);
|
||||
|
||||
static bool MustNormalize(const char *path);
|
||||
};
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}; // namespace OpenBeOS
|
||||
#endif
|
||||
|
||||
#endif // _PATH_H
|
||||
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file Query.h
|
||||
BQuery interface declaration.
|
||||
*/
|
||||
|
||||
#ifndef _QUERY_H
|
||||
#define _QUERY_H
|
||||
|
||||
#include <EntryList.h>
|
||||
#include <Messenger.h>
|
||||
#include <OS.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
class BVolume;
|
||||
struct entry_ref;
|
||||
|
||||
namespace BPrivate {
|
||||
namespace Storage {
|
||||
class QueryNode;
|
||||
class QueryStack;
|
||||
class QueryTree;
|
||||
};
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
B_INVALID_OP = 0,
|
||||
B_EQ,
|
||||
B_GT,
|
||||
B_GE,
|
||||
B_LT,
|
||||
B_LE,
|
||||
B_NE,
|
||||
B_CONTAINS,
|
||||
B_BEGINS_WITH,
|
||||
B_ENDS_WITH,
|
||||
B_AND = 0x101,
|
||||
B_OR,
|
||||
B_NOT,
|
||||
_B_RESERVED_OP_ = 0x100000
|
||||
} query_op;
|
||||
|
||||
/*!
|
||||
\class BQuery
|
||||
\brief Represents a live or non-live file system query
|
||||
|
||||
Provides an interface for creating file system queries. Implements
|
||||
the BEntryList for iterating through the found entries.
|
||||
|
||||
\author <a href='mailto:bonefish@users.sf.net'>Ingo Weinhold</a>
|
||||
|
||||
\version 0.0.0
|
||||
*/
|
||||
class BQuery : public BEntryList {
|
||||
public:
|
||||
BQuery();
|
||||
virtual ~BQuery();
|
||||
|
||||
status_t Clear();
|
||||
|
||||
status_t PushAttr(const char *attrName);
|
||||
status_t PushOp(query_op op);
|
||||
|
||||
status_t PushUInt32(uint32 value);
|
||||
status_t PushInt32(int32 value);
|
||||
status_t PushUInt64(uint64 value);
|
||||
status_t PushInt64(int64 value);
|
||||
status_t PushFloat(float value);
|
||||
status_t PushDouble(double value);
|
||||
status_t PushString(const char *value, bool caseInsensitive = false);
|
||||
status_t PushDate(const char *date);
|
||||
|
||||
status_t SetVolume(const BVolume *volume);
|
||||
status_t SetPredicate(const char *expression);
|
||||
status_t SetTarget(BMessenger messenger);
|
||||
|
||||
bool IsLive() const;
|
||||
|
||||
status_t GetPredicate(char *buffer, size_t length);
|
||||
status_t GetPredicate(BString *predicate);
|
||||
size_t PredicateLength();
|
||||
|
||||
dev_t TargetDevice() const;
|
||||
|
||||
status_t Fetch();
|
||||
|
||||
// BEntryList interface
|
||||
virtual status_t GetNextEntry(BEntry *entry, bool traverse = false);
|
||||
virtual status_t GetNextRef(entry_ref *ref);
|
||||
virtual int32 GetNextDirents(struct dirent *buf, size_t length,
|
||||
int32 count = INT_MAX);
|
||||
virtual status_t Rewind();
|
||||
virtual int32 CountEntries();
|
||||
|
||||
private:
|
||||
bool _HasFetched() const;
|
||||
status_t _PushNode(BPrivate::Storage::QueryNode *node, bool deleteOnError);
|
||||
status_t _SetPredicate(const char *expression);
|
||||
status_t _EvaluateStack();
|
||||
|
||||
// FBC
|
||||
virtual void _QwertyQuery1();
|
||||
virtual void _QwertyQuery2();
|
||||
virtual void _QwertyQuery3();
|
||||
virtual void _QwertyQuery4();
|
||||
virtual void _QwertyQuery5();
|
||||
virtual void _QwertyQuery6();
|
||||
|
||||
private:
|
||||
int32 _reservedData[4]; // FBC
|
||||
BPrivate::Storage::QueryStack *fStack;
|
||||
char *fPredicate;
|
||||
dev_t fDevice;
|
||||
bool fLive;
|
||||
port_id fPort;
|
||||
long fToken;
|
||||
int fQueryFd;
|
||||
};
|
||||
|
||||
#endif // _QUERY_H
|
||||
@@ -0,0 +1,92 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file ResourceStrings.h
|
||||
BResourceStrings interface declaration.
|
||||
*/
|
||||
|
||||
#ifndef _RESOURCE_STRINGS_H
|
||||
#define _RESOURCE_STRINGS_H
|
||||
|
||||
#include <Entry.h>
|
||||
#include <Locker.h>
|
||||
|
||||
class BResources;
|
||||
class BString;
|
||||
|
||||
/*!
|
||||
\class BResourceStrings
|
||||
\brief Simple class to access the string resources in a file.
|
||||
|
||||
A BResourceStrings object reads the string type resources from a given
|
||||
resource file and provides fast read only access to them.
|
||||
|
||||
\author <a href='mailto:bonefish@users.sf.net'>Ingo Weinhold</a>
|
||||
|
||||
\version 0.0.0
|
||||
*/
|
||||
class BResourceStrings {
|
||||
public:
|
||||
BResourceStrings();
|
||||
BResourceStrings(const entry_ref &ref);
|
||||
virtual ~BResourceStrings();
|
||||
|
||||
status_t InitCheck();
|
||||
virtual BString *NewString(int32 id);
|
||||
virtual const char *FindString(int32 id);
|
||||
|
||||
virtual status_t SetStringFile(const entry_ref *ref);
|
||||
status_t GetStringFile(entry_ref *outRef);
|
||||
|
||||
public:
|
||||
enum {
|
||||
RESOURCE_TYPE = 'CSTR'
|
||||
};
|
||||
|
||||
protected:
|
||||
struct _string_id_hash {
|
||||
_string_id_hash();
|
||||
~_string_id_hash();
|
||||
void assign_string(const char *str, bool makeCopy);
|
||||
_string_id_hash *next;
|
||||
int32 id;
|
||||
char *data;
|
||||
bool data_alloced;
|
||||
bool _reserved1[3];
|
||||
uint32 _reserved2;
|
||||
};
|
||||
|
||||
protected:
|
||||
BLocker _string_lock;
|
||||
status_t _init_error;
|
||||
|
||||
private:
|
||||
entry_ref fFileRef;
|
||||
BResources *fResources;
|
||||
_string_id_hash **fHashTable;
|
||||
int32 fHashTableSize;
|
||||
int32 fStringCount;
|
||||
uint32 _reserved[16]; // FBC
|
||||
|
||||
private:
|
||||
void _Cleanup();
|
||||
void _MakeEmpty();
|
||||
status_t _Rehash(int32 newSize);
|
||||
_string_id_hash *_AddString(char *str, int32 id, bool wasMalloced);
|
||||
|
||||
virtual _string_id_hash *_FindString(int32 id);
|
||||
|
||||
// FBC
|
||||
virtual status_t _Reserved_ResourceStrings_0(void *);
|
||||
virtual status_t _Reserved_ResourceStrings_1(void *);
|
||||
virtual status_t _Reserved_ResourceStrings_2(void *);
|
||||
virtual status_t _Reserved_ResourceStrings_3(void *);
|
||||
virtual status_t _Reserved_ResourceStrings_4(void *);
|
||||
virtual status_t _Reserved_ResourceStrings_5(void *);
|
||||
};
|
||||
|
||||
#endif // _RESOURCE_STRINGS_H
|
||||
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file Resources.h
|
||||
BResources interface declaration.
|
||||
*/
|
||||
|
||||
#ifndef _RESOURCES_H
|
||||
#define _RESOURCES_H
|
||||
|
||||
#include <File.h>
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif
|
||||
|
||||
namespace BPrivate {
|
||||
namespace Storage {
|
||||
class ResourcesContainer;
|
||||
class ResourceFile;
|
||||
};
|
||||
};
|
||||
|
||||
/*!
|
||||
\class BResources
|
||||
\brief Represent the resources in a file
|
||||
|
||||
Provides an interface for accessing and manipulating resources.
|
||||
|
||||
\author <a href='mailto:bonefish@users.sf.net'>Ingo Weinhold</a>
|
||||
|
||||
\version 0.0.0
|
||||
*/
|
||||
class BResources {
|
||||
public:
|
||||
BResources();
|
||||
BResources(const BFile *file, bool clobber = false);
|
||||
virtual ~BResources();
|
||||
|
||||
status_t SetTo(const BFile *file, bool clobber = false);
|
||||
void Unset();
|
||||
status_t InitCheck() const;
|
||||
|
||||
const BFile &File() const;
|
||||
|
||||
const void *LoadResource(type_code type, int32 id, size_t *outSize);
|
||||
const void *LoadResource(type_code type, const char *name,
|
||||
size_t *outSize);
|
||||
|
||||
status_t PreloadResourceType(type_code type = 0);
|
||||
|
||||
status_t Sync();
|
||||
status_t MergeFrom(BFile *fromFile);
|
||||
status_t WriteTo(BFile *file);
|
||||
|
||||
status_t AddResource(type_code type, int32 id, const void *data,
|
||||
size_t length, const char *name = NULL);
|
||||
|
||||
bool HasResource(type_code type, int32 id);
|
||||
bool HasResource(type_code type, const char *name);
|
||||
|
||||
bool GetResourceInfo(int32 byIndex, type_code *typeFound, int32 *idFound,
|
||||
const char **nameFound, size_t *lengthFound);
|
||||
bool GetResourceInfo(type_code byType, int32 andIndex, int32 *idFound,
|
||||
const char **nameFound, size_t *lengthFound);
|
||||
bool GetResourceInfo(type_code byType, int32 andID,
|
||||
const char **nameFound, size_t *lengthFound);
|
||||
bool GetResourceInfo(type_code byType, const char *andName, int32 *idFound,
|
||||
size_t *lengthFound);
|
||||
bool GetResourceInfo(const void *byPointer, type_code *typeFound,
|
||||
int32 *idFound, size_t *lengthFound,
|
||||
const char **nameFound);
|
||||
|
||||
status_t RemoveResource(const void *resource);
|
||||
status_t RemoveResource(type_code type, int32 id);
|
||||
|
||||
|
||||
// deprecated
|
||||
|
||||
status_t WriteResource(type_code type, int32 id, const void *data,
|
||||
off_t offset, size_t length);
|
||||
|
||||
status_t ReadResource(type_code type, int32 id, void *data, off_t offset,
|
||||
size_t length);
|
||||
|
||||
void *FindResource(type_code type, int32 id, size_t *lengthFound);
|
||||
void *FindResource(type_code type, const char *name, size_t *lengthFound);
|
||||
|
||||
private:
|
||||
// FBC
|
||||
virtual void _ReservedResources1();
|
||||
virtual void _ReservedResources2();
|
||||
virtual void _ReservedResources3();
|
||||
virtual void _ReservedResources4();
|
||||
virtual void _ReservedResources5();
|
||||
virtual void _ReservedResources6();
|
||||
virtual void _ReservedResources7();
|
||||
virtual void _ReservedResources8();
|
||||
|
||||
private:
|
||||
BFile fFile;
|
||||
BPrivate::Storage::ResourcesContainer *fContainer;
|
||||
BPrivate::Storage::ResourceFile *fResourceFile;
|
||||
bool fReadOnly;
|
||||
bool _pad[3];
|
||||
uint32 _reserved[3]; // FBC
|
||||
};
|
||||
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}; // namespace OpenBeOS
|
||||
#endif
|
||||
|
||||
#endif // _RESOURCES_H
|
||||
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file Statable.h
|
||||
BStatable interface declaration.
|
||||
*/
|
||||
|
||||
#ifndef _STATABLE_H
|
||||
#define _STATABLE_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif // USE_OPENBEOS_NAMESPACE
|
||||
|
||||
struct node_ref;
|
||||
class BVolume;
|
||||
|
||||
|
||||
//! BStatable - A nice C++ wrapper to <code>stat()</code>
|
||||
/*! A purly abstract class which provieds an expenive, but convenet
|
||||
* C++ wrapper to the posix <code>\sa stat()</code> command.
|
||||
*
|
||||
* @see <a href="http://www.opensource.org/licenses/mit-license.html">MIT</a>
|
||||
* @author <a href="mailto:[email protected]"> Michael Lloyd Lee </a>
|
||||
* @author Be Inc
|
||||
* @version 0
|
||||
*/
|
||||
class BStatable {
|
||||
public:
|
||||
virtual status_t GetStat(struct stat *st) const = 0;
|
||||
|
||||
bool IsFile() const;
|
||||
bool IsDirectory() const;
|
||||
bool IsSymLink() const;
|
||||
|
||||
status_t GetNodeRef(node_ref *ref) const;
|
||||
|
||||
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 GetPermissions(mode_t *perms) const;
|
||||
status_t SetPermissions(mode_t perms);
|
||||
|
||||
status_t GetSize(off_t *size) const;
|
||||
|
||||
status_t GetModificationTime(time_t *mtime) const;
|
||||
status_t SetModificationTime(time_t mtime);
|
||||
|
||||
status_t GetAccessTime(time_t *atime) const;
|
||||
status_t SetAccessTime(time_t atime);
|
||||
|
||||
status_t GetVolume(BVolume *vol) const;
|
||||
|
||||
private:
|
||||
|
||||
friend class BEntry;
|
||||
friend class BNode;
|
||||
|
||||
virtual void _OhSoStatable1(); //< FBC
|
||||
virtual void _OhSoStatable2(); //< FBC
|
||||
virtual void _OhSoStatable3(); //< FBC
|
||||
uint32 _ohSoData[4]; //< FBC
|
||||
|
||||
virtual status_t set_stat(struct stat &st, uint32 what) = 0;
|
||||
};
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}
|
||||
#endif // USE_OPENBEOS_NAMESPACE
|
||||
|
||||
#endif // _STATABLE_H
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file StorageDefs.Private.h
|
||||
Private Storage Kit declarations needed in public headers.
|
||||
*/
|
||||
|
||||
#ifndef _DEF_STORAGE_PRIVATE_H
|
||||
#define _DEF_STORAGE_PRIVATE_H
|
||||
|
||||
namespace BPrivate {
|
||||
namespace Storage {
|
||||
typedef int FileDescriptor;
|
||||
};
|
||||
};
|
||||
|
||||
#endif // _DEF_STORAGE_PRIVATE_H
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file StorageDefs.h
|
||||
Miscellaneous Storage Kit definitions and includes.
|
||||
*/
|
||||
|
||||
#ifndef _DEF_STORAGE_H
|
||||
#define _DEF_STORAGE_H
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/param.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif // USE_OPENBEOS_NAMESPACE
|
||||
|
||||
// Limits
|
||||
#define B_DEV_NAME_LENGTH 128
|
||||
#define B_FILE_NAME_LENGTH NAME_MAX
|
||||
#define B_PATH_NAME_LENGTH MAXPATHLEN
|
||||
#define B_ATTR_NAME_LENGTH (B_FILE_NAME_LENGTH-1)
|
||||
#define B_MIME_TYPE_LENGTH (B_ATTR_NAME_LENGTH - 15)
|
||||
#define B_MAX_SYMLINKS SYMLINK_MAX
|
||||
|
||||
|
||||
// Open Modes
|
||||
#define B_READ_ONLY O_RDONLY // read only
|
||||
#define B_WRITE_ONLY O_WRONLY // write only
|
||||
#define B_READ_WRITE O_RDWR // read and write
|
||||
|
||||
#define B_FAIL_IF_EXISTS O_EXCL // exclusive create
|
||||
#define B_CREATE_FILE O_CREAT // create the file
|
||||
#define B_ERASE_FILE O_TRUNC // erase the file's data
|
||||
#define B_OPEN_AT_END O_APPEND // point to the end of the data
|
||||
|
||||
|
||||
// Node Flavors
|
||||
enum node_flavor {
|
||||
B_FILE_NODE = 0x01,
|
||||
B_SYMLINK_NODE = 0x02,
|
||||
B_DIRECTORY_NODE = 0x04,
|
||||
B_ANY_NODE = 0x07
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}; // namespace OpenBeOS
|
||||
#endif // USE_OPENBEOS_NAMESPACE
|
||||
|
||||
|
||||
#endif // _DEF_STORAGE_H
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//
|
||||
// File Name: SymLink.h
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file SymLink.h
|
||||
BSymLink interface declaration.
|
||||
*/
|
||||
|
||||
#ifndef _SYM_LINK_H
|
||||
#define _SYM_LINK_H
|
||||
|
||||
#include <Node.h>
|
||||
#include <StorageDefs.h>
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\class BSymLink
|
||||
\brief A symbolic link in the filesystem
|
||||
|
||||
Provides an interface for manipulating symbolic links.
|
||||
|
||||
\author <a href='mailto:bonefish@users.sf.net'>Ingo Weinhold</a>
|
||||
|
||||
\version 0.0.0
|
||||
*/
|
||||
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);
|
||||
virtual ~BSymLink();
|
||||
|
||||
ssize_t ReadLink(char *buf, size_t size);
|
||||
|
||||
ssize_t MakeLinkedPath(const char *dirPath, BPath *path);
|
||||
ssize_t MakeLinkedPath(const BDirectory *dir, BPath *path);
|
||||
|
||||
bool IsAbsolute();
|
||||
|
||||
private:
|
||||
virtual void _MissingSymLink1();
|
||||
virtual void _MissingSymLink2();
|
||||
virtual void _MissingSymLink3();
|
||||
virtual void _MissingSymLink4();
|
||||
virtual void _MissingSymLink5();
|
||||
virtual void _MissingSymLink6();
|
||||
|
||||
uint32 _reservedData[4];
|
||||
BEntry *fSecretEntry;
|
||||
|
||||
private:
|
||||
int get_fd() const;
|
||||
};
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}; // namespace OpenBeOS
|
||||
#endif
|
||||
|
||||
#endif // _SYM_LINK_H
|
||||
@@ -0,0 +1,68 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//
|
||||
// File Name: Directory.cpp
|
||||
//
|
||||
// Description: BVolume class
|
||||
// ----------------------------------------------------------------------
|
||||
/*!
|
||||
\file Volume.h
|
||||
BVolume interface declarations.
|
||||
*/
|
||||
#ifndef _VOLUME_H
|
||||
#define _VOLUME_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <fs_info.h>
|
||||
#include <Mime.h>
|
||||
#include <StorageDefs.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif
|
||||
|
||||
class BDirectory;
|
||||
class BBitmap;
|
||||
|
||||
class BVolume {
|
||||
public:
|
||||
BVolume();
|
||||
BVolume(dev_t dev);
|
||||
BVolume(const BVolume &vol);
|
||||
virtual ~BVolume();
|
||||
|
||||
status_t InitCheck() const;
|
||||
status_t SetTo(dev_t dev);
|
||||
void Unset();
|
||||
|
||||
dev_t Device() const;
|
||||
|
||||
bool operator==(const BVolume &volume) const;
|
||||
bool operator!=(const BVolume &volume) const;
|
||||
BVolume &operator=(const BVolume &volume);
|
||||
|
||||
private:
|
||||
// friend class BVolumeRoster;
|
||||
|
||||
virtual void _TurnUpTheVolume1();
|
||||
virtual void _TurnUpTheVolume2();
|
||||
virtual void _TurnUpTheVolume3();
|
||||
virtual void _TurnUpTheVolume4();
|
||||
virtual void _TurnUpTheVolume5();
|
||||
virtual void _TurnUpTheVolume6();
|
||||
virtual void _TurnUpTheVolume7();
|
||||
virtual void _TurnUpTheVolume8();
|
||||
|
||||
dev_t fDevice;
|
||||
status_t fCStatus;
|
||||
int32 _reserved[8];
|
||||
};
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
} // namespace OpenBeOS
|
||||
#endif
|
||||
|
||||
#endif // _VOLUME_H
|
||||
@@ -0,0 +1,54 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//
|
||||
// File Name: VolumeRoster.h
|
||||
//
|
||||
// Description: BVolumeRoster class
|
||||
// ----------------------------------------------------------------------
|
||||
/*!
|
||||
\file VolumeRoster.h
|
||||
BVolumeRoster interface declarations.
|
||||
*/
|
||||
#ifndef _VOLUME_ROSTER_H
|
||||
#define _VOLUME_ROSTER_H
|
||||
|
||||
#include <Application.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <Volume.h>
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif
|
||||
|
||||
class BVolume;
|
||||
class BMessenger;
|
||||
|
||||
class BVolumeRoster {
|
||||
public:
|
||||
BVolumeRoster();
|
||||
virtual ~BVolumeRoster();
|
||||
|
||||
status_t GetNextVolume(BVolume *volume);
|
||||
void Rewind();
|
||||
|
||||
status_t GetBootVolume(BVolume *volume);
|
||||
|
||||
status_t StartWatching(BMessenger messenger = be_app_messenger);
|
||||
void StopWatching();
|
||||
BMessenger Messenger() const;
|
||||
|
||||
private:
|
||||
virtual void _SeveredVRoster1();
|
||||
virtual void _SeveredVRoster2();
|
||||
|
||||
int32 fCookie;
|
||||
BMessenger *fTarget;
|
||||
uint32 _reserved[3];
|
||||
};
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _VOLUME_ROSTER_H
|
||||
Reference in New Issue
Block a user