1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
/***************************************************************************
LineObject.h
-------------------
begin : Thu May 30 02:19:30 UTC 2002
copyright : (C) 2005 by Andrew Ruder
email : aeruder@ksu.edu
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation; either version 2.1 of the *
* License or (at your option) any later version. *
* *
***************************************************************************/
@class LineObject;
#ifndef LINE_OBJECT_H
#define LINE_OBJECT_H
#import "NetBase.h"
#import <Foundation/NSObject.h>
@class NSMutableData, NSData;
/**
* LineObject is used for line-buffered connections (end in \r\n or just \n).
* To use, simply override lineReceived: in a subclass of LineObject. By
* default, LineObject does absolutely nothing with lineReceived except throw
* the line away. Use line object if you simply want line-buffered input.
* This can be used on IRC, telnet, etc.
*/
@interface LineObject : NSObject < NetObject >
{
id <NetTransport>transport;
NSMutableData *_readData;
}
/**
* Cleans up the instance variables and releases the transport.
* If/when the transport is dealloc'd, the connection will be closed.
*/
- (void)connectionLost;
/**
* Initializes data and retains <var>aTransport</var>
* <var>aTransport</var> should conform to the [(NetTransport)]
* protocol.
*/
- connectionEstablished: (id <NetTransport>)aTransport;
/**
* Adds the data to a buffer. Then calls -lineReceived: for all
* full lines currently in the buffer. Don't override this, override
* -lineReceived:.
*/
- dataReceived: (NSData *)newData;
/**
* Returns the transport
*/
- (id <NetTransport>)transport;
/**
* <override-subclass />
* <var>aLine</var> contains a full line of text (without the ending newline)
*/
- lineReceived: (NSData *)aLine;
@end
#endif
|