Warning, file /education/step/stepcore/xmlfile.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2007 Vladimir Kuznetsov <ks.vladimir@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 /** \file xmlfile.h 0008 * \brief XmlFile class 0009 */ 0010 0011 #ifndef STEPCORE_XMLFILE_H 0012 #define STEPCORE_XMLFILE_H 0013 0014 #include <QString> 0015 class QIODevice; 0016 0017 namespace StepCore { 0018 0019 class World; 0020 class Factory; 0021 0022 /** \ingroup xmlfile 0023 * \brief Class for saving and loading World as XML file 0024 */ 0025 class XmlFile { 0026 public: 0027 /** Constructs XmlFile 0028 * \param device QIODevice to save or load file 0029 * \todo TODO don't pass factory here ! 0030 */ 0031 explicit XmlFile(QIODevice* device): _device(device) {} 0032 0033 /** Save world to XML file 0034 * \param world World to save 0035 * \return true on success, false on failure 0036 * (with error message in errorString()) 0037 */ 0038 bool save(const World* world); 0039 0040 /** Load world from XML file 0041 * \param world World to which file should be loaded (should be empty) 0042 * \param factory Factory for creating new objects 0043 * \return true on success, false on failure 0044 * (with error message in errorString()) 0045 */ 0046 bool load(World* world, const Factory* factory); 0047 0048 /** Get error message from last failed save() or load() */ 0049 QString errorString() const { return _errorString; } 0050 0051 protected: 0052 QIODevice* _device; 0053 QString _errorString; 0054 0055 public: 0056 static const char* DOCTYPE; 0057 static const char* NAMESPACE_URI; 0058 static const char* VERSION; 0059 }; 0060 0061 } 0062 0063 #endif 0064