TypeConstants.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005 Palmsource, Inc.
00003  * 
00004  * This software is licensed as described in the file LICENSE, which
00005  * you should have received as part of this distribution. The terms
00006  * are also available at http://www.openbinder.org/license.html.
00007  * 
00008  * This software consists of voluntary contributions made by many
00009  * individuals. For the exact contribution history, see the revision
00010  * history and logs, available at http://www.openbinder.org
00011  */
00012 
00013 #ifndef _SUPPORT_TYPECONSTANTS_H
00014 #define _SUPPORT_TYPECONSTANTS_H
00015 
00021 #ifdef __cplusplus
00022 #if _SUPPORTS_NAMESPACE
00023 namespace palmos {
00024 namespace support {
00025 #endif
00026 #endif
00027 
00032 /*-------------------------------------------------------------*/
00033 /*----- Data Types --------------------------------------------*/
00034 
00046 
00048 enum {
00049     B_TYPE_CODE_MASK            = 0x7f7f7f00,   // Usable bits for the type code
00050     B_TYPE_CODE_SHIFT           = 8,            // Where code appears.
00051 
00052     B_TYPE_LENGTH_MASK          = 0x00000007,   // Usable bits for the data length
00053     B_TYPE_LENGTH_MAX           = 0x00000004,   // Largest length that can be encoded in type
00054     B_TYPE_LENGTH_LARGE         = 0x00000005,   // Value when length is > 4 bytes
00055     B_TYPE_LENGTH_MAP           = 0x00000007,   // For use by SValue
00056 
00057     B_TYPE_BYTEORDER_MASK       = 0x80000080,   // Bits used to check byte order
00058     B_TYPE_BYTEORDER_NORMAL     = 0x00000080,   // This bit is set if the byte order is okay
00059     B_TYPE_BYTEORDER_SWAPPED    = 0x80000000    // This bit is set if the byte order is swapped
00060 };
00061 
00063 #define B_PACK_SMALL_TYPE(code, length)         (((code)&B_TYPE_CODE_MASK) | (length) | B_TYPE_BYTEORDER_NORMAL)
00064 
00065 #define B_PACK_LARGE_TYPE(code)                 (((code)&B_TYPE_CODE_MASK) | B_TYPE_LENGTH_LARGE | B_TYPE_BYTEORDER_NORMAL)
00066 
00067 #define B_UNPACK_TYPE_CODE(type)                ((type)&B_TYPE_CODE_MASK)
00068 
00069 #define B_UNPACK_TYPE_LENGTH(type)              ((type)&B_TYPE_LENGTH_MASK)
00070 
00072 
00073 #define B_TYPE_CODE(code)                       (((code)<<B_TYPE_CODE_SHIFT)&B_TYPE_CODE_MASK)
00074 
00076 enum {
00077     // Special code to match any type code in comparisons.
00078     B_ANY_TYPE                  = B_TYPE_CODE('any'),
00079     
00080     // Built-in value types.
00081     B_UNDEFINED_TYPE            = B_TYPE_CODE(0),
00082     B_WILD_TYPE                 = B_TYPE_CODE('wld'),
00083     B_NULL_TYPE                 = B_TYPE_CODE('nul'),
00084     B_VALUE_TYPE                = B_TYPE_CODE('val'),
00085     B_SYSTEM_TYPE               = B_TYPE_CODE('sys'),
00086     B_FIXED_ARRAY_TYPE          = B_TYPE_CODE('arf'),
00087     B_VARIABLE_ARRAY_TYPE       = B_TYPE_CODE('arv'),
00088     B_ERROR_TYPE                = B_TYPE_CODE('err'),
00089     
00090     // Object types.
00091     B_BINDER_TYPE               = B_TYPE_CODE('sb*'),
00092     B_BINDER_WEAK_TYPE          = B_TYPE_CODE('wb*'),
00093     B_BINDER_HANDLE_TYPE        = B_TYPE_CODE('sh*'),
00094     B_BINDER_WEAK_HANDLE_TYPE   = B_TYPE_CODE('wh*'),
00095     B_BINDER_NODE_TYPE          = B_TYPE_CODE('sn*'),
00096     B_BINDER_WEAK_NODE_TYPE     = B_TYPE_CODE('wn*'),
00097     B_ATOM_TYPE                 = B_TYPE_CODE('sa*'),
00098     B_ATOM_WEAK_TYPE            = B_TYPE_CODE('wa*'),
00099     B_KEY_ID_TYPE               = B_TYPE_CODE('ky*'),
00100     
00101     // General types.
00102     B_BOOL_TYPE                 = B_TYPE_CODE('bol'),   // Support Kit
00103     B_INT8_TYPE                 = B_TYPE_CODE('i08'),
00104     B_INT16_TYPE                = B_TYPE_CODE('i16'),
00105     B_INT32_TYPE                = B_TYPE_CODE('i32'),
00106     B_INT64_TYPE                = B_TYPE_CODE('i64'),
00107     B_FLOAT_TYPE                = B_TYPE_CODE('flt'),
00108     B_DOUBLE_TYPE               = B_TYPE_CODE('dbl'),
00109     B_STRING_TYPE               = B_TYPE_CODE('str'),
00110     B_BIGTIME_TYPE              = B_TYPE_CODE('btm'),
00111     B_NSECS_TYPE                = B_TYPE_CODE('nst'),
00112     B_URL_TYPE                  = B_TYPE_CODE('url'),
00113     B_TIMEZONE_TYPE             = B_TYPE_CODE('zon'),
00114     B_ENCODED_TEXT_TYPE         = B_TYPE_CODE('etx'),
00115     B_STATUS_TYPE               = B_TYPE_CODE('sts'),
00116     B_RAW_TYPE                  = B_TYPE_CODE('raw'),
00117     B_BASE64_TYPE               = B_TYPE_CODE('bas'),
00118     B_PACKAGE_TYPE              = B_TYPE_CODE('pkg'),
00119 
00120     B_POINT_TYPE                = B_TYPE_CODE('pnt'),   // Render Kit
00121     B_RECT_TYPE                 = B_TYPE_CODE('rct'),
00122     B_INSETS_TYPE               = B_TYPE_CODE('ist'),
00123     B_COLOR_32_TYPE             = B_TYPE_CODE('icl'),
00124     B_COLOR_TYPE                = B_TYPE_CODE('fcl'),
00125     B_REGION_TYPE               = B_TYPE_CODE('rgn'),
00126     B_SREGION_TYPE              = B_TYPE_CODE('srg'),
00127     B_TRANSFORM_2D_TYPE         = B_TYPE_CODE('t2d'),
00128     B_TRANSFORM_COLOR_TYPE      = B_TYPE_CODE('tcl'),
00129     B_GRADIENT_TYPE             = B_TYPE_CODE('grd'),
00130     B_DIMTH_TYPE                = B_TYPE_CODE('dmt'),
00131     B_FONT_TYPE                 = B_TYPE_CODE('fnt'),
00132     B_FONT_HEIGHT_TYPE          = B_TYPE_CODE('fgt'),
00133     B_GLYPH_MAP_TYPE            = B_TYPE_CODE('gmp'),
00134     B_PIXMAP_TYPE               = B_TYPE_CODE('pix'),
00135     B_BITMAP_TYPE               = B_TYPE_CODE('bmp'),
00136     B_RASTER_POINT_TYPE         = B_TYPE_CODE('rpt'),
00137     B_RASTER_RECT_TYPE          = B_TYPE_CODE('rrt'),
00138     B_RASTER_REGION_TYPE        = B_TYPE_CODE('rrg'),
00139     B_SRASTER_REGION_TYPE       = B_TYPE_CODE('srr'),
00140     B_PALETTE_TYPE              = B_TYPE_CODE('pal'),
00141     B_SPATH_TYPE                = B_TYPE_CODE('spt'),
00142 
00143     B_UPDATE_TYPE               = B_TYPE_CODE('upd'),
00144     B_SUPDATE_TYPE              = B_TYPE_CODE('Upd'),
00145     B_CONSTRAINT_AXIS_TYPE      = B_TYPE_CODE('cax'),   // View Kit
00146 
00147     B_UUID_TYPE                 = B_TYPE_CODE('uid'),
00148 
00149     // Questionable types.
00150     B_CHAR_TYPE                 = B_TYPE_CODE('chr'),
00151     B_CONSTCHAR_TYPE            = B_TYPE_CODE('cch'),
00152     B_WCHAR_TYPE                = B_TYPE_CODE('wch'),
00153     B_MIME_TYPE                 = B_TYPE_CODE('mim'),
00154     B_OFF_T_TYPE                = B_TYPE_CODE('oft'),
00155     B_SIZE_T_TYPE               = B_TYPE_CODE('szt'),
00156     B_SSIZE_T_TYPE              = B_TYPE_CODE('sst'),
00157     B_TIME_TYPE                 = B_TYPE_CODE('tim'),
00158     B_UINT64_TYPE               = B_TYPE_CODE('u64'),
00159     B_UINT32_TYPE               = B_TYPE_CODE('u32'),
00160     B_UINT16_TYPE               = B_TYPE_CODE('u16'),
00161     B_UINT8_TYPE                = B_TYPE_CODE('u08')
00162 };
00163 
00164 /*-------------------------------------------------------------*/
00165 
00168 #ifdef __cplusplus
00169 #if _SUPPORTS_NAMESPACE
00170 } } // namespace palmos::support
00171 #endif
00172 
00173 #endif
00174 
00175 #endif /* _SUPPORT_TYPECONSTANTS_H */