/* * * Copyright (c) 1996 * Knowledge Science Institute, University of Calgary * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. The Knowledge Science Institute makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * */ #ifndef MLEXER_H #define MLEXER_H #ifndef __IOSTREAM_H #include #endif #ifndef MPLATFORM_H #include #endif //The Lexer class is just a collection of functions (static members) designed //to be used for stream input/output. //All the functions return a status: 0=success; <0=failure; >0=warning class Lexer { public: static void setDelim(char delim); static char getDelim(); static int writeDelim(ostream& s, char delim=Delim); static int readDelim(istream& s, char delim=Delim); static int scanPastDelim(istream& s, char delim=Delim); static int writeQuotedString(ostream& s, string& x); static int readQuotedString(istream& s, string& x); static int writeString(ostream& s, string x); //use only for strings that never contain the delim char, such as identifiers static int readString(istream& s, string& x); static int writeLong(ostream& s, long x); static int readLong(istream& s, long& x); static int writeUnsigned(ostream& s, unsigned long x); static int readUnsigned(istream& s, unsigned long& x); static int writeRectangle(ostream& s, RECTANGLE& x); static int readRectangle(istream& s, RECTANGLE& x); static int writePoint(ostream& s, POINT& x); static int readPoint(istream& s, POINT& x); protected: static char Delim; }; #endif