XRootD
Loading...
Searching...
No Matches
XrdPfc::SplitParser Struct Reference

#include <XrdPfcPathParseTools.hh>

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

Public Member Functions

 SplitParser (const std::string &s, const char *d)
 
 ~SplitParser ()
 
const char * get_reminder ()
 
const char * get_reminder_with_delim ()
 
const char * get_token ()
 
std::string get_token_as_string ()
 
bool has_reminder ()
 
bool is_first () const
 
int pre_count_n_tokens ()
 

Public Attributes

const char * f_delim
 
char * f_state
 
char * f_str
 

Detailed Description

Definition at line 12 of file XrdPfcPathParseTools.hh.

Constructor & Destructor Documentation

◆ SplitParser()

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

Definition at line 18 of file XrdPfcPathParseTools.hh.

18 :
19 f_str(strdup(s.c_str())), f_delim(d), f_state(f_str)
20 {}

◆ ~SplitParser()

XrdPfc::SplitParser::~SplitParser ( )
inline

Definition at line 21 of file XrdPfcPathParseTools.hh.

21{ free(f_str); }

References f_str.

Member Function Documentation

◆ get_reminder()

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

Definition at line 52 of file XrdPfcPathParseTools.hh.

53 {
54 return f_state ? f_state : "";
55 }

References f_state.

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

+ Here is the caller graph for this function:

◆ get_reminder_with_delim()

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

Definition at line 46 of file XrdPfcPathParseTools.hh.

47 {
48 if (is_first()) { return f_str; }
49 else { *(f_state - 1) = f_delim[0]; return f_state - 1; }
50 }

References f_delim, f_state, f_str, and is_first().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_token()

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

Definition at line 25 of file XrdPfcPathParseTools.hh.

26 {
27 if ( ! f_state) return 0;
28 // Skip leading delimiters, if any.
29 char *t = f_state + strspn(f_state, f_delim);
30 if (*t == (char) 0) { f_state = 0; return 0; }
31 // Advance state to the next delimeter, if any.
32 f_state = strpbrk(t, f_delim);
33 if (f_state) {
34 *f_state = (char) 0;
35 ++f_state;
36 }
37 return t;
38 }

References f_delim, and f_state.

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

+ Here is the caller graph for this function:

◆ get_token_as_string()

std::string XrdPfc::SplitParser::get_token_as_string ( )
inline

Definition at line 40 of file XrdPfcPathParseTools.hh.

41 {
42 const char *t = get_token();
43 return std::string(t ? t : "");
44 }

References get_token().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ has_reminder()

bool XrdPfc::SplitParser::has_reminder ( )
inline

Definition at line 57 of file XrdPfcPathParseTools.hh.

58 {
59 return f_state && f_state[0] != 0;
60 }

References f_state.

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

+ Here is the caller graph for this function:

◆ is_first()

bool XrdPfc::SplitParser::is_first ( ) const
inline

Definition at line 23 of file XrdPfcPathParseTools.hh.

23{ return f_state == f_str; }

References f_state, and f_str.

Referenced by get_reminder_with_delim().

+ Here is the caller graph for this function:

◆ pre_count_n_tokens()

int XrdPfc::SplitParser::pre_count_n_tokens ( )
inline

Definition at line 62 of file XrdPfcPathParseTools.hh.

62 {
63 int n_tok = 0;
64 char *p = f_state;
65 while (*p) {
66 p += strspn(p, f_delim);
67 if (*p == (char) 0)
68 break;
69 ++n_tok;
70 p = strpbrk(p, f_delim);
71 if ( ! p)
72 break;
73 ++p;
74 }
75 return n_tok;
76 }

References f_delim, and f_state.

Referenced by XrdPfc::PathTokenizer::PathTokenizer().

+ Here is the caller graph for this function:

Member Data Documentation

◆ f_delim

const char* XrdPfc::SplitParser::f_delim

Definition at line 15 of file XrdPfcPathParseTools.hh.

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

◆ f_state

char* XrdPfc::SplitParser::f_state

◆ f_str

char* XrdPfc::SplitParser::f_str

Definition at line 14 of file XrdPfcPathParseTools.hh.

Referenced by ~SplitParser(), get_reminder_with_delim(), and is_first().


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