diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2017-11-01 12:46:35 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2017-11-01 23:42:02 +0100 |
commit | 1f8c3e3b78e0abb96d06a51eca354ae7ade5deb2 (patch) | |
tree | 6c402b0638d4294315444e72899e66c8ff5d93f9 /include/tools/XmlWalker.hxx | |
parent | ecbaf980625a9e7b06abe91c7c70e78f6ad469a7 (diff) |
Extract XmlWriter and XmlWalker from opencl into tools
In opencl we read and writer the profile xml with custom classes
XmlWriter and XmlWalker for reading. This classes are useful in
other places (very similar XmlWriter is used in test), so extract
the code from opencl and move it to a more common place - tools.
Refactoring of other usages will follow.
Change-Id: I8363e87b7c30083d299080adec3f99cb33ebe4cc
Reviewed-on: https://gerrit.libreoffice.org/44149
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include/tools/XmlWalker.hxx')
-rw-r--r-- | include/tools/XmlWalker.hxx | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/include/tools/XmlWalker.hxx b/include/tools/XmlWalker.hxx new file mode 100644 index 000000000000..4d4bc88f363c --- /dev/null +++ b/include/tools/XmlWalker.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_TOOLS_XMLWALKER_HXX +#define INCLUDED_TOOLS_XMLWALKER_HXX + +#include <tools/toolsdllapi.h> +#include <tools/stream.hxx> +#include <memory> + +namespace tools { + +struct XmlWalkerImpl; + +/** + * XmlWalker main purpose is to make it easier for walking the + * parsed XML DOM tree. + * + * It hides all the libxml2 and C -isms and makes the usage more + * comfortable from LO developer point of view. + * + */ +class TOOLS_DLLPUBLIC XmlWalker final +{ +private: + std::unique_ptr<XmlWalkerImpl> mpImpl; + +public: + XmlWalker(); + + ~XmlWalker(); + + bool open(SvStream* pStream); + + OString name(); + + OString content(); + void children(); + void parent(); + void next(); + bool isValid() const; + OString attribute(OString sName); +}; + +} // end tools namespace + +#endif // INCLUDED_TOOLS_XMLWRITER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |