hide random home http://www.be.com/documentation/be_book/support/suppAPI.html (Amiga Plus Extra No. 5/97, 05/1997)


The Support Kit: Constants and Defined Types

This section lists the constants and types 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 .


Constants


Boolean Constants


      <support/SupportDefs.h>

Defined constant Value
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


Encoding Conversion Constants

Declared in: <support/UTF8.h>

Enumerated constant Enumerated constant
B_ISO1_CONVERSION B_ISO8_CONVERSION
B_ISO2_CONVERSION B_ISO9_CONVERSION
B_ISO3_CONVERSION B_ISO10_CONVERSION
B_ISO4_CONVERSION B_MAC_ROMAN_CONVERSION
B_ISO5_CONVERSION B_SJIS_CONVERSION
B_ISO6_CONVERSION B_EUC_CONVERSION
B_ISO7_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: convert_to_utf8(), 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 ("").


NULL and NIL

Declared in: <support/SupportDefs.h>

Defined constant Value
NIL 0
NULL 0

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


Type Codes

Declared in: <support/TypeConstants.h>

Enumerated constant Meaning
B_CHAR_TYPE A single character
B_INT8_TYPE An 8-bit integer (int8, uint8, vint8, or vuint8)
B_INT16_TYPE A 16-bit integer (int16, uint16, vint16, or vuint16)
B_INT32_TYPE A 32-bit integer (int32, uint32, vint32, or vuint32)
B_INT64_TYPE A 64-bit integer (int64, uint64, vint64, or vuint64)
B_UINT8_TYPE An unsigned 8-bit integer (uint8 or vuint8)
B_UINT16_TYPE An unsigned 16-bit integer (uint16 or vuint16)
B_UINT32_TYPE An unsigned 32-bit integer (uint32 or vuint32)
B_UINT64_TYPE An unsigned 64-bit integer (uint64 or vuint64)
B_FLOAT_TYPE A float
B_DOUBLE_TYPE A double
B_BOOL_TYPE A boolean value (the bool type)
B_OFF_T_TYPE An off_t value
B_SIZE_T_TYPE A size_t value
B_SSIZE_T_TYPE An ssize_t value
B_POINTER_TYPE A pointer of some kind (including void *)
B_OBJECT_TYPE An object pointer (such as BMessage *)
B_MESSAGE_TYPE A BMessage object (not BMessage *)
B_MESSENGER_TYPE A BMessenger object
B_POINT_TYPE A BPoint object
B_RECT_TYPE A BRect object
B_PATH_TYPE A BPath object
B_REF_TYPE An entry_ref structure
B_RGB_COLOR_TYPE An rgb_color structure
B_PATTERN_TYPE A pattern structure
B_ASCII_TYPE Text in ASCII format
B_STRING_TYPE A null-terminated character string
B_MONOCHROME_1_BIT_TYPE Raw data for a monochrome bitmap (1 bit/pixel)
B_GRAYSCALE_8_BIT_TYPE Raw data for a grayscale bitmap (8 bits per pixel)
B_COLOR_8_BIT_TYPE Raw bitmap data in the B_COLOR_8_BIT color space
B_RGB_32_BIT_TYPE Raw bitmap data in the B_RGB_32_BIT color space
B_TIME_TYPE A representation of the time
B_RAW_TYPE Raw, untyped data--a stream of bytes
B_MIME_TYPE The type is specified by a MIME string.
B_ANY_TYPE The 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, or will define in the future, 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'.

To prevent clashes, the type codes you define should use a different convention. For example, you might include at least one lowercase letter in all multicharacter constants or you might choose a range of values that doesn't intersect with the range 0x41414141 through 0x5a5a5a5a.

See also: type_code, Type Codes in the Application Kit overview


Defined Types


bigtime_t

Declared in: <support/SupportDefs.h>


      typedef int64 bigtime_t  

This type records the time in microseconds as a 64-bit integer. Typically, a bigtime_t variable measures the system time, the number of microseconds since 12:00:00 AM January 1, 1970, UTC (Coordinated Universal Time).

See also: system_time()


bool

Declared in: <support/SupportDefs.h>


      typedef unsigned char bool 

The C++ language defines bool as its basic boolean type. The BeOs extends the definition to C code, so you can use the same type in both languages. The true and false constants (listed above) are defined as boolean values.


Function Pointers

Declared in: <support/SupportDefs.h>


      typedef int (*B_PFI)() 
         typedef long (*B_PFL)() 
         typedef void (*B_PFV)() 

These types are pointers to functions that return int, long, and void values respectively.


instantiation_func

Declared in: <support/Archivable.h>


      typedef BArchivable *(*instantiation_func) (BMessage *) 

This type is a pointer to a function that can instantiate an object from a BMessage archive and return a pointer to the new object. The member Instantiate() function that's part of the archiving protocol is such a function.

See also: the BArchivable class, find_instantiation_func()


Integer Types

Declared in: <support/SupportDefs.h>


      typedef unsigned char uchar 

      typedef signed char int8 
         typedef unsigned char uint8 
         typedef volatile signed char vint8 
         typedef volatile unsigned char vuint8 

      typedef short int16 
         typedef unsigned short uint16 
         typedef volatile short vint16 
         typedef volatile unsigned short vuint16 

      typedef long int32 
         typedef unsigned long uint32 
         typedef volatile long vint32 
         typedef volatile unsigned long vuint32 

      typedef long long int64 
         typedef unsigned long long uint64 
         typedef volatile long long vint64 
         typedef volatile unsigned long long vuint64 

These type names are defined as convenient shorthands for standard integers of various sizes. They're used in place of int, short, and long throughout the BeOS API.

The number at the end of the type name indicates the size of the integer. For example, a uint32 is an unsigned 32-bit value. The type is guaranteed to be defined to its stated size for all platforms (thus their exact definitions may vary from platform to platform).

Using these types will make the code you write more portable. They'll help avoid problems as the operating system and your application move to other platforms.


status_t

Declared in: <support/SupportDefs.h>


      typedef int32 status_t  

This type indicates an error code; it's used mainly for function return values.

See also: "Error Codes"


type_code

Declared in: <support/SupportDefs.h>


      typedef uint32 type_code  

This type is used for the integer codes that indicate a particular data type. The codes--such as B_UINT32_TYPE and B_MIME_TYPE--mark the type of data added to a message or stored as a resource and also appear in other contexts.

See also: the BMessage class in the Appliction Kit, the BResource class in the Storage Kit






The Be Book, in lovely HTML, for the BeOS Preview Release.

Copyright © 1997 Be, Inc. All rights reserved.

Be is a registered trademark; BeOS, BeBox, BeWare, GeekPort, the Be logo, and the BeOS logo are trademarks of Be, Inc.

Last modified June 30, 1997.