git-svn-id: svn://db.shs.com.ru/pip@678 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -104,13 +104,14 @@ PIPropertyStorage PIVariantTypes::IODevice::get() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PIString PIVariantTypes::IODevice::toString() const {
|
PIString PIVariantTypes::IODevice::toPICout() const {
|
||||||
PIString s;
|
PIString s;
|
||||||
s << "IODevice(" << prefix << ", ";
|
s << "IODevice(" << prefix << ", mode=";
|
||||||
int rwc = 0;
|
int rwc = 0;
|
||||||
if (mode & 1) {s << "r"; ++rwc;}
|
if (mode & 1) {s << "r"; ++rwc;}
|
||||||
if (mode & 2) {s << "w"; ++rwc;}
|
if (mode & 2) {s << "w"; ++rwc;}
|
||||||
if (rwc == 1) s << "o";
|
if (rwc == 1) s << "o";
|
||||||
|
s << ", flags=";
|
||||||
if (options != 0) {
|
if (options != 0) {
|
||||||
if (((PIIODevice::DeviceOptions)options)[PIIODevice::BlockingRead])
|
if (((PIIODevice::DeviceOptions)options)[PIIODevice::BlockingRead])
|
||||||
s << " br";
|
s << " br";
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ namespace PIVariantTypes {
|
|||||||
IODevice();
|
IODevice();
|
||||||
void set(const PIPropertyStorage & ps);
|
void set(const PIPropertyStorage & ps);
|
||||||
PIPropertyStorage get() const;
|
PIPropertyStorage get() const;
|
||||||
PIString toString() const;
|
PIString toPICout() const;
|
||||||
PIString prefix;
|
PIString prefix;
|
||||||
int mode; // PIIODevice::DeviceMode
|
int mode; // PIIODevice::DeviceMode
|
||||||
int options; // PIIODevice::DeviceOptions
|
int options; // PIIODevice::DeviceOptions
|
||||||
@@ -112,7 +112,7 @@ inline PICout operator <<(PICout s, const PIVariantTypes::Color & v) {s.saveCont
|
|||||||
|
|
||||||
inline PIByteArray & operator <<(PIByteArray & s, const PIVariantTypes::IODevice & v) {s << v.prefix << v.mode << v.options << v.props; return s;}
|
inline PIByteArray & operator <<(PIByteArray & s, const PIVariantTypes::IODevice & v) {s << v.prefix << v.mode << v.options << v.props; return s;}
|
||||||
inline PIByteArray & operator >>(PIByteArray & s, PIVariantTypes::IODevice & v) {s >> v.prefix >> v.mode >> v.options >> v.props; return s;}
|
inline PIByteArray & operator >>(PIByteArray & s, PIVariantTypes::IODevice & v) {s >> v.prefix >> v.mode >> v.options >> v.props; return s;}
|
||||||
inline PICout operator <<(PICout s, const PIVariantTypes::IODevice & v) {s << v.toString(); return s;}
|
inline PICout operator <<(PICout s, const PIVariantTypes::IODevice & v) {s << v.toPICout(); return s;}
|
||||||
|
|
||||||
|
|
||||||
#endif // PIVARIANTYPES_H
|
#endif // PIVARIANTYPES_H
|
||||||
|
|||||||
@@ -313,6 +313,20 @@ void PIFile::configureFromFullPathDevice(const PIString & full_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PIPropertyStorage PIFile::constructVariantDevice() const {
|
||||||
|
PIPropertyStorage ret;
|
||||||
|
PIVariantTypes::File f;
|
||||||
|
f.file = path();
|
||||||
|
ret.addProperty("path", f);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PIFile::configureFromVariantDevice(const PIPropertyStorage & d) {
|
||||||
|
setPath(d.propertyValueByName("path").toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PIString PIFile::strType(const PIIODevice::DeviceMode type) {
|
PIString PIFile::strType(const PIIODevice::DeviceMode type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case PIIODevice::ReadOnly: return "rb";
|
case PIIODevice::ReadOnly: return "rb";
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#define PIFILE_H
|
#define PIFILE_H
|
||||||
|
|
||||||
#include "piiodevice.h"
|
#include "piiodevice.h"
|
||||||
|
#include "pipropertystorage.h"
|
||||||
|
|
||||||
|
|
||||||
class PIP_EXPORT PIFile: public PIIODevice
|
class PIP_EXPORT PIFile: public PIIODevice
|
||||||
@@ -289,6 +290,8 @@ protected:
|
|||||||
PIString fullPathPrefix() const {return PIStringAscii("file");}
|
PIString fullPathPrefix() const {return PIStringAscii("file");}
|
||||||
PIString constructFullPathDevice() const;
|
PIString constructFullPathDevice() const;
|
||||||
void configureFromFullPathDevice(const PIString & full_path);
|
void configureFromFullPathDevice(const PIString & full_path);
|
||||||
|
PIPropertyStorage constructVariantDevice() const;
|
||||||
|
void configureFromVariantDevice(const PIPropertyStorage & d);
|
||||||
int readDevice(void * read_to, int max_size);
|
int readDevice(void * read_to, int max_size);
|
||||||
int writeDevice(const void * data, int max_size);
|
int writeDevice(const void * data, int max_size);
|
||||||
bool openDevice();
|
bool openDevice();
|
||||||
|
|||||||
@@ -459,3 +459,4 @@ PIPropertyStorage PIIODevice::constructVariantDevice() const {
|
|||||||
void PIIODevice::configureFromVariantDevice(const PIPropertyStorage & d) {
|
void PIIODevice::configureFromVariantDevice(const PIPropertyStorage & d) {
|
||||||
setPath(d.propertyValueByName("path").toString());
|
setPath(d.propertyValueByName("path").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -418,5 +418,4 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // PIIODEVICE_H
|
#endif // PIIODEVICE_H
|
||||||
|
|||||||
Reference in New Issue
Block a user