update emoji autocorrect entries from po-files
[LibreOffice.git] / connectivity / source / drivers / macab / MacabRecords.hxx
blob5a503525899010ac8f447e345f89b31b20a8fbca
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABRECORDS_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABRECORDS_HXX
23 #include "MacabRecord.hxx"
24 #include "MacabHeader.hxx"
26 #include <premac.h>
27 #include <Carbon/Carbon.h>
28 #include <AddressBook/ABAddressBookC.h>
29 #include <postmac.h>
30 #include <com/sun/star/util/DateTime.hpp>
32 namespace connectivity
34 namespace macab
36 /* This struct is for converting CF types to AB types (Core Foundation
37 * types to Address Book types).
39 struct lcl_CFType {
40 sal_Int32 cf;
41 sal_Int32 ab;
44 class MacabRecords{
45 protected:
46 /* MacabRecords is, at its core, a table of macabfields, in the
47 * form of a header and a list of objects of type MacabRecord.
48 * It also has a unique name that refers to the name of the table.
50 sal_Int32 recordsSize;
51 sal_Int32 currentRecord;
52 CFStringRef recordType;
53 MacabHeader *header;
54 MacabRecord **records;
55 ABAddressBookRef addressBook;
56 OUString m_sName;
58 /* For converting CF types to AB types */
59 sal_Int32 lcl_CFTypesLength;
60 lcl_CFType *lcl_CFTypes;
62 /* For required properties */
63 CFStringRef *requiredProperties;
64 sal_Int32 numRequiredProperties;
66 private:
67 /* All of the private methods are for creating a MacabHeader or a
68 * MacabRecord. They are used by the initialize method that goes
69 * about filling a MacabRecords using all of the records in the
70 * Mac OS X Address Book.
72 void bootstrap_CF_types();
73 void bootstrap_requiredProperties();
74 MacabHeader *createHeaderForProperty(const ABRecordRef _record, const CFStringRef _propertyName, const CFStringRef _recordType, const bool _isPropertyRequired) const;
75 MacabHeader *createHeaderForProperty(const ABPropertyType _propertyType, const CFTypeRef _propertyValue, const CFStringRef _propertyName) const;
76 ABPropertyType getABTypeFromCFType(const CFTypeID cf_type ) const;
77 void insertPropertyIntoMacabRecord(MacabRecord *_abrecord, const MacabHeader *_header, const OUString& _propertyName, const CFTypeRef _propertyValue) const;
78 void insertPropertyIntoMacabRecord(const ABPropertyType _propertyType, MacabRecord *_abrecord, const MacabHeader *_header, const OUString& _propertyName, const CFTypeRef _propertyValue) const;
79 public:
80 MacabRecords(const ABAddressBookRef _addressBook, MacabHeader *_header, MacabRecord **_records, sal_Int32 _numRecords);
81 MacabRecords(const MacabRecords *_copy);
82 MacabRecords(const ABAddressBookRef _addressBook);
83 ~MacabRecords();
85 void initialize();
87 void setHeader(MacabHeader *_header);
88 MacabHeader *getHeader() const;
90 void setName(const OUString& _sName);
91 OUString getName() const;
93 MacabRecord *insertRecord(MacabRecord *_newRecord, const sal_Int32 _location);
94 void insertRecord(MacabRecord *_newRecord);
95 MacabRecord *getRecord(const sal_Int32 _location) const;
96 void swap(const sal_Int32 _id1, const sal_Int32 _id2);
98 macabfield *getField(const sal_Int32 _recordNumber, const sal_Int32 _columnNumber) const;
99 macabfield *getField(const sal_Int32 _recordNumber, const OUString& _columnName) const;
100 sal_Int32 getFieldNumber(const OUString& _columnName) const;
102 sal_Int32 size() const;
104 MacabHeader *createHeaderForRecordType(const CFArrayRef _records, const CFStringRef _recordType) const;
105 MacabRecord *createMacabRecord(const ABRecordRef _abrecord, const MacabHeader *_header, const CFStringRef _recordType) const;
107 MacabRecords *begin();
108 sal_Int32 end() const;
109 class iterator{
110 protected:
111 MacabRecords *records;
112 public:
113 sal_Int32 id;
114 iterator& operator= (MacabRecords *_records);
115 iterator();
116 ~iterator();
117 void operator++ ();
118 bool operator!= (const sal_Int32 i) const;
119 bool operator== (const sal_Int32 i) const;
120 MacabRecord *operator* () const;
127 #endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABRECORDS_HXX
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */