Files
cd/libs/core/cdutils_interface.h
2022-12-14 14:13:33 +03:00

96 lines
2.5 KiB
C++

/*
CD Utils - Control-Debug utilites
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CDUTILS_INTERFACE_H
#define CDUTILS_INTERFACE_H
#include "cd_core_export.h"
#include "cdutils_types.h"
#include "piobject.h"
namespace CDUtils {
class CDCore;
class CD_CORE_EXPORT Interface: public PIObject {
PIOBJECT(CDUtils::Interface);
public:
Interface(CDType::cdT type_);
bool test(int v);
CDType & operator[](int v);
const CDType operator[](int v) const;
CDType & operator[](const PIString & name_);
const CDType operator[](const PIString & name_) const;
CDType & operator[](const PIDeque<int> & path_);
const CDType operator[](const PIDeque<int> & path_) const;
CDSection & section(int v);
const CDSection section(int v) const;
CDSection & section(const PIDeque<int> & path);
CDSection & root();
const CDSection & root() const;
int count(bool recursive = true) const;
const PIString file() const { return file_; }
int fileSize() const { return file_size; }
CDType::cdT cdType() const { return type; }
bool exists(PIDeque<int> path) const;
void setFileName(const PIString & _file);
bool configure(const PIString & config);
void reinitConnection(const PIString & configuration);
void releaseConnection();
void write(PIIODevice * d);
void read(PIIODevice * d);
void parse(PIIODevice * d);
void update(PIIODevice * d, UpdateModeFlags mode = SaveByName);
void calculate();
PIString appConfig();
PIString pultConfig();
void readFile();
void writeFile();
bool inProgress();
EVENT(sended);
EVENT(sendFailed);
EVENT(received);
EVENT(receiveFailed);
EVENT(changedGlobal);
EVENT_HANDLER(void, send);
EVENT_HANDLER(void, request);
protected:
CDCore * core;
CDSection * s;
CDType::cdT type;
PIString file_;
int file_size;
};
} // namespace CDUtils
#endif // CDUTILS_INTERFACE_H