Eneboo - Documentación para desarrolladores
|
00001 /*************************************************************************** 00002 AQSDataStream_p.h 00003 ------------------- 00004 begin : 05/04/2011 00005 copyright : (C) 2003-2011 by InfoSiAL S.L. 00006 email : mail@infosial.com 00007 ***************************************************************************/ 00008 /*************************************************************************** 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; version 2 of the License. * 00012 ***************************************************************************/ 00013 /*************************************************************************** 00014 Este programa es software libre. Puede redistribuirlo y/o modificarlo 00015 bajo los términos de la Licencia Pública General de GNU en su 00016 versión 2, publicada por la Free Software Foundation. 00017 ***************************************************************************/ 00018 00019 #ifndef AQSDATASTREAM_P_H_ 00020 #define AQSDATASTREAM_P_H_ 00021 00022 #include "AQSIODevice_p.h" 00023 #include "AQSByteArray_p.h" 00024 #include <qdatastream.h> 00025 00026 // @AQ_PTR_INDIRECTION@ 00027 00028 class AQSDataStream : public AQSVoidPtr 00029 { 00030 Q_OBJECT 00031 00032 AQ_DECLARE_AQS_VOID(DataStream, VoidPtr); 00033 00034 protected: 00035 void specializedInternalFinish() { 00036 if (!wrap_) 00037 delete o_; 00038 } 00039 00040 public slots: 00041 QString opOutString() const { 00042 QString ret; 00043 if (!o_) 00044 return ret; 00045 (*o_) >> ret; 00046 return ret; 00047 } 00048 00049 int opOutInt() const { 00050 int ret = 0; 00051 if (!o_) 00052 return ret; 00053 (*o_) >> ret; 00054 return ret; 00055 } 00056 00057 float opOutFloat() const { 00058 float ret = 0; 00059 if (!o_) 00060 return ret; 00061 (*o_) >> ret; 00062 return ret; 00063 } 00064 00065 void opIn(const QString &str) { 00066 if (o_) 00067 (*o_) << str; 00068 } 00069 00070 void opIn(int i) { 00071 if (o_) 00072 (*o_) << i; 00073 } 00074 00075 void opIn(float f) { 00076 if (o_) 00077 (*o_) << f; 00078 } 00079 00080 void opInByteArray(const QByteArray &ba) { 00081 if (o_) 00082 (*o_) << ba; 00083 } 00084 00085 //@AQ_BEGIN_DEF_PUB_SLOTS@ 00086 public slots: 00087 QIODevice *device() const; 00088 void setDevice(QIODevice *); 00089 void setDevice(AQSIODevice *); 00090 void unsetDevice(); 00091 bool atEnd() const; 00092 int byteOrder() const; 00093 void setByteOrder(int); 00094 bool isPrintableData() const; 00095 void setPrintableData(bool); 00096 int version() const; 00097 void setVersion(int); 00098 00099 protected: 00100 static void *construct(const QSArgumentList &args) { 00101 QMap<int, QStringList> candidates; 00102 candidates[0].append(QString::null); 00103 candidates[1].append(QString::fromLatin1("QIODevice*")); 00104 candidates[2].append(QString::fromLatin1("QByteArray*,int")); 00105 QString sgt(castArgsSignature(args, candidates)); 00106 if (sgt.isEmpty()) 00107 return new QDataStream; 00108 if (sgt == QString::fromLatin1("QIODevice*")) 00109 return new QDataStream(argValue<QIODevice *>(args[0])); 00110 if (sgt == QString::fromLatin1("QByteArray*,int")) 00111 return new QDataStream(*argValue<QByteArray *>(args[0]), 00112 args[1].variant().toInt()); 00113 return 0; 00114 } 00115 00116 public: 00117 static QMap<int, QStringList> candidateConstructors() { 00118 QMap<int, QStringList> candidates; 00119 candidates[0].append(QString::null); 00120 candidates[1].append(QString::fromLatin1("QIODevice*")); 00121 candidates[2].append(QString::fromLatin1("QByteArray*,int")); 00122 return candidates; 00123 } 00124 //@AQ_END_DEF_PUB_SLOTS@ 00125 }; 00126 00127 //@AQ_BEGIN_IMP_PUB_SLOTS@ 00128 inline QIODevice *AQSDataStream::device() const 00129 { 00130 AQ_CALL_RET(device()); 00131 } 00132 inline void AQSDataStream::setDevice(QIODevice *arg0) 00133 { 00134 AQ_CALL_VOID(setDevice(arg0)); 00135 } 00136 inline void AQSDataStream::setDevice(AQSIODevice *arg0) 00137 { 00138 AQ_CALL_VOID(setDevice(*arg0)); 00139 } 00140 inline void AQSDataStream::unsetDevice() 00141 { 00142 AQ_CALL_VOID(unsetDevice()); 00143 } 00144 inline bool AQSDataStream::atEnd() const 00145 { 00146 AQ_CALL_RET_V(atEnd(), bool); 00147 } 00148 inline int AQSDataStream::byteOrder() const 00149 { 00150 AQ_CALL_RET_V(byteOrder(), int); 00151 } 00152 inline void AQSDataStream::setByteOrder(int arg0) 00153 { 00154 AQ_CALL_VOID(setByteOrder(arg0)); 00155 } 00156 inline bool AQSDataStream::isPrintableData() const 00157 { 00158 AQ_CALL_RET_V(isPrintableData(), bool); 00159 } 00160 inline void AQSDataStream::setPrintableData(bool arg0) 00161 { 00162 AQ_CALL_VOID(setPrintableData(arg0)); 00163 } 00164 inline int AQSDataStream::version() const 00165 { 00166 AQ_CALL_RET_V(version(), int); 00167 } 00168 inline void AQSDataStream::setVersion(int arg0) 00169 { 00170 AQ_CALL_VOID(setVersion(arg0)); 00171 } 00172 //@AQ_END_IMP_PUB_SLOTS@ 00173 00174 #endif /* AQSDATASTREAM_P_H_ */ 00175 // @AQSVOIDPTR@