/***************************************************************************
                            QIODevice.m -  description
                             -------------------
    begin                : Wed Nov 21 12:08:37 2001
    copyright            : (C) 2000-2001 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Wed Nov 21 12:08:37 2001, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This library is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as       *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 ***************************************************************************/

#include <qtc/qt_QString.h>
#include <qtc/qt_QCString.h>
#include <qtc/qt_QIODevice.h>
#include <qtobjc/QIODevice.h>
#include <qtobjc/QByteArray.h>

@implementation  QIODevice


- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld]) {
			qt_del_QIODevice((qt_QIODevice *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (int) flags
{
	return (int) qt_QIODevice_flags((qt_QIODevice *)[self qt]);
}

- (int) mode
{
	return (int) qt_QIODevice_mode((qt_QIODevice *)[self qt]);
}

- (int) state
{
	return (int) qt_QIODevice_state((qt_QIODevice *)[self qt]);
}

- (BOOL) isDirectAccess
{
	return (BOOL) qt_QIODevice_isDirectAccess((qt_QIODevice *)[self qt]);
}

- (BOOL) isSequentialAccess
{
	return (BOOL) qt_QIODevice_isSequentialAccess((qt_QIODevice *)[self qt]);
}

- (BOOL) isCombinedAccess
{
	return (BOOL) qt_QIODevice_isCombinedAccess((qt_QIODevice *)[self qt]);
}

- (BOOL) isBuffered
{
	return (BOOL) qt_QIODevice_isBuffered((qt_QIODevice *)[self qt]);
}

- (BOOL) isRaw
{
	return (BOOL) qt_QIODevice_isRaw((qt_QIODevice *)[self qt]);
}

- (BOOL) isSynchronous
{
	return (BOOL) qt_QIODevice_isSynchronous((qt_QIODevice *)[self qt]);
}

- (BOOL) isAsynchronous
{
	return (BOOL) qt_QIODevice_isAsynchronous((qt_QIODevice *)[self qt]);
}

- (BOOL) isTranslated
{
	return (BOOL) qt_QIODevice_isTranslated((qt_QIODevice *)[self qt]);
}

- (BOOL) isReadable
{
	return (BOOL) qt_QIODevice_isReadable((qt_QIODevice *)[self qt]);
}

- (BOOL) isWritable
{
	return (BOOL) qt_QIODevice_isWritable((qt_QIODevice *)[self qt]);
}

- (BOOL) isReadWrite
{
	return (BOOL) qt_QIODevice_isReadWrite((qt_QIODevice *)[self qt]);
}

- (BOOL) isInactive
{
	return (BOOL) qt_QIODevice_isInactive((qt_QIODevice *)[self qt]);
}

- (BOOL) isOpen
{
	return (BOOL) qt_QIODevice_isOpen((qt_QIODevice *)[self qt]);
}

- (int) status
{
	return (int) qt_QIODevice_status((qt_QIODevice *)[self qt]);
}

- resetStatus
{
	qt_QIODevice_resetStatus((qt_QIODevice *)[self qt]);
	return self;
}

- (BOOL) open: (int)mode
{
	return (BOOL) qt_QIODevice_open((qt_QIODevice *)[self qt], (int)mode);
}

- close
{
	qt_QIODevice_close((qt_QIODevice *)[self qt]);
	return self;
}

- flush
{
	qt_QIODevice_flush((qt_QIODevice *)[self qt]);
	return self;
}

- (int) size
{
	return (int) qt_QIODevice_size((qt_QIODevice *)[self qt]);
}

- (int) at
{
	return (int) qt_QIODevice_at((qt_QIODevice *)[self qt]);
}

- (BOOL) at: (int)arg1
{
	return (BOOL) qt_QIODevice_at1((qt_QIODevice *)[self qt], (int)arg1);
}

- (BOOL) atEnd
{
	return (BOOL) qt_QIODevice_atEnd((qt_QIODevice *)[self qt]);
}

- (BOOL) reset
{
	return (BOOL) qt_QIODevice_reset((qt_QIODevice *)[self qt]);
}

- (long) readBlock: (NSString *)data maxlen: (long)maxlen
{
	return (long) qt_QIODevice_readBlock((qt_QIODevice *)[self qt], (char*) [data cString], (long)maxlen);
}

- (long) writeBlock: (NSString *)data len: (long)len
{
	return (long) qt_QIODevice_writeBlock((qt_QIODevice *)[self qt], (char*) [data cString], (long)len);
}

- (long) readLine: (NSString *)data maxlen: (long)maxlen
{
	return (long) qt_QIODevice_readLine((qt_QIODevice *)[self qt], (char*) [data cString], (long)maxlen);
}

- (long) writeBlock: (QByteArray*)data
{
	return (long) qt_QIODevice_writeBlock1((qt_QIODevice *)[self qt], (qt_QByteArray*) [data qt]);
}

- (QByteArray*) readAll
{
	return (QByteArray*) [QtSupport objectForQtKey: qt_QIODevice_readAll((qt_QIODevice *)[self qt]) withClass: [QByteArray class] allocatedInObjcWorld: YES];
}

- (int) getch
{
	return (int) qt_QIODevice_getch((qt_QIODevice *)[self qt]);
}

- (int) putch: (int)arg1
{
	return (int) qt_QIODevice_putch((qt_QIODevice *)[self qt], (int)arg1);
}

- (int) ungetch: (int)arg1
{
	return (int) qt_QIODevice_ungetch((qt_QIODevice *)[self qt], (int)arg1);
}
- (void *) qt
{
	return _qt;
}

- setQt: (void *) qt
{
	_qt = qt;
	return self;
}

- (BOOL) allocatedInObjcWorld
{
	return _allocatedInObjcWorld;
}

- setAllocatedInObjcWorld: (BOOL) yn
{
	_allocatedInObjcWorld = yn;
	return self;
}


@end
