00001 #ifndef __OOUC_TOKENIZER__ 00002 #define __OOUC_TOKENIZER__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d O u c T o k e n i z e r . h h */ 00006 /* */ 00007 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved. See XrdInfo.cc for complete License Terms */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC03-76-SFO0515 with the Deprtment of Energy */ 00011 /******************************************************************************/ 00012 00013 // $Id: XrdOucTokenizer.hh 22437 2008-03-04 14:35:16Z rdm $ 00014 00015 class XrdOucTokenizer 00016 { 00017 public: 00018 00019 XrdOucTokenizer(char *bp) {Attach(bp);} 00020 00021 ~XrdOucTokenizer() {} 00022 00023 // Attach a new buffer to the tokenizer. 00024 // 00025 void Attach(char *bp); 00026 00027 // Get the next record from a buffer. Return null upon eof or error. 00028 // 00029 char *GetLine(); 00030 00031 // Get the next blank-delimited token in the record returned by Getline(). A 00032 // null pointer is returned if no more tokens remain. Each token is terminated 00033 // a null byte. Note that the record buffer is modified during processing. The 00034 // routine may optionally return a pointer to the remainder of the line with 00035 // no leading blanks. The lowcase argument, if 1, converts all letters to lower 00036 // case in the token. 00037 // 00038 char *GetToken(char **rest=0, int lowcase=0); 00039 00040 // RetToken() simply backups the token scanner the last tken returned. Only 00041 // one backup is allowed. 00042 // 00043 void RetToken(); 00044 00045 // A 0 indicates that tabs in the stream should be converted to spaces. 00046 // A 1 inducates that tabs should be left alone (the default). 00047 // 00048 void Tabs(int x=1) {notabs = !x;} 00049 00050 /******************************************************************************/ 00051 00052 private: 00053 char *buff; 00054 char *token; 00055 char *tnext; 00056 int notabs; 00057 }; 00058 #endif