File indexing completed on 2024-04-28 03:52:07

0001 /*
0002  * BluezQt - Asynchronous BlueZ wrapper library
0003  *
0004  * SPDX-FileCopyrightText: 2019 Manuel Weichselbaumer <mincequi@web.de>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007  */
0008 
0009 #ifndef INTERFACE_H
0010 #define INTERFACE_H
0011 
0012 #include "Methods.h"
0013 #include "Properties.h"
0014 
0015 class Interface
0016 {
0017 public:
0018     Interface();
0019 
0020     bool parse(const QString &line);
0021     bool finalize();
0022 
0023     QStringList comment() const;
0024     QString service() const;
0025     QString name() const;
0026     QString objectPath() const;
0027     Methods methods() const;
0028     Properties properties() const;
0029 
0030 private:
0031     enum class State {
0032         Comment,
0033         Service,
0034         Interface,
0035         ObjectPath,
0036         Methods,
0037         Properties,
0038     };
0039 
0040     void parseComment(const QString &line);
0041     void parseService(const QString &line);
0042     void parseInterface(const QString &line);
0043     void parseObjectPath(const QString &line);
0044 
0045     State m_state = State::Comment;
0046 
0047     QStringList m_comment;
0048     QString m_service;
0049     QString m_name;
0050     QString m_objectPath;
0051     Methods m_methods;
0052     Properties m_properties;
0053 };
0054 
0055 #endif // INTERFACE_H