text stream ...
This commit is contained in:
@@ -132,6 +132,10 @@ template< class T1, class T2 >
|
||||
PIPair<T1,T2> createPIPair(const T1 & f, const T2 & s) {
|
||||
return PIPair<T1,T2>(f, s);
|
||||
}
|
||||
template< class T1, class T2 >
|
||||
PIPair<T1,T2> makePIPair(const T1 & f, const T2 & s) {
|
||||
return PIPair<T1,T2>(f, s);
|
||||
}
|
||||
|
||||
//! \~english Creates \a PIPair object, deducing the target type from the types of arguments.
|
||||
//! \~russian Создает \a PIPair выводя типы из аргументов.
|
||||
@@ -140,5 +144,9 @@ template< class T1, class T2 >
|
||||
PIPair<T1,T2> createPIPair(T1 && f, T2 && s) {
|
||||
return PIPair<T1,T2>(std::move(f), std::move(s));
|
||||
}
|
||||
template< class T1, class T2 >
|
||||
PIPair<T1,T2> makePIPair(T1 && f, T2 && s) {
|
||||
return PIPair<T1,T2>(std::move(f), std::move(s));
|
||||
}
|
||||
|
||||
#endif // PIPAIR_H
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*! \file pitextstream.h
|
||||
* \ingroup Core
|
||||
* \~\brief
|
||||
* \~english Text serialization interface
|
||||
* \~russian Интерфейс текстовой сериализации
|
||||
* \~english Text serialization functionality over PIBinaryStream
|
||||
* \~russian Функциональность текстовой сериализации поверх PIBinaryStream
|
||||
*/
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Text serialization interface
|
||||
Text serialization functionality over PIBinaryStream
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -31,8 +31,8 @@
|
||||
|
||||
//! \ingroup Core
|
||||
//! \~\brief
|
||||
//! \~english Text serialization interface.
|
||||
//! \~russian Интерфейс текстовой сериализации.
|
||||
//! \~english Text serialization functionality over PIBinaryStream.
|
||||
//! \~russian Функциональность текстовой сериализации поверх PIBinaryStream.
|
||||
template<typename P>
|
||||
class PITextStream {
|
||||
public:
|
||||
@@ -56,14 +56,22 @@ public:
|
||||
|
||||
char takeChar(bool * ok) {return (char)s->binaryStreamTakeByte(ok);}
|
||||
|
||||
bool textStreamSkipSpaces() {
|
||||
bool skipSpaces() {
|
||||
|
||||
//if ()
|
||||
}
|
||||
PIString textStreamTakeLine() {
|
||||
|
||||
PIString takeLine() {
|
||||
PIByteArray line;
|
||||
bool ok = true;
|
||||
for (;;) {
|
||||
char b = takeChar(&ok);
|
||||
if (!ok || b == '\n') break;
|
||||
if (b != '\r')
|
||||
line.append((uchar)b);
|
||||
}
|
||||
return PIString::fromUTF8(line);
|
||||
}
|
||||
PIString textStreamTakeWord();
|
||||
PIString takeWord();
|
||||
|
||||
private:
|
||||
PIBinaryStream<P> * s;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#define PIIOSTREAM_H
|
||||
|
||||
#include "piiodevice.h"
|
||||
#include "pitextstream.h"
|
||||
|
||||
|
||||
//! \ingroup IO
|
||||
@@ -56,4 +57,21 @@ private:
|
||||
};
|
||||
|
||||
|
||||
//! \ingroup IO
|
||||
//! \~\brief
|
||||
//! \~english PITextStream functionality for PIIODevice.
|
||||
//! \~russian Функциональность PITextStream для PIIODevice.
|
||||
class PIP_EXPORT PIIOTextStream: public PITextStream<PIIOBinaryStream> {
|
||||
public:
|
||||
|
||||
//! \~english Contructs %PIIOTextStream for "device" device
|
||||
//! \~russian Создает %PIIOTextStream для устройства "device"
|
||||
PIIOTextStream(PIIODevice * device): PITextStream<PIIOBinaryStream>(&bin_stream), bin_stream(device){}
|
||||
|
||||
private:
|
||||
PIIOBinaryStream bin_stream;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // PIIOSTREAM_H
|
||||
|
||||
Reference in New Issue
Block a user