/usr/include/barry/r_contact.h is in libbarry-dev 0.15-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | ///
/// \file r_contact.h
/// Blackberry database record parser class for contact records.
///
/*
Copyright (C) 2005-2009, Net Direct Inc. (http://www.netdirect.ca/)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the
root directory of this project for more details.
*/
#ifndef __BARRY_RECORD_CONTACT_H__
#define __BARRY_RECORD_CONTACT_H__
#include "dll.h"
#include "record.h"
#include <iosfwd>
#include <string>
#include <vector>
#include <map>
#include <stdint.h>
namespace Barry {
// forward declarations
class IConverter;
//
// NOTE: All classes here must be container-safe! Perhaps add sorting
// operators in the future.
//
struct BXEXPORT ContactGroupLink
{
uint32_t Link;
uint16_t Unknown;
ContactGroupLink() : Link(0), Unknown(0) {}
ContactGroupLink(uint32_t link, uint16_t unknown)
: Link(link), Unknown(unknown)
{}
};
/// \addtogroup RecordParserClasses
/// @{
//
// Contact record class
//
/// Represents a single record in the Address Book Blackberry database.
///
class BXEXPORT Contact
{
public:
typedef Barry::CategoryList CategoryList;
typedef ContactGroupLink GroupLink;
typedef std::vector<GroupLink> GroupLinksType;
typedef std::vector<UnknownField> UnknownsType;
typedef std::string EmailType;
typedef std::vector<EmailType> EmailList;
//
// Record fields
//
// contact specific data
uint8_t RecType;
uint32_t RecordId;
EmailList EmailAddresses;
/// This field, Phone, is deprecated. It is possible
/// to write to this field to the Blackberry,
/// but modern devices won't let you add it
/// through their GUIs. This field only seems
/// to exist on the 7750. While other devices
/// accept the field and display it, it is
/// not accessible by default.
std::string Phone;
std::string
Fax,
WorkPhone,
HomePhone,
MobilePhone,
Pager,
PIN,
Radio,
WorkPhone2,
HomePhone2,
OtherPhone,
FirstName,
LastName,
Company,
DefaultCommunicationsMethod,
JobTitle,
PublicKey,
URL,
Prefix,
Notes,
UserDefined1,
UserDefined2,
UserDefined3,
UserDefined4,
Image;
Date Birthday;
Date Anniversary;
PostalAddress WorkAddress;
PostalAddress HomeAddress;
// Categories are not allowed to have commas in them.
// A category name containing a comma will be split into
// two categories, not only by this library, but by the
// device itself.
CategoryList Categories;
GroupLinksType GroupLinks;
UnknownsType Unknowns;
private:
bool m_FirstNameSeen;
public:
const unsigned char* ParseField(const unsigned char *begin,
const unsigned char *end, const IConverter *ic = 0);
public:
Contact();
~Contact();
uint32_t GetID() const { return RecordId; }
std::string GetFullName() const;
const std::string& GetEmail(unsigned int index = 0) const;
// Parser / Builder API (see parser.h / builder.h)
uint8_t GetRecType() const { return RecType; }
uint32_t GetUniqueId() const { return RecordId; }
void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = Id; }
void ParseHeader(const Data &data, size_t &offset);
void ParseFields(const Data &data, size_t &offset, const IConverter *ic = 0);
void BuildHeader(Data &data, size_t &offset) const;
void BuildFields(Data &data, size_t &offset, const IConverter *ic = 0) const;
void Clear(); // erase everything
void Dump(std::ostream &os) const;
// sorting - put group links at the end
bool operator<(const Contact &other) const {
return GroupLinks.size() == 0 && other.GroupLinks.size() > 0;
// // testing - put group links at the top
// return GroupLinks.size() > 0 && other.GroupLinks.size() == 0;
}
// database name
static const char * GetDBName() { return "Address Book"; }
static uint8_t GetDefaultRecType() { return 0; }
// helpers
static void SplitName(const std::string &full, std::string &first, std::string &last);
};
BXEXPORT inline std::ostream& operator<< (std::ostream &os, const Contact &contact) {
contact.Dump(os);
return os;
}
/// @}
} // namespace Barry
#endif
|