diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-07-15 14:07:54 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-07-15 20:39:50 +0100 |
commit | e1d78e123b74d37f95b4075b93202b023b4320e9 (patch) | |
tree | 75b2b1f5b570b131e84e890cbd2b17ae294c5941 /configmgr/source/writemodfile.hxx | |
parent | cppcheck: noExplicitConstructor (diff) | |
download | core-e1d78e123b74d37f95b4075b93202b023b4320e9.tar.gz core-e1d78e123b74d37f95b4075b93202b023b4320e9.zip |
tdf#92764 - make configmgr write less noisy.
Re-factor the TempFile abstraction and add a trivial OStringBuffer to
avoid emitting so many system calls - for writing small fragments of
configuration XML.
Change-Id: Ifbf5982ddb44845b2316087cafab4175a40e03cc
Diffstat (limited to 'configmgr/source/writemodfile.hxx')
-rw-r--r-- | configmgr/source/writemodfile.hxx | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/configmgr/source/writemodfile.hxx b/configmgr/source/writemodfile.hxx index 12a09a87dc93..ffa5e30ef5de 100644 --- a/configmgr/source/writemodfile.hxx +++ b/configmgr/source/writemodfile.hxx @@ -27,9 +27,27 @@ namespace configmgr { class Components; struct Data; -void writeData(oslFileHandle handle, OString const & text); -void writeAttributeValue(oslFileHandle handle, OUString const & value); -void writeValueContent(oslFileHandle handle, OUString const & value); +struct TempFile { + OUString url; + oslFileHandle handle; + bool closed; + OStringBuffer buffer; + + TempFile(): handle(0), closed(false) {} + ~TempFile(); + void closeAndRename(const OUString &url); + oslFileError flush(); + oslFileError closeWithoutUnlink(); + void writeString(char const *begin, sal_Int32 length); + +private: + TempFile(const TempFile&) SAL_DELETED_FUNCTION; + TempFile& operator=(const TempFile&) SAL_DELETED_FUNCTION; +}; + +void writeData(TempFile &handle, OString const & text); +void writeAttributeValue(TempFile &handle, OUString const & value); +void writeValueContent(TempFile &handle, OUString const & value); void writeModFile( Components & components, OUString const & url, Data const & data); |