version 2.93 ready to master
remove PIString << operators
This commit is contained in:
@@ -728,19 +728,19 @@ bool PIBinaryLog::seek(llong filepos) {
|
||||
|
||||
PIString PIBinaryLog::constructFullPathDevice() const {
|
||||
PIString ret;
|
||||
ret << logDir() << ":" << filePrefix() << ":" << defaultID() << ":";
|
||||
ret += logDir() + ":" + filePrefix() + ":" + defaultID() + ":";
|
||||
switch (play_mode) {
|
||||
case PlayRealTime:
|
||||
ret << "RT";
|
||||
ret += "RT";
|
||||
break;
|
||||
case PlayVariableSpeed:
|
||||
ret << PIString::fromNumber(playSpeed()) << "X";
|
||||
ret += PIString::fromNumber(playSpeed()) + "X";
|
||||
break;
|
||||
case PlayStaticDelay:
|
||||
ret << PIString::fromNumber(playDelay().toMilliseconds()) << "M";
|
||||
ret += PIString::fromNumber(playDelay().toMilliseconds()) + "M";
|
||||
break;
|
||||
default:
|
||||
ret << "RT";
|
||||
ret += "RT";
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -148,7 +148,7 @@ int PICAN::readedCANID() const {
|
||||
|
||||
PIString PICAN::constructFullPathDevice() const {
|
||||
PIString ret;
|
||||
ret << path() << ":" << PIString::fromNumber(CANID(),16);
|
||||
ret += path() + ":" + PIString::fromNumber(CANID(), 16);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -116,9 +116,9 @@ PIEthernet::Address::Address(const PIString & _ip, ushort _port) {
|
||||
|
||||
PIString PIEthernet::Address::ipString() const {
|
||||
PIString ret = PIString::fromNumber(ip_b[0]);
|
||||
ret << "." << PIString::fromNumber(ip_b[1]);
|
||||
ret << "." << PIString::fromNumber(ip_b[2]);
|
||||
ret << "." << PIString::fromNumber(ip_b[3]);
|
||||
ret += "." + PIString::fromNumber(ip_b[1]);
|
||||
ret += "." + PIString::fromNumber(ip_b[2]);
|
||||
ret += "." + PIString::fromNumber(ip_b[3]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -930,11 +930,12 @@ void PIEthernet::propertyChanged(const char * name) {
|
||||
|
||||
PIString PIEthernet::constructFullPathDevice() const {
|
||||
PIString ret;
|
||||
ret << (type() == PIEthernet::UDP ? "UDP" : "TCP") << ":" << readIP() << ":" << readPort();
|
||||
ret += (type() == PIEthernet::UDP ? "UDP" : "TCP");
|
||||
ret += ":" + readIP() + ":" + PIString::fromNumber(readPort());
|
||||
if (type() == PIEthernet::UDP) {
|
||||
ret << ":" << sendIP() << ":" << sendPort();
|
||||
ret += ":" + sendIP() + ":" + PIString::fromNumber(sendPort());
|
||||
piForeachC (PIString & m, multicastGroups())
|
||||
ret << ":mcast:" << m;
|
||||
ret += ":mcast:" + m;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#ifndef PIIOSTREAM_H
|
||||
#define PIIOSTREAM_H
|
||||
|
||||
#include "piiodevice.h"
|
||||
#include "piiostring.h"
|
||||
#include "pitextstream.h"
|
||||
|
||||
|
||||
@@ -39,8 +39,10 @@ public:
|
||||
|
||||
//! \~english Contructs %PIIOBinaryStream for "device" device
|
||||
//! \~russian Создает %PIIOBinaryStream для устройства "device"
|
||||
PIIOBinaryStream(PIIODevice * device): dev(device) {}
|
||||
PIIOBinaryStream(PIIODevice * device = nullptr): dev(device) {}
|
||||
|
||||
//! \~english Assign "device" device
|
||||
//! \~russian Назначает устройство "device"
|
||||
void setDevice(PIIODevice * device) {dev = device;}
|
||||
|
||||
bool binaryStreamAppendImp(const void * d, size_t s) {
|
||||
@@ -68,7 +70,19 @@ public:
|
||||
|
||||
//! \~english Contructs %PIIOTextStream for "device" device
|
||||
//! \~russian Создает %PIIOTextStream для устройства "device"
|
||||
PIIOTextStream(PIIODevice * device): PITextStream<PIIOBinaryStream>(&bin_stream), bin_stream(device){}
|
||||
PIIOTextStream(PIIODevice * device): PITextStream<PIIOBinaryStream>(&bin_stream), bin_stream(device) {}
|
||||
|
||||
//! \~english Contructs %PIIOTextStream for "string" string
|
||||
//! \~russian Создает %PIIOTextStream для строки "string"
|
||||
PIIOTextStream(PIString * string): PITextStream<PIIOBinaryStream>(&bin_stream) {
|
||||
io_string = new PIIOString(string);
|
||||
bin_stream.setDevice(io_string);
|
||||
}
|
||||
|
||||
~PIIOTextStream() {
|
||||
if (io_string)
|
||||
delete io_string;
|
||||
}
|
||||
|
||||
void setDevice(PIIODevice * device) {
|
||||
bin_stream = PIIOBinaryStream(device);
|
||||
@@ -76,6 +90,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
PIIOString * io_string = nullptr;
|
||||
PIIOBinaryStream bin_stream;
|
||||
|
||||
};
|
||||
|
||||
@@ -968,7 +968,7 @@ void PIPeer::newTcpClient(PIEthernet *client) {
|
||||
|
||||
PIString PIPeer::constructFullPathDevice() const {
|
||||
PIString ret;
|
||||
ret << self_info.name << ":" << trustPeerName();
|
||||
ret += self_info.name + ":" + trustPeerName();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -516,14 +516,14 @@ PIString PISerial::readString(int size, double timeout_ms) {
|
||||
while (tm_.elapsed_m() < timeout_ms) {
|
||||
ret = readDevice(td, 1024);
|
||||
if (ret <= 0) piMinSleep();
|
||||
else str << PIString((char*)td, ret);
|
||||
else str += PIString((char*)td, ret);
|
||||
}
|
||||
} else {
|
||||
while (all < size && tm_.elapsed_m() < timeout_ms) {
|
||||
ret = readDevice(td, size - all);
|
||||
if (ret <= 0) piMinSleep();
|
||||
else {
|
||||
str << PIString((char*)td, ret);
|
||||
str += PIString((char*)td, ret);
|
||||
all += ret;
|
||||
}
|
||||
}
|
||||
@@ -532,12 +532,12 @@ PIString PISerial::readString(int size, double timeout_ms) {
|
||||
} else {
|
||||
bool br = setOption(BlockingRead, true);
|
||||
all = readDevice(td, 1);
|
||||
str << PIString((char*)td, all);
|
||||
str += PIString((char*)td, all);
|
||||
while (all < size) {
|
||||
ret = readDevice(td, size - all);
|
||||
if (ret <= 0) piMinSleep();
|
||||
else {
|
||||
str << PIString((char*)td, ret);
|
||||
str += PIString((char*)td, ret);
|
||||
all += ret;
|
||||
}
|
||||
}
|
||||
@@ -857,13 +857,13 @@ bool PISerial::configureDevice(const void * e_main, const void * e_parent) {
|
||||
|
||||
PIString PISerial::constructFullPathDevice() const {
|
||||
PIString ret;
|
||||
ret << path() << ":" << int(inSpeed()) << ":" << dataBitsCount();
|
||||
ret += path() + ":" + PIString::fromNumber(int(inSpeed())) + ":" + PIString::fromNumber(dataBitsCount());
|
||||
if (parameters()[ParityControl]) {
|
||||
if (parameters()[ParityOdd]) ret << ":O";
|
||||
else ret << ":E";
|
||||
} else ret << ":N";
|
||||
if (parameters()[TwoStopBits]) ret << ":2";
|
||||
else ret << ":1";
|
||||
if (parameters()[ParityOdd]) ret += ":O";
|
||||
else ret += ":E";
|
||||
} else ret += ":N";
|
||||
if (parameters()[TwoStopBits]) ret += ":2";
|
||||
else ret += ":1";
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ bool PISharedMemory::closeDevice() {
|
||||
|
||||
PIString PISharedMemory::constructFullPathDevice() const {
|
||||
PIString ret;
|
||||
ret << path() << ":" << dsize;
|
||||
ret += path() + ":" + PIString::fromNumber(dsize);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ int PISPI::writeDevice(const void * data, int max_size) {
|
||||
|
||||
PIString PISPI::constructFullPathDevice() const {
|
||||
PIString ret;
|
||||
ret << path() << ":" << int(speed()) << ":" << int(bits()) << ":" << (int)parameters();
|
||||
ret += path() + ":" + PIString::fromNumber((int)speed()) + ":" + PIString::fromNumber((int)bits()) + ":" + PIString::fromNumber((int)parameters());
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user