Constants

Limits Constants

Declared in: be/storage/StorageDefs.h

ConstantMeaning
B_FILE_NAME_LENGTHNumber of characters allowed in a file name.
B_PATH_NAME_LENGTHNumber of characters allowed in a path name.
B_ATTR_NAME_LENGTHNumber of characters allowed in an attribute name.
B_MIME_TYPE_LENGTHNumber of characters allowed in a MIME type name.
B_MAX_SYMLINKSNumber 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

ConstantMeaning
B_READ_ONLYOpen the file with read-only access.
B_WRITE_ONLYOpen the file with write-only access.
B_READ_WRITEOpen the file for both reading and writing.
B_FAIL_IF_EXISTSDon't open the file if it already exists.
B_CREATE_FILECreate the file before opening it.
B_ERASE_FILEErase the previous contents before opening the file.
B_OPEN_AT_ENDOpen 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

ConstantMeaning
B_FILE_NODEFiles only.
B_SYMLINK_NODESymbolic links only.
B_DIRECTORY_NODEDirectories only.
B_ANY_NODEMatches 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

ConstantMeaning
B_APP_VERSION_KINDRecords information about a specific application.
B_SYSTEM_VERSION_KINDRecords 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

ConstantMeaning
B_DESKTOP_DIRECTORYDesktop directory.
B_TRASH_DIRECTORYTrash directory.
B_APPS_DIRECTORYApplications directory.
B_PREFERENCES_DIRECTORYPreferences directory.
B_BEOS_DIRECTORYBeOS directory.
B_BEOS_SYSTEM_DIRECTORYSystem directory.
B_BEOS_ADDONS_DIRECTORYBeOS add-ons directory.
B_BEOS_BOOT_DIRECTORYBoot volume's root directory.
B_BEOS_FONTS_DIRECTORYBeOS fonts directory.
B_BEOS_LIB_DIRECTORYBeOS libraries directory.
B_BEOS_SERVERS_DIRECTORYBeOS servers directory.
B_BEOS_APPS_DIRECTORYBeOS applications directory.
B_BEOS_BIN_DIRECTORY/bin directory.
B_BEOS_ETC_DIRECTORY/etc directory.
B_BEOS_DOCUMENTATION_DIRECTORYBeOS documentation directory.
B_BEOS_PREFERENCES_DIRECTORYBeOS preferences directory.
B_COMMON_DIRECTORYThe common directory, shared by all users.
B_COMMON_SYSTEM_DIRECTORYThe shared system directory.
B_COMMON_ADDONS_DIRECTORYThe shared addons directory.
B_COMMON_BOOT_DIRECTORYThe shared boot directory.
B_COMMON_FONTS_DIRECTORYThe shared fonts directory.
B_COMMON_LIB_DIRECTORYThe shared libraries directory.
B_COMMON_SERVERS_DIRECTORYThe shared servers directory.
B_COMMON_BIN_DIRECTORYThe shared /bin directory.
B_COMMON_ETC_DIRECTORYThe shared /etc directory.
B_COMMON_DOCUMENTATION_DIRECTORYThe shared documentation directory.
B_COMMON_SETTINGS_DIRECTORYThe shared settings directory.
B_COMMON_DEVELOP_DIRECTORYThe shared develop directory.
B_COMMON_LOG_DIRECTORYThe shared log directory.
B_COMMON_SPOOL_DIRECTORYThe shared spool directory.
B_COMMON_TEMP_DIRECTORYThe shared temporary items directory.
B_COMMON_VAR_DIRECTORYThe shared /var directory.
B_USER_DIRECTORYThe user's home directory.
B_USER_CONFIG_DIRECTORYThe user's config directory.
B_USER_ADDONS_DIRECTORYThe user's add-ons directory.
B_USER_BOOT_DIRECTORYThe user's /boot directory.
B_USER_FONTS_DIRECTORYThe user's fonts directory.
B_USER_LIB_DIRECTORYThe user's libraries directory.
B_USER_SETTINGS_DIRECTORYThe user's settings directory.
B_USER_DESKBAR_DIRECTORYThe 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

ConstantMeaning
B_LARGE_ICONLarge (32x32) icon.
B_MINI_ICONSmall (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

ConstantMeaning
B_STOP_WATCHINGStop watching the node.
B_WATCH_NAMEWatch for changes to the name of the node.
B_WATCH_STATWatch for stat changes.
B_WATCH_ATTRWatch for attribute changes.
B_WATCH_DIRECTORYWatch for changes to the directory's contents.
B_WATCH_ALLWatch everything (except mounting).
B_WATCH_MOUNTWatch 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.

Query Operation Constants

Declared in: be/storage/Query.h

ConstantOperation
B_EQ=
B_NE!=
B_GT>
B_LT<
B_GE>=
B_LE<=
B_CONTAINSstring contains value ("*value*")
B_BEGINS_WITHstring begins with value ("value*")
B_ENDS_WITHstring 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.