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
322d455f
Kaydet (Commit)
322d455f
authored
Eki 19, 2011
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Simplified comphelper::OSequenceIterator and its uses.
üst
5e80f012
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
56 deletions
+60
-56
sequence.hxx
comphelper/inc/comphelper/sequence.hxx
+4
-10
xmlExport.cxx
dbaccess/source/filter/xml/xmlExport.cxx
+21
-20
xmlExport.hxx
dbaccess/source/filter/xml/xmlExport.hxx
+2
-0
propertyexport.cxx
xmloff/source/forms/propertyexport.cxx
+29
-24
propertyexport.hxx
xmloff/source/forms/propertyexport.hxx
+4
-2
No files found.
comphelper/inc/comphelper/sequence.hxx
Dosyayı görüntüle @
322d455f
...
@@ -131,16 +131,10 @@ namespace comphelper
...
@@ -131,16 +131,10 @@ namespace comphelper
//=====================================================================
//=====================================================================
//= iterating through sequences
//= iterating through sequences
//=====================================================================
//=====================================================================
class
SAL_NO_VTABLE
IIterator
{
public
:
virtual
sal_Bool
hasMoreElements
()
const
=
0
;
virtual
::
com
::
sun
::
star
::
uno
::
Any
nextElement
()
=
0
;
};
/** a helper class for iterating through a sequence
/** a helper class for iterating through a sequence
*/
*/
template
<
class
TYPE
>
template
<
class
TYPE
>
class
OSequenceIterator
:
public
IIterator
class
OSequenceIterator
{
{
const
TYPE
*
m_pElements
;
const
TYPE
*
m_pElements
;
sal_Int32
m_nLen
;
sal_Int32
m_nLen
;
...
@@ -154,10 +148,10 @@ namespace comphelper
...
@@ -154,10 +148,10 @@ namespace comphelper
*/
*/
OSequenceIterator
(
const
::
com
::
sun
::
star
::
uno
::
Any
&
_rSequenceAny
);
OSequenceIterator
(
const
::
com
::
sun
::
star
::
uno
::
Any
&
_rSequenceAny
);
virtual
sal_Bool
hasMoreElements
()
const
;
sal_Bool
hasMoreElements
()
const
;
virtual
::
com
::
sun
::
star
::
uno
::
Any
nextElement
();
::
com
::
sun
::
star
::
uno
::
Any
nextElement
();
pr
otected
:
pr
ivate
:
void
construct
(
const
::
com
::
sun
::
star
::
uno
::
Sequence
<
TYPE
>&
_rSeq
);
void
construct
(
const
::
com
::
sun
::
star
::
uno
::
Sequence
<
TYPE
>&
_rSeq
);
};
};
...
...
dbaccess/source/filter/xml/xmlExport.cxx
Dosyayı görüntüle @
322d455f
...
@@ -672,6 +672,19 @@ void ODBExport::exportConnectionData()
...
@@ -672,6 +672,19 @@ void ODBExport::exportConnectionData()
exportLogin
();
exportLogin
();
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
template
<
typename
T
>
void
ODBExport
::
exportDataSourceSettingsSequence
(
::
std
::
vector
<
TypedPropertyValue
>::
iterator
const
&
in
)
{
OSequenceIterator
<
T
>
i
(
in
->
Value
);
::
rtl
::
OUString
sCurrent
;
while
(
i
.
hasMoreElements
())
{
SvXMLElementExport
aDataValue
(
*
this
,
XML_NAMESPACE_DB
,
XML_DATA_SOURCE_SETTING_VALUE
,
sal_True
,
sal_False
);
// (no whitespace inside the tag)
Characters
(
implConvertAny
(
i
.
nextElement
()));
}
}
void
ODBExport
::
exportDataSourceSettings
()
void
ODBExport
::
exportDataSourceSettings
()
{
{
if
(
m_aDataSourceSettings
.
empty
()
)
if
(
m_aDataSourceSettings
.
empty
()
)
...
@@ -715,46 +728,34 @@ void ODBExport::exportDataSourceSettings()
...
@@ -715,46 +728,34 @@ void ODBExport::exportDataSourceSettings()
else
else
{
{
// the not-that-simple case, we need to iterate through the sequence elements
// the not-that-simple case, we need to iterate through the sequence elements
SAL_WNODEPRECATED_DECLARATIONS_PUSH
::
std
::
auto_ptr
<
IIterator
>
pSequenceIterator
;
SAL_WNODEPRECATED_DECLARATIONS_POP
switch
(
aSimpleType
.
getTypeClass
())
switch
(
aSimpleType
.
getTypeClass
())
{
{
case
TypeClass_STRING
:
case
TypeClass_STRING
:
pSequenceIterator
.
reset
(
new
OSequenceIterator
<
::
rtl
::
OUString
>
(
aIter
->
Value
)
);
exportDataSourceSettingsSequence
<
::
rtl
::
OUString
>
(
aIter
);
break
;
break
;
case
TypeClass_DOUBLE
:
case
TypeClass_DOUBLE
:
pSequenceIterator
.
reset
(
new
OSequenceIterator
<
double
>
(
aIter
->
Value
)
);
exportDataSourceSettingsSequence
<
double
>
(
aIter
);
break
;
break
;
case
TypeClass_BOOLEAN
:
case
TypeClass_BOOLEAN
:
pSequenceIterator
.
reset
(
new
OSequenceIterator
<
sal_Bool
>
(
aIter
->
Value
)
);
exportDataSourceSettingsSequence
<
sal_Bool
>
(
aIter
);
break
;
break
;
case
TypeClass_BYTE
:
case
TypeClass_BYTE
:
pSequenceIterator
.
reset
(
new
OSequenceIterator
<
sal_Int8
>
(
aIter
->
Value
)
);
exportDataSourceSettingsSequence
<
sal_Int8
>
(
aIter
);
break
;
break
;
case
TypeClass_SHORT
:
case
TypeClass_SHORT
:
pSequenceIterator
.
reset
(
new
OSequenceIterator
<
sal_Int16
>
(
aIter
->
Value
)
);
exportDataSourceSettingsSequence
<
sal_Int16
>
(
aIter
);
break
;
break
;
case
TypeClass_LONG
:
case
TypeClass_LONG
:
pSequenceIterator
.
reset
(
new
OSequenceIterator
<
sal_Int32
>
(
aIter
->
Value
)
);
exportDataSourceSettingsSequence
<
sal_Int32
>
(
aIter
);
break
;
break
;
case
TypeClass_ANY
:
case
TypeClass_ANY
:
pSequenceIterator
.
reset
(
new
OSequenceIterator
<
Any
>
(
aIter
->
Value
)
);
exportDataSourceSettingsSequence
<
Any
>
(
aIter
);
break
;
break
;
default
:
default
:
OSL_FAIL
(
"unsupported sequence type !"
);
OSL_FAIL
(
"unsupported sequence type !"
);
break
;
break
;
}
}
if
(
pSequenceIterator
.
get
()
)
{
::
rtl
::
OUString
sCurrent
;
while
(
pSequenceIterator
->
hasMoreElements
())
{
SvXMLElementExport
aDataValue
(
*
this
,
XML_NAMESPACE_DB
,
XML_DATA_SOURCE_SETTING_VALUE
,
sal_True
,
sal_False
);
// (no whitespace inside the tag)
Characters
(
implConvertAny
(
pSequenceIterator
->
nextElement
()));
}
}
}
}
}
}
}
}
...
...
dbaccess/source/filter/xml/xmlExport.hxx
Dosyayı görüntüle @
322d455f
...
@@ -137,6 +137,8 @@ class ODBExport : public SvXMLExport
...
@@ -137,6 +137,8 @@ class ODBExport : public SvXMLExport
void
exportDelimiter
();
void
exportDelimiter
();
void
exportAutoIncrement
();
void
exportAutoIncrement
();
void
exportCharSet
();
void
exportCharSet
();
template
<
typename
T
>
void
exportDataSourceSettingsSequence
(
::
std
::
vector
<
TypedPropertyValue
>::
iterator
const
&
in
);
void
exportDataSourceSettings
();
void
exportDataSourceSettings
();
void
exportForms
();
void
exportForms
();
void
exportReports
();
void
exportReports
();
...
...
xmloff/source/forms/propertyexport.cxx
Dosyayı görüntüle @
322d455f
...
@@ -101,7 +101,21 @@ namespace xmloff
...
@@ -101,7 +101,21 @@ namespace xmloff
return
(
!
bIsDefaultValue
||
bIsDynamicProperty
);
return
(
!
bIsDefaultValue
||
bIsDynamicProperty
);
}
}
//---------------------------------------------------------------------
template
<
typename
T
>
void
OPropertyExport
::
exportRemainingPropertiesSequence
(
Any
const
&
value
,
token
::
XMLTokenEnum
eValueAttName
)
{
OSequenceIterator
<
T
>
i
(
value
);
while
(
i
.
hasMoreElements
())
{
::
rtl
::
OUString
sValue
(
implConvertAny
(
i
.
nextElement
()));
AddAttribute
(
XML_NAMESPACE_OFFICE
,
eValueAttName
,
sValue
);
SvXMLElementExport
aValueTag
(
m_rContext
.
getGlobalContext
(),
XML_NAMESPACE_FORM
,
token
::
XML_LIST_VALUE
,
sal_True
,
sal_False
);
}
}
void
OPropertyExport
::
exportRemainingProperties
()
void
OPropertyExport
::
exportRemainingProperties
()
{
{
// the properties tag (will be created if we have at least one no-default property)
// the properties tag (will be created if we have at least one no-default property)
...
@@ -189,49 +203,40 @@ namespace xmloff
...
@@ -189,49 +203,40 @@ namespace xmloff
continue
;
continue
;
// the not-that-simple case, we need to iterate through the sequence elements
// the not-that-simple case, we need to iterate through the sequence elements
IIterator
*
pSequenceIterator
=
NULL
;
switch
(
aExportType
.
getTypeClass
()
)
switch
(
aExportType
.
getTypeClass
()
)
{
{
case
TypeClass_STRING
:
case
TypeClass_STRING
:
pSequenceIterator
=
new
OSequenceIterator
<
::
rtl
::
OUString
>
(
aValue
);
exportRemainingPropertiesSequence
<
::
rtl
::
OUString
>
(
aValue
,
eValueAttName
);
break
;
break
;
case
TypeClass_DOUBLE
:
case
TypeClass_DOUBLE
:
pSequenceIterator
=
new
OSequenceIterator
<
double
>
(
aValue
);
exportRemainingPropertiesSequence
<
double
>
(
aValue
,
eValueAttName
);
break
;
break
;
case
TypeClass_BOOLEAN
:
case
TypeClass_BOOLEAN
:
pSequenceIterator
=
new
OSequenceIterator
<
sal_Bool
>
(
aValue
);
exportRemainingPropertiesSequence
<
sal_Bool
>
(
aValue
,
eValueAttName
);
break
;
break
;
case
TypeClass_BYTE
:
case
TypeClass_BYTE
:
pSequenceIterator
=
new
OSequenceIterator
<
sal_Int8
>
(
aValue
);
exportRemainingPropertiesSequence
<
sal_Int8
>
(
aValue
,
eValueAttName
);
break
;
break
;
case
TypeClass_SHORT
:
case
TypeClass_SHORT
:
pSequenceIterator
=
new
OSequenceIterator
<
sal_Int16
>
(
aValue
);
exportRemainingPropertiesSequence
<
sal_Int16
>
(
aValue
,
eValueAttName
);
break
;
break
;
case
TypeClass_LONG
:
case
TypeClass_LONG
:
pSequenceIterator
=
new
OSequenceIterator
<
sal_Int32
>
(
aValue
);
exportRemainingPropertiesSequence
<
sal_Int32
>
(
aValue
,
eValueAttName
);
break
;
break
;
case
TypeClass_HYPER
:
case
TypeClass_HYPER
:
pSequenceIterator
=
new
OSequenceIterator
<
sal_Int64
>
(
aValue
);
exportRemainingPropertiesSequence
<
sal_Int64
>
(
aValue
,
eValueAttName
);
break
;
break
;
default
:
default
:
OSL_FAIL
(
"OPropertyExport::exportRemainingProperties: unsupported sequence tyoe !"
);
OSL_FAIL
(
"OPropertyExport::exportRemainingProperties: unsupported sequence tyoe !"
);
break
;
break
;
}
}
if
(
pSequenceIterator
)
{
while
(
pSequenceIterator
->
hasMoreElements
())
{
sValue
=
implConvertAny
(
pSequenceIterator
->
nextElement
());
AddAttribute
(
XML_NAMESPACE_OFFICE
,
eValueAttName
,
sValue
);
SvXMLElementExport
aValueTag
(
m_rContext
.
getGlobalContext
(),
XML_NAMESPACE_FORM
,
token
::
XML_LIST_VALUE
,
sal_True
,
sal_False
);
}
}
delete
pSequenceIterator
;
}
}
}
}
catch
(...)
catch
(...)
...
...
xmloff/source/forms/propertyexport.hxx
Dosyayı görüntüle @
322d455f
...
@@ -105,8 +105,10 @@ namespace xmloff
...
@@ -105,8 +105,10 @@ namespace xmloff
*/
*/
void
examinePersistence
();
void
examinePersistence
();
/**
template
<
typename
T
>
void
exportRemainingPropertiesSequence
(
*/
com
::
sun
::
star
::
uno
::
Any
const
&
value
,
token
::
XMLTokenEnum
eValueAttName
);
void
exportRemainingProperties
();
void
exportRemainingProperties
();
/** indicates that a property has been handled by a derived class, without using the helper methods of this
/** indicates that a property has been handled by a derived class, without using the helper methods of this
...
...
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