00001 #ifndef __DATA_H__ 00002 #define __DATA_H__ 00003 00004 /* 00005 * Copyright 2011 00006 * 'MedCenter' is an interactive application for hospitals. 00007 * (c) Copyright 2011 - Abdelhafid Hafidi <std.abdel[at]gmail.com> 00008 * - Alexandre Laurent <lw.demoscene[at]gmail.com> 00009 * 00010 * [GPL] 00011 * 00012 * This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU General Public License as published by 00014 * the Free Software Foundation; either version 2 of the License, or 00015 * (at your option) any later version. 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU General Public License along 00023 * with this program; if not, write to the Free Software Foundation, Inc., 00024 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00025 * 00026 */ 00027 00028 #include <QObject> 00029 #include <QString> 00030 #include <QByteArray> 00031 00032 class Patient; 00033 00034 class Data : public QObject 00035 { 00036 Q_OBJECT 00037 00038 public: 00039 enum SegmentDataIdentifier 00040 { 00041 SDI_Version = 10, 00042 SDI_Patient = 100, // We init at 100 to be able to debug "easily" (it also means, that the data are more limited in the identifier numbers, but 99 ids should be enough) 00043 SDI_Operation = 200, 00044 SDI_File = 300 00045 }; 00046 00047 protected: 00048 QString m_category; 00050 public: 00051 Data(const QString& category, QObject* parent=0):QObject(parent),m_category(category) {} 00052 virtual ~Data() {} 00053 00054 virtual QByteArray data()const =0; 00055 virtual int load(const QByteArray& data, int index=0)=0; 00056 00057 static void factory(Patient* pPatient, const QByteArray& data, int index=0, int* nbRead=NULL); 00058 00059 const QString& category()const { return m_category; } 00060 }; 00061 00103 #endif