xrootd
Loading...
Searching...
No Matches
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/* Produced by Andrew Hanushevsky for Stanford University under contract */
9/* DE-AC02-76-SFO0515 with the Deprtment of Energy */
10/* */
11/* This file is part of the XRootD software suite. */
12/* */
13/* XRootD is free software: you can redistribute it and/or modify it under */
14/* the terms of the GNU Lesser General Public License as published by the */
15/* Free Software Foundation, either version 3 of the License, or (at your */
16/* option) any later version. */
17/* */
18/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
19/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
20/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
21/* License for more details. */
22/* */
23/* You should have received a copy of the GNU Lesser General Public License */
24/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
25/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
26/* */
27/* The copyright holder's institutional names and contributor's names may not */
28/* be used to endorse or promote products derived from this software without */
29/* specific prior written permission of the institution or contributor. */
30/******************************************************************************/
31
33{
34public:
35
36 XrdOucTokenizer(char *bp) {Attach(bp);}
37
39
40// Attach a new buffer to the tokenizer.
41//
42void Attach(char *bp);
43
44// Get the next record from a buffer. Return null upon eof or error.
45//
46char *GetLine();
47
48// Get the next blank-delimited token in the record returned by Getline(). A
49// null pointer is returned if no more tokens remain. Each token is terminated
50// a null byte. Note that the record buffer is modified during processing. The
51// routine may optionally return a pointer to the remainder of the line with
52// no leading blanks. The lowcase argument, if 1, converts all letters to lower
53// case in the token.
54//
55char *GetToken(char **rest=0, int lowcase=0);
56
57// RetToken() simply backups the token scanner the last tken returned. Only
58// one backup is allowed.
59//
60void RetToken();
61
62// A 0 indicates that tabs in the stream should be converted to spaces.
63// A 1 inducates that tabs should be left alone (the default).
64//
65void Tabs(int x=1) {notabs = !x;}
66
67/******************************************************************************/
68
69private:
70 char *buff;
71 char *token;
72 char *tnext;
73 int notabs;
74};
75#endif
Definition XrdOucTokenizer.hh:33
char * buff
Definition XrdOucTokenizer.hh:70
int notabs
Definition XrdOucTokenizer.hh:73
void Tabs(int x=1)
Definition XrdOucTokenizer.hh:65
char * GetToken(char **rest=0, int lowcase=0)
XrdOucTokenizer(char *bp)
Definition XrdOucTokenizer.hh:36
char * GetLine()
void Attach(char *bp)
char * token
Definition XrdOucTokenizer.hh:71
char * tnext
Definition XrdOucTokenizer.hh:72
~XrdOucTokenizer()
Definition XrdOucTokenizer.hh:38