File indexing completed on 2024-04-28 04:32:09

0001 /*
0002  * Copyright (C) 2010-2015 by Stephen Allewell
0003  * steve.allewell@gmail.com
0004  *
0005  * This program is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation; either version 2 of the License, or
0008  * (at your option) any later version.
0009  */
0010 
0011 /**
0012  * @file
0013  * Header file for the SymbolManager class.
0014  */
0015 
0016 #ifndef SymbolManager_H
0017 #define SymbolManager_H
0018 
0019 #include <QList>
0020 #include <QStringList>
0021 
0022 class SymbolLibrary;
0023 
0024 /**
0025  * @brief Manages the collection of symbol libraries.
0026  *
0027  * The symbol manager manages the set of symbol libraries. It allows retrieval of the names
0028  * of the libraries and retrieval of a specific library by name.
0029  *
0030  * The manager is implemented as a singleton class accessible via static functions from all
0031  * parts of the application.
0032  */
0033 class SymbolManager
0034 {
0035 public:
0036     ~SymbolManager();
0037 
0038     static QStringList libraries();
0039     static SymbolLibrary *library(const QString &name);
0040 
0041 private:
0042     static SymbolManager &self();
0043     SymbolManager();
0044 
0045     void refresh();
0046     SymbolLibrary *readLibrary(const QString &name);
0047 
0048     static SymbolManager *symbolManager; /**< pointer to the static symbol manager */
0049     QList<SymbolLibrary *> m_symbolLibraries; /**< list of the symbol libraries loaded */
0050 };
0051 
0052 #endif // SymbolManager_H