home *** CD-ROM | disk | FTP | other *** search
- ===========================================================================
- BBS: The Abacus * HST/DS * Potterville MI
- Date: 06-13-93 (12:22) Number: 140
- From: DAVID NUGENT Refer#: NONE
- To: ALL Recvd: NO
- Subj: [09 of 12] myLine.h Conf: (37) C++ Langua
- ---------------------------------------------------------------------------
- // myLine.h
- //
- // Donated to the public domain; no restrictions on reuse or abuse apply.
- // by David Nugent, 7th June, 1993.
- // Simple line input class for istream to demonstrate input of a complete
- // line rather than whitespace separated tokens (the default for operator<<
- // for char* and other built-in types).
- // Works by overloading operator>> for a customised class - this functionality
- // is easily incorporated into your favourite String class
- //
-
- # if !defined(_myLine_h)
- # define _myLine_h 1
-
- # define AUTO_GROW 1 // Allow autogrowth of buffer to fit
- # define ALLOC_LEN 80 // Standard length & growth increment
-
- // Class declaration
-
- class myLine
- {
-
- public:
-
- myLine (short buflen =ALLOC_LEN);
- myLine (char * usebuf, short buflen =ALLOC_LEN);
- ~myLine (void);
- // Get buffer address
- char const * buf (void) const { return mybuf; }
- // Conversion operators
- char const * operator() (void) const { return mybuf; } // Explicit cast
- operator char const * (void) const { return mybuf; } // Implicit cast
- // istream operator>>
- friend istream & operator>> (istream &, myLine &);
-
- private:
-
- short len, xalloc;
- char * mybuf;
-
- };
-
- # endif // _myLine_h
-
- --- MaltEd 1.0.b5
- * Origin: Unique Computing Pty Ltd (3:632/348)
- SEEN-BY: 1/211 11/2 4 13/13 101/1 109/25 114/5 123/19 124/1 153/752 154/40
- SEEN-BY: 154/77 157/110 159/100 125 140 180 270 430 575 950 203/23 209/209
- SEEN-BY: 261/1023 280/1 390/1 396/1 5 15 2430/1 2440/5 3603/20
-