1// Aseprite
2// Copyright (C) 2020-2022 Igara Studio S.A.
3// Copyright (C) 2001-2015 David Capello
4//
5// This program is distributed under the terms of
6// the End-User License Agreement for Aseprite.
7
8#ifndef APP_GUI_XML_INCLUDED
9#define APP_GUI_XML_INCLUDED
10#pragma once
11
12#include "app/xml_document.h"
13
14#include <memory>
15#include <string>
16
17namespace app {
18
19 // Singleton class to load and access "gui.xml" file.
20 class GuiXml {
21 public:
22 // Returns the GuiXml singleton. If it was not created yet, the
23 // gui.xml file will be loaded by the first time, which could
24 // generated an exception if there are errors in the XML file.
25 static GuiXml* instance();
26 static void destroyInstance();
27
28 GuiXml();
29
30 // Returns the tinyxml document instance.
31 XmlDocumentRef doc() {
32 return m_doc;
33 }
34
35 // Returns the name of the gui.xml file.
36 const char* filename() {
37 return m_doc->Value();
38 }
39
40 private:
41 XmlDocumentRef m_doc;
42 friend class std::unique_ptr<GuiXml>;
43 };
44
45} // namespace app
46
47#endif
48