LCOV - code coverage report
Current view: top level - src/engraving/rw - xmlwriter.h Coverage Total Hit
Test: filtered_coverage.info Lines: 100.0 % 1 1
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-Studio-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2021 MuseScore Limited and others
       9              :  *
      10              :  * This program is free software: you can redistribute it and/or modify
      11              :  * it under the terms of the GNU General Public License version 3 as
      12              :  * published by the Free Software Foundation.
      13              :  *
      14              :  * This program is distributed in the hope that it will be useful,
      15              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17              :  * GNU General Public License for more details.
      18              :  *
      19              :  * You should have received a copy of the GNU General Public License
      20              :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      21              :  */
      22              : #pragma once
      23              : 
      24              : #include "io/iodevice.h"
      25              : #include "serialization/xmlstreamwriter.h"
      26              : 
      27              : #include "../dom/property.h"
      28              : 
      29              : namespace mu::engraving {
      30              : class EngravingObject;
      31              : class XmlWriter : public muse::XmlStreamWriter
      32              : {
      33              : public:
      34          293 :     XmlWriter() = default;
      35              :     XmlWriter(muse::io::IODevice* dev);
      36              :     ~XmlWriter();
      37              : 
      38              :     const std::vector<std::pair<const EngravingObject*, AsciiStringView> >& elements() const { return _elements; }
      39              :     void setRecordElements(bool record) { _recordElements = record; }
      40              : 
      41              :     void startElementRaw(const String& name);
      42              :     void startElement(const AsciiStringView& name, const Attributes& attrs = {});
      43              :     void startElement(const EngravingObject* se, const Attributes& attrs = {});
      44              :     void startElement(const AsciiStringView& name, const EngravingObject* se, const Attributes& attrs = {});
      45              : 
      46              :     void tag(const AsciiStringView& name, const Attributes& attrs = {});
      47              :     void tag(const AsciiStringView& name, const Value& body);
      48              :     void tag(const AsciiStringView& name, const Value& val, const Value& def);
      49              :     void tag(const AsciiStringView& name, const Attributes& attrs, const Value& body);
      50              :     void tagRaw(const String& elementWithAttrs, const Value& body = Value());
      51              : 
      52              :     void tagProperty(Pid id, const PropertyValue& data, const PropertyValue& def = PropertyValue());
      53              :     void tagProperty(const AsciiStringView&, const PropertyValue& data, const PropertyValue& def = PropertyValue());
      54              : 
      55              :     void tagFraction(const AsciiStringView& name, const Fraction& v, const Fraction& def = Fraction());
      56              :     void tagPoint(const AsciiStringView& name, const PointF& v);
      57              : 
      58              :     void writeXml(const String&, String s);
      59              : 
      60              :     void comment(const String& text);
      61              : 
      62              :     static String xmlString(const String&);
      63              : 
      64              : private:
      65              :     void tagProperty(const AsciiStringView& name, P_TYPE type, const PropertyValue& data);
      66              : 
      67              :     std::vector<std::pair<const EngravingObject*, AsciiStringView> > _elements;
      68              :     bool _recordElements = false;
      69              : };
      70              : }
        

Generated by: LCOV version 2.0-1