git-svn-id: svn://db.shs.com.ru/pip@322 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -37,7 +37,7 @@ class PIBinaryLog: public PIIODevice
|
||||
{
|
||||
PIIODEVICE(PIBinaryLog)
|
||||
public:
|
||||
PIBinaryLog();
|
||||
explicit PIBinaryLog();
|
||||
~PIBinaryLog() {closeDevice();}
|
||||
|
||||
//! \brief Play modes for \a PIBinaryLog
|
||||
|
||||
@@ -137,13 +137,13 @@ PIFile::PIFile(const PIString & path, PIIODevice::DeviceMode mode): PIIODevice(p
|
||||
}
|
||||
|
||||
|
||||
PIFile::PIFile(const PIFile & other) {
|
||||
fd = 0;
|
||||
fdi = -1;
|
||||
setPrecision(other.prec_);
|
||||
setPath(other.path());
|
||||
mode_ = other.mode_;
|
||||
}
|
||||
//PIFile::PIFile(const PIFile & other) {
|
||||
// fd = 0;
|
||||
// fdi = -1;
|
||||
// setPrecision(other.prec_);
|
||||
// setPath(other.path());
|
||||
// mode_ = other.mode_;
|
||||
//}
|
||||
|
||||
|
||||
bool PIFile::openDevice() {
|
||||
|
||||
@@ -86,7 +86,11 @@ public:
|
||||
//! Constructs a file with path "path" and open mode "mode"
|
||||
explicit PIFile(const PIString & path, DeviceMode mode = ReadWrite);
|
||||
|
||||
PIFile(const PIFile & other);
|
||||
|
||||
//! Open temporary file with open mode "mode"
|
||||
bool openTemporary(PIIODevice::DeviceMode mode = PIIODevice::ReadWrite) {return open(PIString(tmpnam(0)), mode);}
|
||||
|
||||
// PIFile(const PIFile & other);
|
||||
|
||||
~PIFile() {closeDevice();}
|
||||
|
||||
@@ -176,7 +180,7 @@ public:
|
||||
//! Write to file binary content of "v"
|
||||
PIFile & writeBinary(const double v) {write(&v, sizeof(v)); return *this;}
|
||||
|
||||
PIFile & operator =(const PIFile & f) {PIIODevice::setPath(f.path()); mode_ = f.mode_; return *this;}
|
||||
//PIFile & operator =(const PIFile & f) {PIIODevice::setPath(f.path()); mode_ = f.mode_; return *this;}
|
||||
|
||||
//! Write to file text representation of "v"
|
||||
PIFile & operator <<(const char v) {if (canWrite() && fd != 0) write(&v, 1); return *this;}
|
||||
@@ -244,9 +248,6 @@ public:
|
||||
|
||||
//!
|
||||
static void setDefaultCharset(const char * c);
|
||||
|
||||
//! Returns opened temporary file with open mode "mode"
|
||||
static PIFile openTemporary(PIIODevice::DeviceMode mode = PIIODevice::ReadWrite) {return PIFile(PIString(tmpnam(0)), mode);}
|
||||
|
||||
//! Returns if file with path "path" does exists
|
||||
static bool isExists(const PIString & path);
|
||||
|
||||
@@ -32,10 +32,10 @@ class PIP_EXPORT PIIOByteArray: public PIIODevice
|
||||
public:
|
||||
|
||||
//! Contructs %PIIOByteArray with \"buffer\" content and \"mode\" open mode
|
||||
PIIOByteArray(PIByteArray * buffer = 0, PIIODevice::DeviceMode mode = PIIODevice::ReadWrite);
|
||||
explicit PIIOByteArray(PIByteArray * buffer = 0, PIIODevice::DeviceMode mode = PIIODevice::ReadWrite);
|
||||
|
||||
//! Contructs %PIIOByteArray with \"buffer\" content only for read
|
||||
PIIOByteArray(const PIByteArray & buffer);
|
||||
explicit PIIOByteArray(const PIByteArray & buffer);
|
||||
|
||||
~PIIOByteArray() {closeDevice();}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class PIP_EXPORT PIIODevice: public PIThread
|
||||
public:
|
||||
|
||||
//! Constructs a empty PIIODevice
|
||||
PIIODevice();
|
||||
explicit PIIODevice();
|
||||
|
||||
//! \brief Open modes for PIIODevice
|
||||
enum DeviceMode {
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
|
||||
typedef PIFlags<DeviceOption> DeviceOptions;
|
||||
|
||||
PIIODevice(const PIString & path, DeviceMode mode = ReadWrite);
|
||||
explicit PIIODevice(const PIString & path, DeviceMode mode = ReadWrite);
|
||||
virtual ~PIIODevice();
|
||||
|
||||
//! Current open mode of device
|
||||
@@ -356,6 +356,8 @@ private:
|
||||
void run();
|
||||
void end() {terminate();}
|
||||
static void cacheFullPath(const PIString & full_path, const PIIODevice * d);
|
||||
explicit PIIODevice(const PIIODevice & );
|
||||
void operator =(const PIIODevice & );
|
||||
|
||||
PITimer timer;
|
||||
PITimeMeasurer tm;
|
||||
|
||||
@@ -32,10 +32,10 @@ class PIP_EXPORT PIIOString: public PIIODevice
|
||||
public:
|
||||
|
||||
//! Contructs %PIIOString with \"string\" content and \"mode\" open mode
|
||||
PIIOString(PIString * string = 0, PIIODevice::DeviceMode mode = PIIODevice::ReadWrite);
|
||||
explicit PIIOString(PIString * string = 0, PIIODevice::DeviceMode mode = PIIODevice::ReadWrite);
|
||||
|
||||
//! Contructs %PIIOString with \"string\" content only for read
|
||||
PIIOString(const PIString & string);
|
||||
explicit PIIOString(const PIString & string);
|
||||
|
||||
~PIIOString() {closeDevice();}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
};
|
||||
|
||||
//! Contructs extractor with child device "device_" and extract algorithm "mode"
|
||||
PIPacketExtractor(PIIODevice * device_ = 0, SplitMode mode = None);
|
||||
explicit PIPacketExtractor(PIIODevice * device_ = 0, SplitMode mode = None);
|
||||
|
||||
virtual ~PIPacketExtractor() {stop();}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class PIP_EXPORT PITransparentDevice: public PIIODevice
|
||||
public:
|
||||
|
||||
//! Contructs empty %PITransparentDevice
|
||||
PITransparentDevice();
|
||||
explicit PITransparentDevice();
|
||||
|
||||
~PITransparentDevice() {closeDevice();}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class PIP_EXPORT PIUSB: public PIIODevice
|
||||
{
|
||||
PIIODEVICE(PIUSB)
|
||||
public:
|
||||
PIUSB(ushort vid = 0, ushort pid = 0);
|
||||
explicit PIUSB(ushort vid = 0, ushort pid = 0);
|
||||
~PIUSB() {closeDevice();}
|
||||
|
||||
struct Endpoint {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#define PIVERSION_H
|
||||
|
||||
#define PIP_VERSION_MAJOR 0
|
||||
#define PIP_VERSION_MINOR 8
|
||||
#define PIP_VERSION_MINOR 9
|
||||
#define PIP_VERSION_REVISION 0
|
||||
#define PIP_VERSION_SUFFIX ""
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ PIStringList PICodec::availableCodecs() {
|
||||
|
||||
|
||||
PIByteArray PICodec::exec_iconv(const PIString & from, const PIString & to, const PIByteArray & str) {
|
||||
tf.open();
|
||||
tf.openTemporary(PIIODevice::ReadWrite);
|
||||
tf.clear();
|
||||
tf << str;
|
||||
tf.close();
|
||||
|
||||
@@ -26,8 +26,8 @@ class PIP_EXPORT PICodec: private PIProcess
|
||||
{
|
||||
PIOBJECT(PICodec)
|
||||
public:
|
||||
PICodec(): PIProcess() {setGrabOutput(true); tf = PIFile::openTemporary(PIIODevice::ReadWrite); tf.open();}
|
||||
PICodec(const PIString & from, const PIString & to): PIProcess() {setCodings(from, to); tf = PIFile::openTemporary(PIIODevice::ReadWrite);}
|
||||
PICodec(): PIProcess() {setGrabOutput(true);}
|
||||
PICodec(const PIString & from, const PIString & to): PIProcess() {setCodings(from, to);}
|
||||
~PICodec() {tf.remove();}
|
||||
|
||||
void setFromCoding(const PIString & from) {c_from = from;}
|
||||
|
||||
@@ -106,17 +106,17 @@ void PIProcess::startProc(bool detached) {
|
||||
/// files for stdin/out/err
|
||||
t_in = t_out = t_err = false;
|
||||
if (f_in.path().isEmpty()) {
|
||||
f_in = PIFile::openTemporary(PIIODevice::ReadWrite);
|
||||
f_in.openTemporary(PIIODevice::ReadWrite);
|
||||
t_in = true;
|
||||
}
|
||||
//f_in.open(PIIODevice::ReadWrite); f_in.close();
|
||||
if (f_out.path().isEmpty()) {
|
||||
f_out = PIFile::openTemporary(PIIODevice::ReadWrite);
|
||||
f_out.openTemporary(PIIODevice::ReadWrite);
|
||||
t_out = true;
|
||||
}
|
||||
//f_out.open(PIIODevice::WriteOnly); f_out.close();
|
||||
if (f_err.path().isEmpty()) {
|
||||
f_err = PIFile::openTemporary(PIIODevice::ReadWrite);
|
||||
f_err.openTemporary(PIIODevice::ReadWrite);
|
||||
t_err = true;
|
||||
}
|
||||
//f_err.open(PIIODevice::WriteOnly); f_err.close();
|
||||
|
||||
Reference in New Issue
Block a user