Constants

This section lists the constants defined by the Support Kit and used throughout the entire Be operating system. Not included here are constants used as status_t values (error codes). They're listed in "Error Codes".


Boolean Constants

Declared in: support/SupportDefs.h

ConstantDescription

false

0

true

1

These constants are defined as values for the bool type (described in the next section). The BeOS defines them for C code only. Because they match the boolean symbols that are part of the C++ language, they let you use the same bool type and true and false values when programming in both languages.

See also: bool


Byte Swapping Constants

Declared in: support/ByteOrder.h

ConstantDescription

B_SWAP_HOST_TO_LENDIAN

Convert from host byte order to little endian

B_SWAP_HOST_TO_BENDIAN

Convert from host byte order to big endian

B_SWAP_LENDIAN_TO_HOST

Convert from little endian to host byte order

B_SWAP_BENDIAN_TO_HOST

Convert from big endian to host byte order

B_SWAP_ALWAYS

Always convert endianness

These constants define the action to be taken by the swap_data() general byte swapping function.


Encoding Conversion Constants

Declared in: support/UTF8.h

B_ISO1_CONVERSIONB_MAC_ROMAN_CONVERSION
B_ISO2_CONVERSIONB_SJIS_CONVERSION
B_ISO3_CONVERSIONB_EUC_CONVERSION
B_ISO4_CONVERSIONB_JIS_CONVERSION
B_ISO5_CONVERSIONB_MS_WINDOWS_CONVERSION
B_ISO6_CONVERSIONB_UNICODE_CONVERSION
B_ISO7_CONVERSIONB_KOI8R_CONVERSION
B_ISO8_CONVERSIONB_MS_WINDOWS_1251_CONVERSION
B_ISO9_CONVERSIONB_MS_DOS_866_CONVERSION
B_ISO10_CONVERSION 

These constants identify character encodings to the convert_to_utf8() and convert_from_utf8() functions, which convert text to and from the standard UTF8 character encoding assumed by the BeOS. The identify the source encoding for a conversion to UTF-8 and the destination encoding for a conversion from UTF-8.

See also: The BFont class in the Interface Kit


Empty String

Declared in: support/SupportDefs.h

const char* B_EMPTY_STRING

This constant provides a global pointer to an empty string ("").


URL MIME Types

Declared in: support/TypeConstants.h

ConstantDescription
B_URL_HTTPAn HTTP (HyperText Transport Protocol) link
B_URL_HTTPSAn HTTPS (HyperText Transport Protocol Secure) link
B_URL_FTPAn FTP (File Transfer Protocol) link
B_URL_GOPHERA Gopher link
B_URL_MAILTOA mailto (email) link
B_URL_NEWSA news (usenet) link
B_URL_NNTPAn NNTP (network time protocol) link
B_URL_TELNETA telnet link
B_URL_RLOGINAn rlogin link
B_URL_TN3270A TN3270 link
B_URL_WAISA WAIS (Wide Area Information Services) link
B_URL_FILEA local file link

These are MIME type strings for various URL types. An application can register itself as a handler for one of these types. Once that's done, clicking a link of that type in NetPositive will cause that application to be launched, with a B_ARGV_RECEIVED message with the full URL as the second argument.


NULL and NIL

Declared in: support/SupportDefs.h

ConstantValue
NIL0
NULL0

These constants represent "empty" values. They're synonyms that can be used interchangeably.


Type Codes

Declared in: support/TypeConstants.h

ConstantDescription
B_CHAR_TYPEA single character
B_INT8_TYPEAn 8-bit integer
B_INT16_TYPEA 16-bit integer
B_INT32_TYPEA 32-bit integer
B_INT64_TYPEA 64-bit integer
B_UINT8_TYPEAn unsigned 8-bit integer
B_UINT16_TYPEAn unsigned 16-bit integer
B_UINT32_TYPEAn unsigned 32-bit integer
B_UINT64_TYPEAn unsigned 64-bit integer
B_FLOAT_TYPEA float
B_DOUBLE_TYPEA double
B_BOOL_TYPEA boolean value (the bool type)
B_OFF_T_TYPEAn off_t value
B_SIZE_T_TYPEA size_t value
B_SSIZE_T_TYPEAn ssize_t value
B_POINTER_TYPEA pointer of some kind (including void*)
B_OBJECT_TYPEAn object pointer (such as BMessage*)
B_MESSAGE_TYPEA BMessage object (not BMessage*)
B_MESSENGER_TYPEA BMessenger object
B_POINT_TYPEA BPoint object
B_RECT_TYPEA BRect object
B_PATH_TYPEA BPath object
B_REF_TYPEAn entry_ref structure
B_RGB_COLOR_TYPEAn rgb_color structure
B_PATTERN_TYPEA pattern structure
B_STRING_TYPEA null-terminated character string
B_MONOCHROME_1_BIT_TYPERaw data for a monochrome bitmap (1 bit/pixel)
B_GRAYSCALE_8_BIT_TYPERaw data for a grayscale bitmap (8 bits per pixel)
B_COLOR_8_BIT_TYPERaw bitmap data in the B_COLOR_8_BIT color space
B_RGB_32_BIT_TYPERaw bitmap data in the B_RGB_32_BIT color space
B_TIME_TYPE64-bit microsecond time_t data
B_MEDIA_PARAMETER_TYPEA Media Kit parameter.
B_MEDIA_PARAMETER_WEB_TYPEA Media Kit parameter web.
B_MEDIA_PARAMETER_GROUP_TYPEA Media Kit parameter group.
B_RAW_TYPERaw, untyped data—a stream of bytes
B_MIME_TYPEThe type is specified by a MIME string.
B_ANY_TYPEThe type can be any type.

These constants describe the types of data held by BMessage objects (the Application Kit) and as resources and file system attributes (the Storage Kit). B_ANY_TYPE refers to all types; it indicates that the exact type doesn't matter. B_MIME_TYPE indicates that the name of the data in the BMessage is a MIME string that specifies its true data type. The other constants refer only to a particular type. The type_code defined type marks where these constants are used in the API.

Applications can define their own type codes for data types not found on this list. All the codes the BeOS defines have values formed by concatenating four uppercase letters into a multicharacter constant. For example, B_MESSENGER_TYPE is 'MSNG' and B_SIZE_T_TYPE is 'SIZT'.

See also: type_code

Creative Commons License
Legal Notice
This work is licensed under a Creative Commons Attribution-Non commercial-No Derivative Works 3.0 License.