00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef DBUS_STRING_PRIVATE_H
00025 #define DBUS_STRING_PRIVATE_H
00026
00027 #include <dbus/dbus-memory.h>
00028 #include <dbus/dbus-types.h>
00029
00030 #ifndef DBUS_CAN_USE_DBUS_STRING_PRIVATE
00031 #error "Don't go including dbus-string-private.h for no good reason"
00032 #endif
00033
00034 DBUS_BEGIN_DECLS
00035
00042 typedef struct
00043 {
00044 unsigned char *str;
00045 int len;
00046 int allocated;
00047 int max_length;
00048 unsigned int constant : 1;
00049 unsigned int locked : 1;
00050 unsigned int invalid : 1;
00051 unsigned int align_offset : 3;
00052 } DBusRealString;
00053
00054
00069 #define _DBUS_STRING_MAX_MAX_LENGTH (_DBUS_INT32_MAX - _DBUS_STRING_ALLOCATION_PADDING)
00070
00076 #define DBUS_GENERIC_STRING_PREAMBLE(real) _dbus_assert ((real) != NULL); _dbus_assert (!(real)->invalid); _dbus_assert ((real)->len >= 0); _dbus_assert ((real)->allocated >= 0); _dbus_assert ((real)->max_length >= 0); _dbus_assert ((real)->len <= ((real)->allocated - _DBUS_STRING_ALLOCATION_PADDING)); _dbus_assert ((real)->len <= (real)->max_length)
00077
00084 #define DBUS_STRING_PREAMBLE(str) DBusRealString *real = (DBusRealString*) str; \
00085 DBUS_GENERIC_STRING_PREAMBLE (real); \
00086 _dbus_assert (!(real)->constant); \
00087 _dbus_assert (!(real)->locked)
00088
00096 #define DBUS_LOCKED_STRING_PREAMBLE(str) DBusRealString *real = (DBusRealString*) str; \
00097 DBUS_GENERIC_STRING_PREAMBLE (real); \
00098 _dbus_assert (!(real)->constant)
00099
00105 #define DBUS_CONST_STRING_PREAMBLE(str) const DBusRealString *real = (DBusRealString*) str; \
00106 DBUS_GENERIC_STRING_PREAMBLE (real)
00107
00112 #define DBUS_IS_ASCII_BLANK(c) ((c) == ' ' || (c) == '\t')
00113
00118 #define DBUS_IS_ASCII_WHITE(c) ((c) == ' ' || (c) == '\t' || (c) == '\n' || (c) == '\r')
00119
00122 DBUS_END_DECLS
00123
00124 #endif