The Storage Kit Table of Contents     The Storage Kit Index

Global Constants and Defined Types

This section lists parts of the Storage Kit that aren't contained in classes.


Constants


Limits Constants

Declared in: be/storage/StorageDefs.h

Constant Meaning
B_FILE_NAME_LENGTH Number of characters allowed in a file name.
B_PATH_NAME_LENGTH Number of characters allowed in a path name.
B_ATTR_NAME_LENGTH Number of characters allowed in an attribute name.
B_MIME_TYPE_LENGTH Number of characters allowed in a MIME type name.
B_MAX_SYMLINKS Number of nested symlinks allowed.

These constants define the maximum values for several Storage Kit related items, including file and path name strings, attribute name strings, and MIME type strings. B_MAX_SYMLINKS specifies how many symbolic links may be linked through each other.


File Open Mode Constants

Declared in: be/storage/StorageDefs.h

Constant Meaning
B_READ_ONLY Open the file with read-only access.
B_WRITE_ONLY Open the file with write-only access.
B_READ_WRITE Open the file for both reading and writing.
B_FAIL_IF_EXISTS Don't open the file if it already exists.
B_CREATE_FILE Create the file before opening it.
B_ERASE_FILE Erase the previous contents before opening the file.
B_OPEN_AT_END Open with the pointer at the end of the file.

These constants are used when opening files using either the POSIX open() function or using the BFile class. They specify the mode in which the file is to be opened. For instance, if write-only access is desired, and you want the operation to fail if the file exists, you would do the following:

   fd = open("foobar.data", B_WRITE_ONLY | B_FAIL_IF_EXISTS);


Node Flavors

Declared in: be/storage/StorageDefs.h

Constant Meaning
B_FILE_NODE Files only.
B_SYMLINK_NODE Symbolic links only.
B_DIRECTORY_NODE Directories only.
B_ANY_NODE Matches any node.

These constants are used when making a request that can be qualified based on the "flavor" of a node—in other words, whenever you wish to perform an operation on only files, directories, or symbolic links. This is used when opening a file panel, for instance, so that you can specify what types of items you want the user to be able to select.


Version Kinds

Declared in: be/storage/AppFileInfo.h

Constant Meaning
B_APP_VERSION_KIND Records information about a specific application.
B_SYSTEM_VERSION_KIND Records information about a "suite," or other grouping of applications, that the application belongs to.

These constants are used when setting or retrieving the version information attached to an application. There are two version information records for each application, and these two constants select which one you wish to reference. Although there is no prescribed use for these structures or their constants, it is suggested that B_APP_VERSION_KIND be used for application-specific version information, and B_SYSTEM_VERSION_KIND be used for information about the suite of applications to which the application belongs.


Directories

Declared in: be/storage/FindDirectory.h

Constant Meaning
B_DESKTOP_DIRECTORY Desktop directory.
B_TRASH_DIRECTORY Trash directory.
B_APPS_DIRECTORY Applications directory.
B_PREFERENCES_DIRECTORY Preferences directory.
B_BEOS_DIRECTORY BeOS directory.
B_BEOS_SYSTEM_DIRECTORY System directory.
B_BEOS_ADDONS_DIRECTORY BeOS add-ons directory.
B_BEOS_BOOT_DIRECTORY Boot volume's root directory.
B_BEOS_FONTS_DIRECTORY BeOS fonts directory.
B_BEOS_LIB_DIRECTORY BeOS libraries directory.
B_BEOS_SERVERS_DIRECTORY BeOS servers directory.
B_BEOS_APPS_DIRECTORY BeOS applications directory.
B_BEOS_BIN_DIRECTORY /bin directory.
B_BEOS_ETC_DIRECTORY /etc directory.
B_BEOS_DOCUMENTATION_DIRECTORY BeOS documentation directory.
B_BEOS_PREFERENCES_DIRECTORY BeOS preferences directory.
B_COMMON_DIRECTORY The common directory, shared by all users.
B_COMMON_SYSTEM_DIRECTORY The shared system directory.
B_COMMON_ADDONS_DIRECTORY The shared addons directory.
B_COMMON_BOOT_DIRECTORY The shared boot directory.
B_COMMON_FONTS_DIRECTORY The shared fonts directory.
B_COMMON_LIB_DIRECTORY The shared libraries directory.
B_COMMON_SERVERS_DIRECTORY The shared servers directory.
B_COMMON_BIN_DIRECTORY The shared /bin directory.
B_COMMON_ETC_DIRECTORY The shared /etc directory.
B_COMMON_DOCUMENTATION_DIRECTORY The shared documentation directory.
B_COMMON_SETTINGS_DIRECTORY The shared settings directory.
B_COMMON_DEVELOP_DIRECTORY The shared develop directory.
B_COMMON_LOG_DIRECTORY The shared log directory.
B_COMMON_SPOOL_DIRECTORY The shared spool directory.
B_COMMON_TEMP_DIRECTORY The shared temporary items directory.
B_COMMON_VAR_DIRECTORY The shared /var directory.
B_USER_DIRECTORY The user's home directory.
B_USER_CONFIG_DIRECTORY The user's config directory.
B_USER_ADDONS_DIRECTORY The user's add-ons directory.
B_USER_BOOT_DIRECTORY The user's /boot directory.
B_USER_FONTS_DIRECTORY The user's fonts directory.
B_USER_LIB_DIRECTORY The user's libraries directory.
B_USER_SETTINGS_DIRECTORY The user's settings directory.
B_USER_DESKBAR_DIRECTORY The user's Deskbar directory.

These constants are used when calling the find_directory() function to determine the pathname of a particular directory of interest.

B_DESKTOP_DIRECTORY and B_TRASH_DIRECTORY are per-volume directories; if you don't specify the volume you wish to locate these directories on, find_directory() will assume you mean the boot disk.

B_APPS_DIRECTORY and B_PREFERENCES_DIRECTORY are global directories, and always refer to the standard apps and preferences directories.

The B_BEOS_* constants refer to BeOS-owned directories, the B_COMMON_* constants refer to directories that are common to all users of the system, and the B_USER_* constants refer to the current user's directories (currently these are all in a subtree rooted at /boot/home, but when multiuser support is implemented in a future version of BeOS, these won't necessarily all be the same anymore).

In general, global application and system settings should be kept in B_COMMON_*; while settings that each user should be able to configure individually should be kept in B_USER_*.

By using these constants properly, your code will be compatible with future generations of the BeOS.


Icon Sizes

Declared in: be/storage/Mime.h

Constant Meaning
B_LARGE_ICON Large (32x32) icon.
B_MINI_ICON Small (16x16) icon.

These constants are used when selecting icons from a meta MIME file; they let you fetch the large and small variations of a file's icon.


watch_node() Flags

Declared in: be/storage/NodeMonitor.h

Constant Meaning
B_STOP_WATCHING Stop watching the node.
B_WATCH_NAME Watch for changes to the name of the node.
B_WATCH_STAT Watch for stat changes.
B_WATCH_ATTR Watch for attribute changes.
B_WATCH_DIRECTORY Watch for changes to the directory's contents.
B_WATCH_ALL Watch everything (except mounting).
B_WATCH_MOUNT Watch for disk mounts and unmounts.

These constants are used to control what type of monitoring to perform on a node. B_WATCH_ALL is a convenience constant that allows you to monitor changes to the name, stat information, attributes, and directory of a node. B_WATCH_MOUNT, which is not included in B_WATCH_ALL, monitors volumes being mounted and unmounted.

B_WATCH_DIRECTORY applies only to directory nodes.


Node Monitor Opcodes

Declared in: be/storage/NodeMonitor.h

Constant Meaning
B_ENTRY_CREATED A new entry has been created.
B_ENTRY_REMOVED An entry has been removed.
B_ENTRY_MOVED An entry has been moved.
B_STAT_CHANGED Stat information has changed.
B_ATTR_CHANGED An attribute has been changed.
B_DEVICE_MOUNTED A volume has been mounted.
B_DEVICE_UNMOUNTED A volume has been unmounted.

These constants are returned in the "opcode" field of messages sent by the Node Monitor to let you know what sort of change has occurred to a node being monitored.


Query Operation Constants

Declared in: be/storage/Query.h

Constant Operation
B_EQ =
B_NE !=
B_GT >
B_LT <
B_GE >=
B_LE <=
B_CONTAINS string contains value ("*value*")
B_BEGINS_WITH string begins with value ("value*")
B_ENDS_WITH string ends with value ("*value")
B_AND &&
B_OR ||
B_NOT !

These constants define the operations that can be used to specify a query. They are used in conjunction with the push functions for constructing a query.


Defined Types


entry_ref

Declared in: be/storage/Entry.h
                                                         
  

struct entry_ref {
               entry_ref();
               entry_ref(dev_t device, 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;
      }

The entry_ref structure describes a single entry in a directory.

entry_ref()
entry_ref
(dev_t device, ino_t dir, const char *name)
entry_ref(const entry_ref &ref)

 
The constructor for the entry_ref structure. The first of these creates an empty entry_ref, the second accepts a device number, directory inode number, and a file name and constructs an entry_ref referring to that entry, and the last version of the constructor duplicates an existing entry_ref.


~entry_ref()

 
The destructor for entry_ref.


status_t set_name(const char *name)

 
Lets you change the name of the file referred to by the entry_ref structure.


operator ==

 
Lets you perform comparisons of entry_ref structures to see if they refer to the same entry.


operator !=

 
Lets you test to see if two entry_ref structures refer to different entries.


device contains the device number on which the entry's target is located.

directory contains the inode of the directory that contains the entry's target.

name contains the name of the entry.


node_ref

Declared in: be/storage/Node.h
                                                         
  

struct node_ref {
               node_ref();
               node_ref(const node_ref &ref);
               ~node_ref();
      
         bool      operator==(const node_ref &ref) const;
         bool      operator!=(const node_ref &ref) const;
         node_ref &   operator=(const node_ref &ref);
      
         dev_t         device;
         ino_t         node;
      }

The node_ref structure describes a node in a file system.

node_ref()
node_ref
(const node_ref &ref)

 
The constructor for the node_ref structure. The first of these creates an empty node_ref, and the second duplicates an existing node_ref.


~node_ref()

 
The destructor for node_ref.


operator ==

 
Lets you perform comparisons of node_ref structures to see if they refer to the same node.


operator !=

 
Lets you test to see if two node_ref structures refer to different nodes.


device contains the device number on which the node is located.

node contains the inode of the node.


version_info

Declared in: be/storage/AppFileInfo.h
                                                         
  

struct version_info {
         uint32      major;
         uint32      middle;
         uint32      minor;
         uint32      variety;
         uint32      internal;
         char      short_info[64];
         char      long_info[256];
      }

The version_info structure is used to contain version information about an application. Although none of these fields have prescribed uses, and you can use them for anything you want, their names do hint at their suggested uses.


The Storage Kit Table of Contents     The Storage Kit Index


The Be Book,
...in lovely HTML...
for BeOS Release 5.

Copyright © 2000 Be, Inc. All rights reserved..