XRootD
XrdOucTokenizer Class Reference

#include <XrdOucTokenizer.hh>

+ Collaboration diagram for XrdOucTokenizer:

Public Member Functions

 XrdOucTokenizer (char *bp)
 
 ~XrdOucTokenizer ()
 
void Attach (char *bp)
 
char * GetLine ()
 
char * GetToken (char **rest=0, int lowcase=0)
 
void RetToken ()
 
void Tabs (int x=1)
 

Detailed Description

Definition at line 32 of file XrdOucTokenizer.hh.

Constructor & Destructor Documentation

◆ XrdOucTokenizer()

XrdOucTokenizer::XrdOucTokenizer ( char *  bp)
inline

Definition at line 36 of file XrdOucTokenizer.hh.

36 {Attach(bp);}
void Attach(char *bp)

References Attach().

+ Here is the call graph for this function:

◆ ~XrdOucTokenizer()

XrdOucTokenizer::~XrdOucTokenizer ( )
inline

Definition at line 38 of file XrdOucTokenizer.hh.

38 {}

Member Function Documentation

◆ Attach()

void XrdOucTokenizer::Attach ( char *  bp)

Definition at line 43 of file XrdOucTokenizer.cc.

44 {
45  buff = bp;
46  token = 0;
47  tnext = (char *)"";
48  notabs = 0;
49 }

Referenced by XrdOucTokenizer(), XrdPosixXrootPath::XrdPosixXrootPath(), XrdOucGatherConf::Gather(), XrdOucBackTrace::Init(), main(), XrdOucArgs::Set(), and XrdOucGatherConf::useData().

+ Here is the caller graph for this function:

◆ GetLine()

char * XrdOucTokenizer::GetLine ( )

Definition at line 55 of file XrdOucTokenizer.cc.

56 {
57  char *bp;
58 
59 // Check if end of buffer has been reached.
60 //
61  if (!buff || *buff == '\0') return (char *)NULL;
62 
63 // Find the next record in the buffer
64 //
65  bp = buff;
66  if (notabs)
67  while(*bp && (*bp == ' ' || *bp == '\t')) bp++;
68  else while(*bp && *bp == ' ' ) bp++;
69 
70  tnext = bp;
71 
72 // Find the end of the record
73 //
74  if (notabs)
75  while(*bp && *bp != '\n') {if (*bp == '\t') *bp = ' '; bp++;}
76  else while(*bp && *bp != '\n') bp++;
77 
78 // Set the end of the line
79 //
80  if (*bp) {*bp = '\0'; buff = bp+1;}
81  else buff = bp;
82 
83 // All done
84 //
85  token = 0;
86  return tnext;
87 }

Referenced by XrdPosixXrootPath::XrdPosixXrootPath(), XrdCmsManList::Add(), XrdDigConfig::Configure(), XrdMpxXml::Format(), XrdPssCks::Get(), XrdOucGatherConf::GetLine(), XrdFrmAdmin::Help(), XrdOucBackTrace::Init(), XrdSecProtocolsss::Load_Server(), main(), XrdCmsManager::Rerun(), XrdCl::Log::Say(), XrdOucArgs::Set(), XrdOucgetName2Name(), XrdSecProtocolgsiInit(), XrdSecProtocolkrb5Init(), XrdSecProtocolpwdInit(), and XrdSecProtocolztnInit().

+ Here is the caller graph for this function:

◆ GetToken()

char * XrdOucTokenizer::GetToken ( char **  rest = 0,
int  lowcase = 0 
)

Definition at line 93 of file XrdOucTokenizer.cc.

94 {
95 
96  // Skip to the first non-blank character.
97  //
98  while (*tnext && *tnext == ' ') tnext++;
99  if (!*tnext) return (char *)NULL;
100  token = tnext;
101 
102  // Find the end of the token.
103  //
104  if (lowcase) while (*tnext && *tnext != ' ')
105  {*tnext = (char)tolower((int)*tnext); tnext++;}
106  else while (*tnext && *tnext != ' ') {tnext++;}
107  if (*tnext) {*tnext = '\0'; tnext++;}
108 
109  // Check if remaining line is to be returned
110  //
111  if (rest)
112  {while (*tnext && *tnext == ' ') tnext++;
113  *rest = tnext;
114  }
115 
116  // All done here.
117  //
118  return token;
119 }

Referenced by XrdPosixXrootPath::XrdPosixXrootPath(), XrdCmsManList::Add(), XrdDigConfig::Configure(), XrdMpxXml::Format(), XrdPssCks::Get(), XrdOucArgs::getarg(), XrdOucArgs::getopt(), XrdOucGatherConf::GetToken(), XrdFrmAdmin::Help(), XrdOucBackTrace::Init(), XrdSecProtocolsss::Load_Server(), main(), XrdCmsManager::Rerun(), XrdOucgetName2Name(), XrdSecProtocolgsiInit(), XrdSecProtocolkrb5Init(), XrdSecProtocolpwdInit(), and XrdSecProtocolztnInit().

+ Here is the caller graph for this function:

◆ RetToken()

void XrdOucTokenizer::RetToken ( )

Definition at line 125 of file XrdOucTokenizer.cc.

126 {
127  // Backup one token, we can only back up once
128  //
129  if (token)
130  {if (*tnext) token[strlen(token)] = ' ';
131  tnext = token;
132  token = 0;
133  }
134 }

Referenced by XrdMpxXml::Format(), XrdOucArgs::getopt(), and XrdOucGatherConf::RetToken().

+ Here is the caller graph for this function:

◆ Tabs()

void XrdOucTokenizer::Tabs ( int  x = 1)
inline

Definition at line 65 of file XrdOucTokenizer.hh.

65 {notabs = !x;}

Referenced by XrdOucGatherConf::Tabs().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: