XRootD
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_

◆ ~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 110 of file XrdOssCsiConfig.hh.

111  {
112  return prefixend_;
113  }

◆ hasPrefix()

bool TagPath::hasPrefix ( )
inline

Definition at line 84 of file XrdOssCsiConfig.hh.

84 { return !prefix_.empty(); }

References prefix_.

Referenced by XrdOssCsi::Remdir().

+ Here is the caller graph for this function:

◆ isTagFile()

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

Definition at line 50 of file XrdOssCsiConfig.hh.

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

References prefix_.

Referenced by XrdOssCsi::Chmod(), XrdOssCsi::Create(), XrdOssCsi::Mkdir(), XrdOssCsiFile::Open(), XrdOssCsiDir::Readdir(), XrdOssCsi::Reloc(), XrdOssCsi::Remdir(), XrdOssCsi::Rename(), XrdOssCsi::Stat(), XrdOssCsi::StatPF(), XrdOssCsi::StatXA(), XrdOssCsi::Truncate(), and XrdOssCsi::Unlink().

+ Here is the caller graph for this function:

◆ makeBaseDirname()

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

Definition at line 88 of file XrdOssCsiConfig.hh.

89  {
90  if (!path || *path != '/' || prefix_.empty()) return std::string();
91  std::string p(path);
92  simplePath(p);
93  if (p.length()>1) return prefix_ + p;
94  return prefix_;
95  }

References prefix_.

Referenced by XrdOssCsi::Remdir().

+ Here is the caller graph for this function:

◆ makeTagFilename()

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

Definition at line 116 of file XrdOssCsiConfig.hh.

117  {
118  if (!path || *path != '/') return std::string();
119  std::string p(path);
120  simplePath(p);
121  return prefix_ + p + suffix_;
122  }

References prefix_.

Referenced by XrdOssCsi::Create(), XrdOssCsi::Rename(), and XrdOssCsi::Unlink().

+ Here is the caller graph for this function:

◆ matchPrefixDir()

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

Definition at line 100 of file XrdOssCsiConfig.hh.

101  {
102  if (!path || *path != '/' || prefix_.empty()) return false;
103  std::string p(path);
104  simplePath(p);
105  if (prefixstart_ == p) return true;
106  return false;
107  }

References prefix_.

◆ SetPrefix()

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

Definition at line 72 of file XrdOssCsiConfig.hh.

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

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

Referenced by XrdOssCsiConfig::Init().

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

Member Data Documentation

◆ prefix_

std::string TagPath::prefix_

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