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
d3a59629
Kaydet (Commit)
d3a59629
authored
Agu 16, 2014
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
XmlWriter: simplify and take SvStream* as input
Change-Id: I56b2fa6887f7971604a2dcf34497ecda9cea8937
üst
8a3a2e88
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
22 deletions
+33
-22
xmlwriter.hxx
include/test/xmlwriter.hxx
+4
-1
mtfxmldump.cxx
test/source/mtfxmldump.cxx
+1
-17
xmlwriter.cxx
test/source/xmlwriter.cxx
+28
-4
No files found.
include/test/xmlwriter.hxx
Dosyayı görüntüle @
d3a59629
...
@@ -16,13 +16,16 @@
...
@@ -16,13 +16,16 @@
#include <rtl/ustring.hxx>
#include <rtl/ustring.hxx>
#include <rtl/string.hxx>
#include <rtl/string.hxx>
#include <tools/stream.hxx>
class
OOO_DLLPUBLIC_TEST
XmlWriter
class
OOO_DLLPUBLIC_TEST
XmlWriter
{
{
private
:
private
:
SvStream
*
mpStream
;
xmlTextWriterPtr
mpWriter
;
xmlTextWriterPtr
mpWriter
;
public
:
public
:
XmlWriter
(
xmlTextWriterPtr
pWriter
);
XmlWriter
(
SvStream
*
pStream
);
virtual
~
XmlWriter
();
virtual
~
XmlWriter
();
void
startDocument
();
void
startDocument
();
...
...
test/source/mtfxmldump.cxx
Dosyayı görüntüle @
d3a59629
...
@@ -22,19 +22,6 @@ namespace
...
@@ -22,19 +22,6 @@ namespace
const
size_t
constMaxActionType
=
513
;
const
size_t
constMaxActionType
=
513
;
int
lclWriteCallback
(
void
*
pContext
,
const
char
*
sBuffer
,
int
nLen
)
{
SvStream
*
pStream
=
static_cast
<
SvStream
*>
(
pContext
);
return
(
int
)
pStream
->
Write
(
sBuffer
,
nLen
);
}
int
lclCloseCallback
(
void
*
pContext
)
{
SvStream
*
pStream
=
static_cast
<
SvStream
*>
(
pContext
);
pStream
->
Flush
();
return
0
;
// 0 or -1 in case of error
}
OUString
flagToString
(
sal_uInt16
nFlag
)
OUString
flagToString
(
sal_uInt16
nFlag
)
{
{
if
(
nFlag
&
PUSH_LINECOLOR
)
if
(
nFlag
&
PUSH_LINECOLOR
)
...
@@ -253,10 +240,7 @@ xmlDocPtr MetafileXmlDump::dumpAndParse(GDIMetaFile& rMetaFile, const OUString&
...
@@ -253,10 +240,7 @@ xmlDocPtr MetafileXmlDump::dumpAndParse(GDIMetaFile& rMetaFile, const OUString&
else
else
pStream
.
reset
(
new
SvFileStream
(
rTempStreamName
,
STREAM_STD_READWRITE
|
STREAM_TRUNC
));
pStream
.
reset
(
new
SvFileStream
(
rTempStreamName
,
STREAM_STD_READWRITE
|
STREAM_TRUNC
));
xmlOutputBufferPtr
xmlOutBuffer
=
xmlOutputBufferCreateIO
(
lclWriteCallback
,
lclCloseCallback
,
pStream
.
get
(),
NULL
);
XmlWriter
aWriter
(
pStream
.
get
());
xmlTextWriterPtr
xmlWriter
=
xmlNewTextWriter
(
xmlOutBuffer
);
XmlWriter
aWriter
(
xmlWriter
);
aWriter
.
startDocument
();
aWriter
.
startDocument
();
aWriter
.
startElement
(
"metafile"
);
aWriter
.
startElement
(
"metafile"
);
...
...
test/source/xmlwriter.cxx
Dosyayı görüntüle @
d3a59629
...
@@ -20,8 +20,27 @@
...
@@ -20,8 +20,27 @@
#include <libxml/xmlstring.h>
#include <libxml/xmlstring.h>
#include <test/xmlwriter.hxx>
#include <test/xmlwriter.hxx>
XmlWriter
::
XmlWriter
(
xmlTextWriterPtr
pWriter
)
:
namespace
mpWriter
(
pWriter
)
{
int
lclWriteCallback
(
void
*
pContext
,
const
char
*
sBuffer
,
int
nLen
)
{
SvStream
*
pStream
=
static_cast
<
SvStream
*>
(
pContext
);
return
(
int
)
pStream
->
Write
(
sBuffer
,
nLen
);
}
int
lclCloseCallback
(
void
*
pContext
)
{
SvStream
*
pStream
=
static_cast
<
SvStream
*>
(
pContext
);
pStream
->
Flush
();
return
0
;
// 0 or -1 in case of error
}
}
// anonymous namespace
XmlWriter
::
XmlWriter
(
SvStream
*
pStream
)
:
mpStream
(
pStream
),
mpWriter
(
NULL
)
{}
{}
XmlWriter
::~
XmlWriter
()
XmlWriter
::~
XmlWriter
()
...
@@ -29,8 +48,13 @@ XmlWriter::~XmlWriter()
...
@@ -29,8 +48,13 @@ XmlWriter::~XmlWriter()
void
XmlWriter
::
startDocument
()
void
XmlWriter
::
startDocument
()
{
{
xmlTextWriterSetIndent
(
mpWriter
,
1
);
if
(
mpWriter
==
NULL
&&
mpStream
!=
NULL
)
xmlTextWriterStartDocument
(
mpWriter
,
NULL
,
"UTF-8"
,
NULL
);
{
xmlOutputBufferPtr
xmlOutBuffer
=
xmlOutputBufferCreateIO
(
lclWriteCallback
,
lclCloseCallback
,
mpStream
,
NULL
);
mpWriter
=
xmlNewTextWriter
(
xmlOutBuffer
);
xmlTextWriterSetIndent
(
mpWriter
,
1
);
xmlTextWriterStartDocument
(
mpWriter
,
NULL
,
"UTF-8"
,
NULL
);
}
}
}
void
XmlWriter
::
endDocument
()
void
XmlWriter
::
endDocument
()
...
...
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