XRootD
Loading...
Searching...
No Matches
TagPath Class Reference

#include <XrdOssCsiConfig.hh>

+ Collaboration diagram for TagPath:

Public Member Functions

 TagPath ()
 
 ~TagPath ()
 
std::string getPrefixName ()
 
bool hasPrefix ()
 
bool isTagFile (const char *path)
 
std::string makeBaseDirname (const char *path)
 
std::string makeTagFilename (const char *path)
 
bool matchPrefixDir (const char *path)
 
int SetPrefix (XrdSysError &Eroute, const std::string &v)
 

Public Attributes

std::string prefix_
 

Detailed Description

Definition at line 41 of file XrdOssCsiConfig.hh.

Constructor & Destructor Documentation

◆ TagPath()

TagPath::TagPath ( )
inline

Definition at line 45 of file XrdOssCsiConfig.hh.

45: prefix_("/.xrdt"), suffix_(".xrdt") { calcPrefixElements(); }
std::string prefix_

References prefix_.

◆ ~TagPath()

TagPath::~TagPath ( )
inline

Definition at line 46 of file XrdOssCsiConfig.hh.

46{ }

Member Function Documentation

◆ getPrefixName()

std::string TagPath::getPrefixName ( )
inline

Definition at line 118 of file XrdOssCsiConfig.hh.

119 {
120 return prefixend_;
121 }

◆ hasPrefix()

bool TagPath::hasPrefix ( )
inline

Definition at line 86 of file XrdOssCsiConfig.hh.

86{ return !prefix_.empty(); }

References prefix_.

◆ isTagFile()

bool TagPath::isTagFile ( const char * path)
inline

Definition at line 51 of file XrdOssCsiConfig.hh.

52 {
53 if (!path || !*path) return false;
54 std::string s(path);
55 simplePath(s);
56 // if prefix_ set, the test is to match if "path" is equal to or starts with prefix_
57 // we do not require matching suffix_, this will also match the prefix_ directory
58 if (!prefix_.empty())
59 {
60 if (s.find(prefix_) == 0)
61 {
62 if (prefix_.length() == s.length()) return true;
63 if (s[prefix_.length()] == '/') return true;
64 }
65 return false;
66 }
67 // prefix_ not set, test is if "path" ends with suffix_
68 const size_t haystack = s.length();
69 const size_t needle = suffix_.length();
70 if (haystack >= needle && s.substr(haystack-needle, std::string::npos) == suffix_) return true;
71 return false;
72 }

References prefix_.

◆ makeBaseDirname()

std::string TagPath::makeBaseDirname ( const char * path)
inline

Definition at line 90 of file XrdOssCsiConfig.hh.

91 {
92 if (!path || !*path || prefix_.empty()) return std::string();
93
94 std::string p(path);
95 bool wasabs = false;
96 simplePath(p,&wasabs);
97 std::string ret = (wasabs) ? prefix_ : prefix_.substr(1);
98 if (p.length()>1) ret += p;
99 return ret;
100 }

References prefix_.

◆ makeTagFilename()

std::string TagPath::makeTagFilename ( const char * path)
inline

Definition at line 124 of file XrdOssCsiConfig.hh.

125 {
126 if (!path || !*path) return std::string();
127 std::string p(path);
128 bool wasabs = false;
129 simplePath(p,&wasabs);
130 if (wasabs) return prefix_ + p + suffix_;
131 return prefix_.substr(1) + p + suffix_;
132 }

References prefix_.

◆ matchPrefixDir()

bool TagPath::matchPrefixDir ( const char * path)
inline

Definition at line 106 of file XrdOssCsiConfig.hh.

107 {
108 if (!path || !*path || prefix_.empty()) return false;
109
110 std::string p(path);
111 simplePath(p);
112 if (prefixstart_ == p) return true;
113 return false;
114 }

References prefix_.

◆ SetPrefix()

int TagPath::SetPrefix ( XrdSysError & Eroute,
const std::string & v )
inline

Definition at line 74 of file XrdOssCsiConfig.hh.

75 {
76 if (!v.empty() && v[0] != '/')
77 {
78 Eroute.Emsg("Config","prefix must be empty or start with /");
79 return 1;
80 }
81 prefix_ = v;
82 calcPrefixElements();
83 return XrdOssOK;
84 }
#define XrdOssOK
Definition XrdOss.hh:50
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)

References XrdSysError::Emsg(), prefix_, and XrdOssOK.

+ Here is the call graph for this function:

Member Data Documentation

◆ prefix_

std::string TagPath::prefix_

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