⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addressdb.h

📁 palm os 上的中文伴侣源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
    union
    {
        struct
        {
            unsigned displayPhoneForList:4; /**< The phone displayed for the
                                                 List View, corresponding to the
                                                 item in the AddressPhoneLabels
                                                 enum. */
            unsigned phone7:4;              /**< Which phone label (work, home,
                                                 fax, other, ...) for this phone
                                                 field, value is an
                                                 AddressPhoneLabels enum. */
            unsigned phone6:4;
            unsigned phone5:4;
            unsigned phone4:4;
            unsigned phone3:4;
            unsigned phone2:4;
            unsigned phone1:4;
        } phones;
        UInt32 phoneBits;
    };

    union
    {
        struct
        {
            unsigned int reserved : 4;
            unsigned int address3 : 4;  /**< Which address label (work, home,
                                             other) for this address field,
                                             value is an
                                             AddressStreetAddressLabels enum. */
            unsigned int address2 : 4;
            unsigned int address1 : 4;
        }addresses;
        UInt16 addressBits;
    };

    union
    {
        struct
        {
            unsigned int reserved:8;
            unsigned int chat2:4;       /**< Which chat label (other, aim, msn,
                                          ...) for this chat field, value is an
                                             AddressChatLabels enum. */
            unsigned int chat1:4;

        }chatIds;
        UInt16 chatBits;
    };

} AddrOptionsType;

/** @brief Birthday data flags
 *
 * On/off flags for birthday features.
 */
typedef struct
{
    unsigned short reserved     :15;
    unsigned short alarm        :1; /**< Indicates if a reminder is set for this
                                         birthday. */
}
AddressDBBirthdayFlags;

/** @brief Birthday format
 *
 * This is the format of the birthday data in the record.
 */
typedef struct
{
    DateType                birthdayDate;   /**< Contains birthdate. Year should
                                                 be considered if year mask it
                                                 set. */
    AddressDBBirthdayFlags  birthdayMask;
    UInt8                   birthdayPreset; /**< Number of days for advance
                                                 reminder. */
} BirthdayInfo;

/** @brief Picture info
 *
 * AddressDBPictureInfo is a temp struct to hold the picture data.Within the
 * address record picture is stored as blob data.
 */
typedef struct
{
    UInt16  pictureDirty;   /**< set when a picture is edited or added. */
    UInt16  pictureSize;    /**< size of the image in bytes */
    void*   pictureData;    /**< image data in jpeg format, limit is 4k */
} AddressDBPictureInfo;

/** Total number of blobs a record is allowed to have */
#define apptMaxBlobs                    10

/** @brief Format of each blob attached to a record. */
typedef struct
{
    UInt32                  creatorID;
    UInt16                  size;       /**< Excludes space used by blob ID
                                             and size. */
    void *                  content;    /**< Remainder of blob is content */
} BlobType;

typedef BlobType * BlobPtr;

/** @brief Record format
 *
 * This is the unpacked record format as used by the app.  Pointers are
 * either NULL or point to strings elsewhere on the card.  All strings
 * are NULL character terminated.
 */
typedef struct
{
    /** Display by company or by name */
    AddrOptionsType         options;

    /** Container for all fields of type string */
    Char *                  fields[addrNumStringFields];

    /** Container to hold birthday information */
    BirthdayInfo            birthdayInfo;

    /**
     * Container to hold picture information: dirty flags, followed
     * by size and the actual image */
    AddressDBPictureInfo    pictureInfo;

    /** Number of blobs the record has excluding the picture blob */
    UInt16                  numBlobs;

    /** Container to hold blobs and the metadata */
    BlobType                blobs[apptMaxBlobs];

} AddrDBRecordType;

typedef AddrDBRecordType *AddrDBRecordPtr;

/***********************************************************************
 *  Contacts Application Info Block Related Data
 ***********************************************************************/

/** Record field label string. */
typedef char addressLabel[addrLabelLength];

/** @brief Field label state
 *
 * This is used to indicate changes to record field labels. e.g.:
 * Flags are set when copying the localized field labels into the
 * fieldLabels array of the AddrAppInfoType.
 */
typedef struct
{
    union
    {
        struct
        {
            UInt32 reserved     :4;

            UInt32 country      :1; /**< Set if country label is dirty. */
            UInt32 zipCode      :1; /**< Set if zipcode label is dirty. */
            UInt32 state        :1; /**< Set if state label is dirty. */
            UInt32 city         :1; /**< Set if city label is dirty. */
            UInt32 address      :1; /**< Set if address label is dirty. */

            UInt32 custom9      :1; /**< Set if custom/renameable label is
            dirty. */
            UInt32 custom8      :1;
            UInt32 custom7      :1;
            UInt32 custom6      :1;
            UInt32 custom5      :1;
            UInt32 custom4      :1;
            UInt32 custom3      :1;
            UInt32 custom2      :1;
            UInt32 custom1      :1;

            UInt32 webpage      :1; /**< Set if webpage label is dirty. */

            UInt32 chat2        :1; /**< Set if instant message id is dirty. */
            UInt32 chat1        :1;

            UInt32 phone7       :1; /**< Set if phone label is dirty. */
            UInt32 phone6       :1;
            UInt32 phone5       :1;
            UInt32 phone4       :1;
            UInt32 phone3       :1;
            UInt32 phone2       :1;
            UInt32 phone1       :1;
            UInt32 title        :1; /**< Set if title label is dirty. */
            UInt32 company      :1; /**< Set if company label is dirty. */
            UInt32 firstName    :1; /**< Set if firstName label is dirty. */
            UInt32 name         :1; /**< Set if name label is dirty (bit 0). */

        } bits;
        UInt32 allBits;
    };
    union
    {
        struct
        {
            UInt32 reserved1        :12;
            UInt32 reserved2        :7;

            UInt32 pictureInfo      :1; /**< Set if picture label is dirty. */

            UInt32 birthdayDate     :1; /**< Set if birthday label is dirty. */

            UInt32 note             :1; /**< Set if note field is dirty. */

            UInt32 country3         :1; /**< Set if address fields are dirty. */
            UInt32 zipCode3         :1;
            UInt32 state3           :1;
            UInt32 city3            :1;
            UInt32 address3         :1;

            UInt32 country2         :1;
            UInt32 zipCode2         :1;
            UInt32 state2           :1;
            UInt32 city2            :1;
            UInt32 address2         :1;

        } bits2;
        UInt32 allBits2;
    };
} AddrDBFieldLabelsDirtyFlags;

/** @brief Miscellaneous application data
 *
 * This includes any miscellaneous application wide data.
 */
typedef struct
{
    unsigned reserved:7;
    unsigned sortByCompany  :1;
} AddrDBMisc;

/** @brief Application Info Block
 *
 * This structure is used to store info applicable to all records
 * in the database, specific to the application, inter-session (like
 * preferences), etc.
 *
 * Note: The phone field labels are stored specially.  Each phone
 *       field can use one of eight labels.  Some of those eight
 *       labels are stored as the phone field labels.  The remainder
 *       (phoneLabelsStoredAtEnd) are stored after the labels for
 *       all the fields.
 */
typedef struct
{
    /** Bitfield of categories with a different name. */
    UInt16 renamedCategories;

    char   categoryLabels[dmRecNumCategories][dmCategoryLength];

    UInt8  categoryUniqIDs[dmRecNumCategories];

    /**
     * Unique IDs generated by the device are between 0 - 127.
     * Those from the PC are 128 - 255.
     */
    UInt8  lastUniqID;

    /** From the compiler word aligning things. */
    UInt8  reserved1;

    /**
     * Whether category colors were edited since last sync.
     * Least significant bit first.
     */
    UInt16 categoryColorsEdited;

    /**
     * Added as part of the Mullet version of this application,
     * so that we can later support color categories without
     * breaking the conduits.
     */
    UInt8  categoryColors[dmRecNumCategories];

    UInt16 reserved2;

    /** Labels that have changed. */
    AddrDBFieldLabelsDirtyFlags dirtyFieldLabels;

    /** Labels displayed for record fields. */
    addressLabel                fieldLabels[numFieldLabels];

    /** Country for which the database (labels) is formatted. */
    CountryType                 country;

    UInt8                       reserved;

    AddrDBMisc                  misc;

} AddrAppInfoType;

typedef AddrAppInfoType *AddrAppInfoPtr;

/** Macro to determine whether a lookup field is for phone lookup */
#define IsPhoneLookupField(p)   (addrLookupWork <= (p) && (p) <= \
                                 addrLookupMobile)

#define firstRecordFlagBits2Field   address2

/**
 * Get a bit mask for the given bit position.
 *
 * The pos argument is used to indicate what bit position
 * should be set in the 4-byte bit mask, so a pos = 2 yields:
 * 0000 0000 0000 0010
 *
 * @param pos   Position of the bit to be set in the 4 byte
 *                  bit mask.
 * @return      A 4-byte bit mask.
 */
#define BitAtPosition(pos)  ((UInt32)1 <<                               \
                            ((pos < firstRecordFlagBits2Field) ?        \
                              pos:(pos - firstRecordFlagBits2Field)) )

/**
 * Get the record flag value for the given flag index.
 *
 * @param recFlags  A AddrDBRecordFlags struct.
 * @param index     The flag index. i.e.: the flag bit position.
 *
 * @return          The value of the record flag for the given flag index.
 */
#define GetBitMacro(recFlags, index)    ((index < firstRecordFlagBits2Field) ? \
                                        ((recFlags).allBits) & BitAtPosition(  \
                                          index):((recFlags).allBits2) &       \
                                          BitAtPosition(index))

/**
 * Set the record flag value at the given flag index.
 *
 * @param recFlags  A AddrDBRecordFlags struct.
 * @param index     The index of the flag to set. i.e.:
 *                      the bit position of the flag to set.
 *
 * @return          Nothing.
 */
#define SetBitMacro(recFlags, index)    if(index < firstRecordFlagBits2Field)\
                                          (recFlags).allBits |= BitAtPosition(index);  else \
                                          (recFlags).allBits2 |=  BitAtPosition(index)

/**
 * Clear the record flag value at the given flag index.
 * This clears or sets the flag value to zero (0).
 *
 * @param recFlags  A AddrDBRecordFlags struct.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -