Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
aeacebee
Kaydet (Commit)
aeacebee
authored
May 11, 2015
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
loplugin:staticmethods
Change-Id: I1730694d8856ed009b8bf02a71657ca933bc6101
üst
0617f87c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
105 additions
and
106 deletions
+105
-106
MacabAddressBook.cxx
connectivity/source/drivers/macab/MacabAddressBook.cxx
+43
-41
MacabAddressBook.hxx
connectivity/source/drivers/macab/MacabAddressBook.hxx
+1
-2
MacabDriver.cxx
connectivity/source/drivers/macab/MacabDriver.cxx
+27
-21
MacabDriver.hxx
connectivity/source/drivers/macab/MacabDriver.hxx
+0
-9
MacabRecords.cxx
connectivity/source/drivers/macab/MacabRecords.cxx
+34
-32
MacabRecords.hxx
connectivity/source/drivers/macab/MacabRecords.hxx
+0
-1
No files found.
connectivity/source/drivers/macab/MacabAddressBook.cxx
Dosyayı görüntüle @
aeacebee
...
@@ -33,6 +33,49 @@
...
@@ -33,6 +33,49 @@
using
namespace
connectivity
::
macab
;
using
namespace
connectivity
::
macab
;
using
namespace
::
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
::
uno
;
namespace
{
void
manageDuplicateGroups
(
::
std
::
vector
<
MacabGroup
*>
_xGroups
)
{
/* If we have two cases of groups, say, family, this makes it:
* family
* family (2)
*/
::
std
::
vector
<
MacabGroup
*>::
reverse_iterator
iter1
,
iter2
;
sal_Int32
count
;
for
(
iter1
=
_xGroups
.
rbegin
();
iter1
!=
_xGroups
.
rend
();
++
iter1
)
{
/* If the name matches the default table name, there is already
* (obviously) a conflict. So, start the count of groups with this
* name at 2 instead of 1.
*/
if
(
(
*
iter1
)
->
getName
()
==
MacabAddressBook
::
getDefaultTableName
()
)
count
=
2
;
else
count
=
1
;
iter2
=
iter1
;
for
(
++
iter2
;
iter2
!=
_xGroups
.
rend
();
++
iter2
)
{
if
(
(
*
iter1
)
->
getName
()
==
(
*
iter2
)
->
getName
()
)
{
count
++
;
}
}
// duplicate!
if
(
count
!=
1
)
{
OUString
sName
=
(
*
iter1
)
->
getName
()
+
" ("
+
OUString
::
number
(
count
)
+
")"
;
(
*
iter1
)
->
setName
(
sName
);
}
}
}
}
MacabAddressBook
::
MacabAddressBook
(
)
MacabAddressBook
::
MacabAddressBook
(
)
{
{
...
@@ -202,45 +245,4 @@ MacabGroup *MacabAddressBook::getMacabGroupMatch(OUString const & _groupName)
...
@@ -202,45 +245,4 @@ MacabGroup *MacabAddressBook::getMacabGroupMatch(OUString const & _groupName)
return
NULL
;
return
NULL
;
}
}
void
MacabAddressBook
::
manageDuplicateGroups
(
::
std
::
vector
<
MacabGroup
*>
_xGroups
)
const
{
/* If we have two cases of groups, say, family, this makes it:
* family
* family (2)
*/
::
std
::
vector
<
MacabGroup
*>::
reverse_iterator
iter1
,
iter2
;
sal_Int32
count
;
for
(
iter1
=
_xGroups
.
rbegin
();
iter1
!=
_xGroups
.
rend
();
++
iter1
)
{
/* If the name matches the default table name, there is already
* (obviously) a conflict. So, start the count of groups with this
* name at 2 instead of 1.
*/
if
(
(
*
iter1
)
->
getName
()
==
getDefaultTableName
()
)
count
=
2
;
else
count
=
1
;
iter2
=
iter1
;
for
(
++
iter2
;
iter2
!=
_xGroups
.
rend
();
++
iter2
)
{
if
(
(
*
iter1
)
->
getName
()
==
(
*
iter2
)
->
getName
()
)
{
count
++
;
}
}
// duplicate!
if
(
count
!=
1
)
{
OUString
sName
=
(
*
iter1
)
->
getName
()
+
" ("
+
OUString
::
number
(
count
)
+
")"
;
(
*
iter1
)
->
setName
(
sName
);
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
connectivity/source/drivers/macab/MacabAddressBook.hxx
Dosyayı görüntüle @
aeacebee
...
@@ -41,8 +41,7 @@ namespace connectivity
...
@@ -41,8 +41,7 @@ namespace connectivity
MacabRecords
*
m_xMacabRecords
;
MacabRecords
*
m_xMacabRecords
;
::
std
::
vector
<
MacabGroup
*>
m_xMacabGroups
;
::
std
::
vector
<
MacabGroup
*>
m_xMacabGroups
;
bool
m_bRetrievedGroups
;
bool
m_bRetrievedGroups
;
private
:
void
manageDuplicateGroups
(
::
std
::
vector
<
MacabGroup
*>
_xGroups
)
const
;
public
:
public
:
MacabAddressBook
();
MacabAddressBook
();
~
MacabAddressBook
();
~
MacabAddressBook
();
...
...
connectivity/source/drivers/macab/MacabDriver.cxx
Dosyayı görüntüle @
aeacebee
...
@@ -38,6 +38,32 @@ using namespace com::sun::star::sdb;
...
@@ -38,6 +38,32 @@ using namespace com::sun::star::sdb;
using
namespace
com
::
sun
::
star
::
frame
;
using
namespace
com
::
sun
::
star
::
frame
;
using
namespace
connectivity
::
macab
;
using
namespace
connectivity
::
macab
;
namespace
{
/** throws a generic SQL exception with SQLState S1000 and error code 0
*/
void
throwGenericSQLException
(
const
OUString
&
_rMessage
)
{
SQLException
aError
;
aError
.
Message
=
_rMessage
;
aError
.
SQLState
=
"S1000"
;
aError
.
ErrorCode
=
0
;
throw
aError
;
}
/** throws an SQLException saying than no Mac OS installation was found
*/
void
throwNoMacOSException
()
{
::
connectivity
::
SharedResources
aResources
;
const
OUString
sError
(
aResources
.
getResourceString
(
STR_NO_MAC_OS_FOUND
)
);
throwGenericSQLException
(
sError
);
}
}
// = MacabImplModule
// = MacabImplModule
...
@@ -122,28 +148,8 @@ void MacabImplModule::impl_unloadModule()
...
@@ -122,28 +148,8 @@ void MacabImplModule::impl_unloadModule()
void
MacabImplModule
::
init
()
void
MacabImplModule
::
init
()
{
{
if
(
!
impl_loadModule
()
)
if
(
!
impl_loadModule
()
)
impl_throwNoMacOSException
();
throwNoMacOSException
();
}
void
MacabImplModule
::
impl_throwNoMacOSException
()
{
::
connectivity
::
SharedResources
aResources
;
const
OUString
sError
(
aResources
.
getResourceString
(
STR_NO_MAC_OS_FOUND
)
);
impl_throwGenericSQLException
(
sError
);
}
void
MacabImplModule
::
impl_throwGenericSQLException
(
const
OUString
&
_rMessage
)
{
SQLException
aError
;
aError
.
Message
=
_rMessage
;
aError
.
SQLState
=
"S1000"
;
aError
.
ErrorCode
=
0
;
throw
aError
;
}
}
...
...
connectivity/source/drivers/macab/MacabDriver.hxx
Dosyayı görüntüle @
aeacebee
...
@@ -99,15 +99,6 @@ namespace connectivity
...
@@ -99,15 +99,6 @@ namespace connectivity
@precond m_hConnectorModule is not <NULL/>
@precond m_hConnectorModule is not <NULL/>
*/
*/
void
impl_unloadModule
();
void
impl_unloadModule
();
/** throws an SQLException saying than no Mac OS installation was found
*/
void
impl_throwNoMacOSException
();
/** throws a generic SQL exception with SQLState S1000 and error code 0
*/
void
impl_throwGenericSQLException
(
const
OUString
&
_rMessage
);
};
};
...
...
connectivity/source/drivers/macab/MacabRecords.cxx
Dosyayı görüntüle @
aeacebee
...
@@ -32,6 +32,40 @@
...
@@ -32,6 +32,40 @@
using
namespace
connectivity
::
macab
;
using
namespace
connectivity
::
macab
;
using
namespace
com
::
sun
::
star
::
util
;
using
namespace
com
::
sun
::
star
::
util
;
namespace
{
void
manageDuplicateHeaders
(
macabfield
**
_headerNames
,
const
sal_Int32
_length
)
{
/* If we have two cases of, say, phone: home, this makes it:
* phone: home (1)
* phone: home (2)
*/
sal_Int32
i
,
j
;
sal_Int32
count
;
for
(
i
=
_length
-
1
;
i
>=
0
;
i
--
)
{
count
=
1
;
for
(
j
=
i
-
1
;
j
>=
0
;
j
--
)
{
if
(
CFEqual
(
_headerNames
[
i
]
->
value
,
_headerNames
[
j
]
->
value
))
{
count
++
;
}
}
// duplicate!
if
(
count
!=
1
)
{
// There is probably a better way to do this...
OUString
newName
=
CFStringToOUString
(
static_cast
<
CFStringRef
>
(
_headerNames
[
i
]
->
value
));
CFRelease
(
_headerNames
[
i
]
->
value
);
newName
+=
" ("
+
OUString
::
number
(
count
)
+
")"
;
_headerNames
[
i
]
->
value
=
OUStringToCFString
(
newName
);
}
}
}
}
MacabRecords
::
MacabRecords
(
const
ABAddressBookRef
_addressBook
,
MacabHeader
*
_header
,
MacabRecord
**
_records
,
sal_Int32
_numRecords
)
MacabRecords
::
MacabRecords
(
const
ABAddressBookRef
_addressBook
,
MacabHeader
*
_header
,
MacabRecord
**
_records
,
sal_Int32
_numRecords
)
{
{
...
@@ -811,38 +845,6 @@ MacabHeader *MacabRecords::createHeaderForProperty(const ABPropertyType _propert
...
@@ -811,38 +845,6 @@ MacabHeader *MacabRecords::createHeaderForProperty(const ABPropertyType _propert
}
}
void
MacabRecords
::
manageDuplicateHeaders
(
macabfield
**
_headerNames
,
const
sal_Int32
_length
)
const
{
/* If we have two cases of, say, phone: home, this makes it:
* phone: home (1)
* phone: home (2)
*/
sal_Int32
i
,
j
;
sal_Int32
count
;
for
(
i
=
_length
-
1
;
i
>=
0
;
i
--
)
{
count
=
1
;
for
(
j
=
i
-
1
;
j
>=
0
;
j
--
)
{
if
(
CFEqual
(
_headerNames
[
i
]
->
value
,
_headerNames
[
j
]
->
value
))
{
count
++
;
}
}
// duplicate!
if
(
count
!=
1
)
{
// There is probably a better way to do this...
OUString
newName
=
CFStringToOUString
(
static_cast
<
CFStringRef
>
(
_headerNames
[
i
]
->
value
));
CFRelease
(
_headerNames
[
i
]
->
value
);
newName
+=
" ("
+
OUString
::
number
(
count
)
+
")"
;
_headerNames
[
i
]
->
value
=
OUStringToCFString
(
newName
);
}
}
}
/* Create a MacabRecord out of an ABRecord, using a given MacabHeader and
/* Create a MacabRecord out of an ABRecord, using a given MacabHeader and
* the record's type. We go through each property for this record type
* the record's type. We go through each property for this record type
* then process it much like we processed the header (above), with two
* then process it much like we processed the header (above), with two
...
...
connectivity/source/drivers/macab/MacabRecords.hxx
Dosyayı görüntüle @
aeacebee
...
@@ -73,7 +73,6 @@ namespace connectivity
...
@@ -73,7 +73,6 @@ namespace connectivity
void
bootstrap_requiredProperties
();
void
bootstrap_requiredProperties
();
MacabHeader
*
createHeaderForProperty
(
const
ABRecordRef
_record
,
const
CFStringRef
_propertyName
,
const
CFStringRef
_recordType
,
const
bool
_isPropertyRequired
)
const
;
MacabHeader
*
createHeaderForProperty
(
const
ABRecordRef
_record
,
const
CFStringRef
_propertyName
,
const
CFStringRef
_recordType
,
const
bool
_isPropertyRequired
)
const
;
MacabHeader
*
createHeaderForProperty
(
const
ABPropertyType
_propertyType
,
const
CFTypeRef
_propertyValue
,
const
CFStringRef
_propertyName
)
const
;
MacabHeader
*
createHeaderForProperty
(
const
ABPropertyType
_propertyType
,
const
CFTypeRef
_propertyValue
,
const
CFStringRef
_propertyName
)
const
;
void
manageDuplicateHeaders
(
macabfield
**
_headerNames
,
const
sal_Int32
_length
)
const
;
ABPropertyType
getABTypeFromCFType
(
const
CFTypeID
cf_type
)
const
;
ABPropertyType
getABTypeFromCFType
(
const
CFTypeID
cf_type
)
const
;
void
insertPropertyIntoMacabRecord
(
MacabRecord
*
_abrecord
,
const
MacabHeader
*
_header
,
const
OUString
&
_propertyName
,
const
CFTypeRef
_propertyValue
)
const
;
void
insertPropertyIntoMacabRecord
(
MacabRecord
*
_abrecord
,
const
MacabHeader
*
_header
,
const
OUString
&
_propertyName
,
const
CFTypeRef
_propertyValue
)
const
;
void
insertPropertyIntoMacabRecord
(
const
ABPropertyType
_propertyType
,
MacabRecord
*
_abrecord
,
const
MacabHeader
*
_header
,
const
OUString
&
_propertyName
,
const
CFTypeRef
_propertyValue
)
const
;
void
insertPropertyIntoMacabRecord
(
const
ABPropertyType
_propertyType
,
MacabRecord
*
_abrecord
,
const
MacabHeader
*
_header
,
const
OUString
&
_propertyName
,
const
CFTypeRef
_propertyValue
)
const
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment