XRootD
XrdPfc::SplitParser Struct Reference

#include <XrdPfc.hh>

+ Inheritance diagram for XrdPfc::SplitParser:
+ Collaboration diagram for XrdPfc::SplitParser:

Public Member Functions

 SplitParser (const std::string &s, const char *d)
 
 ~SplitParser ()
 
int fill_argv (std::vector< char * > &argv)
 
char * get_reminder ()
 
char * get_reminder_with_delim ()
 
char * get_token ()
 

Public Attributes

const char * f_delim
 
bool f_first
 
char * f_state
 
char * f_str
 

Detailed Description

Definition at line 138 of file XrdPfc.hh.

Constructor & Destructor Documentation

◆ SplitParser()

XrdPfc::SplitParser::SplitParser ( const std::string &  s,
const char *  d 
)
inline

Definition at line 145 of file XrdPfc.hh.

145  :
146  f_str(strdup(s.c_str())), f_delim(d), f_state(0), f_first(true)
147  {}
const char * f_delim
Definition: XrdPfc.hh:141

◆ ~SplitParser()

XrdPfc::SplitParser::~SplitParser ( )
inline

Definition at line 148 of file XrdPfc.hh.

148 { free(f_str); }

References f_str.

Member Function Documentation

◆ fill_argv()

int XrdPfc::SplitParser::fill_argv ( std::vector< char * > &  argv)
inline

Definition at line 167 of file XrdPfc.hh.

168  {
169  if (!f_first) return 0;
170  int dcnt = 0; { char *p = f_str; while (*p) { if (*(p++) == f_delim[0]) ++dcnt; } }
171  argv.reserve(dcnt + 1);
172  int argc = 0;
173  char *i = strtok_r(f_str, f_delim, &f_state);
174  while (i)
175  {
176  ++argc;
177  argv.push_back(i);
178  // printf(" arg %d : '%s'\n", argc, i);
179  i = strtok_r(0, f_delim, &f_state);
180  }
181  return argc;
182  }

References f_delim, f_first, f_state, and f_str.

Referenced by XrdPfc::Cache::ExecuteCommandUrl().

+ Here is the caller graph for this function:

◆ get_reminder()

char* XrdPfc::SplitParser::get_reminder ( )
inline

Definition at line 162 of file XrdPfc.hh.

163  {
164  return f_first ? f_str : f_state;
165  }

References f_first, f_state, and f_str.

Referenced by XrdPfc::PathTokenizer::PathTokenizer(), and XrdPfc::Cache::ExecuteCommandUrl().

+ Here is the caller graph for this function:

◆ get_reminder_with_delim()

char* XrdPfc::SplitParser::get_reminder_with_delim ( )
inline

Definition at line 156 of file XrdPfc.hh.

157  {
158  if (f_first) { return f_str; }
159  else { *(f_state - 1) = f_delim[0]; return f_state - 1; }
160  }

References f_delim, f_first, f_state, and f_str.

Referenced by XrdPfc::Cache::ExecuteCommandUrl().

+ Here is the caller graph for this function:

◆ get_token()

char* XrdPfc::SplitParser::get_token ( )
inline

Definition at line 150 of file XrdPfc.hh.

151  {
152  if (f_first) { f_first = false; return strtok_r(f_str, f_delim, &f_state); }
153  else { return strtok_r(0, f_delim, &f_state); }
154  }

References f_delim, f_first, f_state, and f_str.

Referenced by XrdPfc::PathTokenizer::PathTokenizer(), and XrdPfc::Cache::ExecuteCommandUrl().

+ Here is the caller graph for this function:

Member Data Documentation

◆ f_delim

const char* XrdPfc::SplitParser::f_delim

Definition at line 141 of file XrdPfc.hh.

Referenced by fill_argv(), get_reminder_with_delim(), and get_token().

◆ f_first

bool XrdPfc::SplitParser::f_first

Definition at line 143 of file XrdPfc.hh.

Referenced by fill_argv(), get_reminder(), get_reminder_with_delim(), and get_token().

◆ f_state

char* XrdPfc::SplitParser::f_state

Definition at line 142 of file XrdPfc.hh.

Referenced by fill_argv(), get_reminder(), get_reminder_with_delim(), and get_token().

◆ f_str

char* XrdPfc::SplitParser::f_str

Definition at line 140 of file XrdPfc.hh.

Referenced by ~SplitParser(), fill_argv(), get_reminder(), get_reminder_with_delim(), and get_token().


The documentation for this struct was generated from the following file: