23#include <com/sun/star/util/DateTime.hpp>
26#include <Carbon/Carbon.h>
27#include <AddressBook/ABAddressBookC.h>
36MacabRecord::MacabRecord() :
size(0)
70 if(
fields[_column] ==
nullptr)
73 fields[_column]->value = _value;
76 fields[_column]->type = _type;
126 CFRetain(_copy->
value);
169 if(_field1 == _field2)
171 if(_field1 ==
nullptr)
173 if(_field2 ==
nullptr)
181 return(_field1->
type - _field2->
type);
183 CFComparisonResult
result;
186 switch(_field1->
type)
188 case kABStringProperty:
190 static_cast<CFStringRef
>(_field1->
value),
191 static_cast<CFStringRef
>(_field2->
value),
192 kCFCompareLocalized);
195 case kABDateProperty:
197 static_cast<CFDateRef
>(_field1->
value),
198 static_cast<CFDateRef
>(_field2->
value),
202 case kABIntegerProperty:
203 case kABRealProperty:
205 static_cast<CFNumberRef
>(_field1->
value),
206 static_cast<CFNumberRef
>(_field2->
value),
211 result = kCFCompareEqualTo;
214 return static_cast<sal_Int32
>(
result);
228 case kABStringProperty:
231 newField->
type = _abType;
233 case kABDateProperty:
238 if(aDateTime.Year == 0 && aDateTime.Month == 0 && aDateTime.Day == 0)
244 nTime -= kCFAbsoluteTimeIntervalSince1970;
246 newField->
value = CFDateCreate(
nullptr,
static_cast<CFAbsoluteTime
>(nTime));
247 newField->
type = _abType;
251 case kABIntegerProperty:
254 sal_Int64 nVal = _newFieldString.toInt64();
257 newField->
value = CFNumberCreate(
nullptr,kCFNumberLongType, &nVal);
258 newField->
type = _abType;
265 case kABRealProperty:
268 double nVal = _newFieldString.toDouble();
271 newField->
value = CFNumberCreate(
nullptr,kCFNumberDoubleType, &nVal);
272 newField->
type = _abType;
293 if(_aField ==
nullptr)
296 OUString fieldString;
298 switch(_aField->
type)
300 case kABStringProperty:
303 case kABDateProperty:
309 case kABIntegerProperty:
311 CFNumberType numberType = CFNumberGetType(
static_cast<CFNumberRef
>(_aField->
value) );
314 bool m_bSuccess = !CFNumberGetValue(
static_cast<CFNumberRef
>(_aField->
value), numberType, &nVal);
316 fieldString = OUString::number(nVal);
319 case kABRealProperty:
321 CFNumberType numberType = CFNumberGetType(
static_cast<CFNumberRef
>(_aField->
value) );
324 bool m_bSuccess = !CFNumberGetValue(
static_cast<CFNumberRef
>(_aField->
value), numberType, &nVal);
326 fieldString = OUString::number(nVal);
static double toDouble(std::string_view rString)
std::unique_ptr< macabfield *[]> fields
void insertAtColumn(CFTypeRef _value, ABPropertyType _type, const sal_Int32 _column)
macabfield * get(const sal_Int32 i) const
static macabfield * createMacabField(const OUString &_newFieldString, const ABPropertyType _abtype)
sal_Int32 getSize() const
static OUString fieldToString(const macabfield *_aField)
static sal_Int32 compareFields(const macabfield *_field1, const macabfield *_field2)
macabfield * copy(const sal_Int32 i) const
bool contains(const macabfield *_field) const
CFStringRef OUStringToCFString(const OUString &aString)
css::util::DateTime CFDateToDateTime(const CFDateRef _cfDate)
OUString CFStringToOUString(const CFStringRef sOrig)