#include <XrdOucTUtils.hh>
|
| template<typename T> |
| static std::map< std::string, T >::const_iterator | caseInsensitiveFind (const std::map< std::string, T > &m, const std::string &lowerCaseSearchKey) |
| template<class Container> |
| static void | splitString (Container &result, const std::string &input, const std::string &delimiter) |
| | Split a string.
|
This class is created to contain template code for utility reason. Its purpose is basically the same as the XrdOucUtils, but it will only contain templated code
Definition at line 43 of file XrdOucTUtils.hh.
◆ caseInsensitiveFind()
template<typename T>
| std::map< std::string, T >::const_iterator XrdOucTUtils::caseInsensitiveFind |
( |
const std::map< std::string, T > & | m, |
|
|
const std::string & | lowerCaseSearchKey ) |
|
inlinestatic |
Looks for an element in a std::map<std::string, T> in a case-insensitive way
- Template Parameters
-
| T | the type of the associated element to search |
- Parameters
-
| m | the map to search |
| lowerCaseSearchKey | the key to look for (must be lower-cased!) |
- Returns
- the iterator related to the map find
Definition at line 79 of file XrdOucTUtils.hh.
79 {
80 auto it = std::find_if(m.begin(),m.end(), [&lowerCaseSearchKey](const std::pair<std::string, T> & p){
81 return std::equal(
82 p.first.begin(), p.first.end(),
83 lowerCaseSearchKey.begin(), lowerCaseSearchKey.end(),
84 [](unsigned char a, unsigned char b) {
85 return (std::tolower(a) == b);
86 }
87 );
88 });
89 return it;
90}
Referenced by XrdTpcUtils::prepareOpenURL(), Macaroons::Handler::ProcessReq(), and TPC::TPCHandler::ProcessReq().
◆ splitString()
template<class Container>
| void XrdOucTUtils::splitString |
( |
Container & | result, |
|
|
const std::string & | input, |
|
|
const std::string & | delimiter ) |
|
inlinestatic |
Split a string.
Definition at line 51 of file XrdOucTUtils.hh.
51 {
52 size_t start = 0;
53 size_t end = 0;
54 size_t length = 0;
55
56 do {
57 end = input.find(delimiter, start);
58
59 if (end != std::string::npos)
60 length = end - start;
61 else
62 length = input.length() - start;
63
64 if (length)
65 result.push_back(input.substr(start, length));
66
67 start = end + delimiter.size();
68 } while (end != std::string::npos);
69}
Referenced by XrdHttpReadRangeHandler::Configure(), and XrdCl::Utils::splitString().
The documentation for this class was generated from the following file: