go back to polling for windows, corrected windows console usage

svn path=/trunk/kdesupport/qca/; revision=645946
This commit is contained in:
Justin Karneges 2007-03-23 22:30:09 +00:00
parent dc4e2b6378
commit 399d68dd1a
2 changed files with 725 additions and 105 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2006 Justin Karneges <justin@affinix.com>
* Copyright (C) 2003-2007 Justin Karneges <justin@affinix.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -36,6 +36,8 @@
#ifdef QPIPE_SECURE
# include <QtCrypto>
#else
# define QCA_EXPORT
#endif
// defs adapted qprocess_p.h
@ -48,6 +50,10 @@ typedef int Q_PIPE_ID;
#define INVALID_Q_PIPE_ID -1
#endif
// Note: for Windows console, I/O must be in UTF-8. Reads are guaranteed to
// to completely decode (no partial characters). Likewise, writes must
// not contain partial characters.
namespace QCA {
// unbuffered direct pipe
@ -55,7 +61,12 @@ class QCA_EXPORT QPipeDevice : public QObject
{
Q_OBJECT
public:
enum Type { Read, Write };
enum Type
{
Read,
Write
};
QPipeDevice(QObject *parent = 0);
~QPipeDevice();
@ -75,6 +86,7 @@ public:
int bytesAvailable() const; // bytes available to read
int read(char *data, int maxsize); // return number read, 0 = EOF, -1 = error
int write(const char *data, int size); // return number taken, ptr must stay valid. -1 on error
int writeResult(int *written) const; // 0 = success (wrote all), -1 = error (see written)
signals:
void notify(); // can read or can write, depending on type
@ -90,7 +102,12 @@ class QCA_EXPORT QPipeEnd : public QObject
{
Q_OBJECT
public:
enum Error { ErrorEOF, ErrorBroken };
enum Error
{
ErrorEOF,
ErrorBroken
};
QPipeEnd(QObject *parent = 0);
~QPipeEnd();

File diff suppressed because it is too large Load Diff