xrootd
XrdOucTokenizer.hh
Go to the documentation of this file.
1 #ifndef __OOUC_TOKENIZER__
2 #define __OOUC_TOKENIZER__
3 /******************************************************************************/
4 /* */
5 /* X r d O u c T o k e n i z e r . h h */
6 /* */
7 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved. See XrdInfo.cc for complete License Terms */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC03-76-SFO0515 with the Deprtment of Energy */
11 /******************************************************************************/
12 
13 // $Id$
14 
16 {
17 public:
18 
19  XrdOucTokenizer(char *bp) {Attach(bp);}
20 
22 
23 // Attach a new buffer to the tokenizer.
24 //
25 void Attach(char *bp);
26 
27 // Get the next record from a buffer. Return null upon eof or error.
28 //
29 char *GetLine();
30 
31 // Get the next blank-delimited token in the record returned by Getline(). A
32 // null pointer is returned if no more tokens remain. Each token is terminated
33 // a null byte. Note that the record buffer is modified during processing. The
34 // routine may optionally return a pointer to the remainder of the line with
35 // no leading blanks. The lowcase argument, if 1, converts all letters to lower
36 // case in the token.
37 //
38 char *GetToken(char **rest=0, int lowcase=0);
39 
40 // RetToken() simply backups the token scanner the last tken returned. Only
41 // one backup is allowed.
42 //
43 void RetToken();
44 
45 // A 0 indicates that tabs in the stream should be converted to spaces.
46 // A 1 inducates that tabs should be left alone (the default).
47 //
48 void Tabs(int x=1) {notabs = !x;}
49 
50 /******************************************************************************/
51 
52 private:
53  char *buff;
54  char *token;
55  char *tnext;
56  int notabs;
57 };
58 #endif