Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:15:42

0001 #ifndef __OOUC_TOKENIZER__
0002 #define __OOUC_TOKENIZER__
0003 /******************************************************************************/
0004 /*                                                                            */
0005 /*                    X r d O u c T o k e n i z e r . h h                     */
0006 /*                                                                            */
0007 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University  */
0008 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
0009 /*                DE-AC02-76-SFO0515 with the Deprtment of Energy             */
0010 /*                                                                            */
0011 /* This file is part of the XRootD software suite.                            */
0012 /*                                                                            */
0013 /* XRootD is free software: you can redistribute it and/or modify it under    */
0014 /* the terms of the GNU Lesser General Public License as published by the     */
0015 /* Free Software Foundation, either version 3 of the License, or (at your     */
0016 /* option) any later version.                                                 */
0017 /*                                                                            */
0018 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
0019 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
0020 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
0021 /* License for more details.                                                  */
0022 /*                                                                            */
0023 /* You should have received a copy of the GNU Lesser General Public License   */
0024 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
0025 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
0026 /*                                                                            */
0027 /* The copyright holder's institutional names and contributor's names may not */
0028 /* be used to endorse or promote products derived from this software without  */
0029 /* specific prior written permission of the institution or contributor.       */
0030 /******************************************************************************/
0031 
0032 class XrdOucTokenizer
0033 {
0034 public:
0035 
0036             XrdOucTokenizer(char *bp) {Attach(bp);}
0037 
0038            ~XrdOucTokenizer() {}
0039 
0040 // Attach a new buffer to the tokenizer.
0041 //
0042 void         Attach(char *bp);
0043 
0044 // Get the next record from a buffer. Return null upon eof or error.
0045 //
0046 char        *GetLine();
0047 
0048 // Get the next blank-delimited token in the record returned by Getline(). A
0049 // null pointer is returned if no more tokens remain. Each token is terminated
0050 // a null byte. Note that the record buffer is modified during processing. The
0051 // routine may optionally return a pointer to the remainder of the line with 
0052 // no leading blanks. The lowcase argument, if 1, converts all letters to lower 
0053 // case in the token.
0054 //
0055 char        *GetToken(char **rest=0, int lowcase=0);
0056 
0057 // RetToken() simply backups the token scanner the last tken returned. Only
0058 // one backup is allowed.
0059 //
0060 void         RetToken();
0061 
0062 // A 0 indicates that tabs in the stream should be converted to spaces.
0063 // A 1 inducates that tabs should be left alone (the default).
0064 //
0065 void         Tabs(int x=1) {notabs = !x;}
0066 
0067 /******************************************************************************/
0068   
0069 private:
0070         char *buff;
0071         char *token;
0072         char *tnext;
0073         int   notabs;
0074 };
0075 #endif