1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _CONNECTIVITY_MACAB_RECORD_HXX_
25 #define _CONNECTIVITY_MACAB_RECORD_HXX_
26 
27 #include <cppuhelper/compbase3.hxx>
28 
29 #include <premac.h>
30 #include <Carbon/Carbon.h>
31 #include <AddressBook/ABAddressBookC.h>
32 #include <postmac.h>
33 
34 namespace connectivity
35 {
36 	namespace macab
37 	{
38 		/* a MacabRecord is at root a list of macabfields (which is just
39 		 * something to hold both a CFTypeRef (a CoreFoundation object) and
40 		 * its Address Book type.
41 		 */
42 		struct macabfield
43 		{
44 			CFTypeRef value;
45 			ABPropertyType type;
46 		};
47 
48 		class MacabRecord{
49 			protected:
50 				sal_Int32 size;
51 				macabfield **fields;
52 			protected:
53 				void releaseFields();
54 			public:
55 				MacabRecord();
56 				MacabRecord(const sal_Int32 _size);
57 				virtual ~MacabRecord();
58 				void insertAtColumn (CFTypeRef _value, ABPropertyType _type, const sal_Int32 _column);
59 				sal_Bool contains(const macabfield *_field) const;
60 				sal_Bool contains(const CFTypeRef _value) const;
61 				sal_Int32 getSize() const;
62 				macabfield *copy(const sal_Int32 i) const;
63 				macabfield *get(const sal_Int32 i) const;
64 
65 				static sal_Int32 compareFields(const macabfield *_field1, const macabfield *_field2);
66 				static macabfield *createMacabField(const ::rtl::OUString _newFieldString, const ABPropertyType _abtype);
67 				static ::rtl::OUString fieldToString(const macabfield *_aField);
68 
69 		};
70 	}
71 }
72 
73 #endif // _CONNECTIVITY_MACAB_RECORD_HXX_
74