SilentEye 0.4.1

sef/data.h

Go to the documentation of this file.
00001 //  This file is part of SilentEye.
00002 //
00003 //  SilentEye is free software: you can redistribute it and/or modify
00004 //  it under the terms of the GNU General Public License as published by
00005 //  the Free Software Foundation, either version 3 of the License, or
00006 //  (at your option) any later version.
00007 //
00008 //  SilentEye is distributed in the hope that it will be useful,
00009 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 //  GNU General Public License for more details.
00012 //
00013 //  You should have received a copy of the GNU General Public License
00014 //  along with SilentEye. If not, see <http://www.gnu.org/licenses/>.
00015 
00016 #ifndef DATA_H_
00017 #define DATA_H_
00018 
00019 #include <QObject>
00020 #include <QPointer>
00021 #include <QString>
00022 #include <QByteArray>
00023 #include "logger.h"
00024 
00025 namespace SilentEyeFramework {
00026 
00028     class Data : public QObject
00029     {
00030     public:
00032         enum DataFormat{
00033             BYTES=0, 
00034             UINT32=1, 
00035             UTF8=2, 
00036             LATIN1=3, 
00037             ASCII=4, 
00038             FILE=5, 
00039             F_UNDEF=7 }; 
00041     private:
00043         QPointer<Logger> m_logger;
00044 
00046         DataFormat m_format;
00048         QString m_name;
00050         QByteArray m_data;
00051 
00052     public:
00053         Data(const DataFormat);
00054         Data(const QByteArray&, const DataFormat=F_UNDEF);
00055         Data(const DataFormat, const QByteArray&, const QString="");
00056         ~Data();
00057         
00058         DataFormat format() const;
00059         QString name() const;
00060         QByteArray data() const;
00061         
00062         void setFormat(const DataFormat);
00063         void setName(const QString);
00064         void setData(const QByteArray&);
00065         
00066         QByteArray toByteArray() const;
00067     };
00068     
00069 }
00070 
00071 #endif