2010-06-12 13:04:11 +00:00
|
|
|
#ifndef CEPH_STRLIST_H
|
|
|
|
#define CEPH_STRLIST_H
|
2009-10-29 23:35:13 +00:00
|
|
|
|
|
|
|
#include <list>
|
|
|
|
#include <set>
|
2013-08-15 21:36:49 +00:00
|
|
|
#include <sstream>
|
|
|
|
#include <string>
|
2013-05-10 00:00:17 +00:00
|
|
|
#include <vector>
|
2009-10-29 23:35:13 +00:00
|
|
|
|
2011-11-16 21:40:02 +00:00
|
|
|
extern void get_str_list(const std::string& str,
|
2010-12-30 01:58:21 +00:00
|
|
|
std::list<std::string>& str_list);
|
2013-02-19 17:15:30 +00:00
|
|
|
extern void get_str_list(const std::string& str,
|
|
|
|
const char *delims,
|
|
|
|
std::list<std::string>& str_list);
|
2013-05-10 00:00:17 +00:00
|
|
|
extern void get_str_vec(const std::string& str,
|
|
|
|
std::vector<std::string>& str_vec);
|
|
|
|
extern void get_str_vec(const std::string& str,
|
|
|
|
const char *delims,
|
|
|
|
std::vector<std::string>& str_vec);
|
|
|
|
extern void get_str_set(const std::string& str,
|
|
|
|
std::set<std::string>& str_list);
|
2011-11-16 21:40:02 +00:00
|
|
|
extern void get_str_set(const std::string& str,
|
2013-05-10 00:00:17 +00:00
|
|
|
const char *delims,
|
2010-12-30 01:58:21 +00:00
|
|
|
std::set<std::string>& str_list);
|
2009-10-29 23:35:13 +00:00
|
|
|
|
2013-08-15 21:36:49 +00:00
|
|
|
inline std::string str_join(const std::vector<std::string>& v, std::string sep)
|
|
|
|
{
|
|
|
|
if (v.empty())
|
|
|
|
return std::string();
|
|
|
|
std::vector<std::string>::const_iterator i = v.begin();
|
|
|
|
std::string r = *i;
|
|
|
|
for (++i; i != v.end(); ++i) {
|
|
|
|
r += sep;
|
|
|
|
r += *i;
|
|
|
|
}
|
|
|
|
return r;
|
|
|
|
}
|
2009-10-29 23:35:13 +00:00
|
|
|
|
|
|
|
#endif
|