You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
685 B
C++
35 lines
685 B
C++
#include "webcc/utility.h"
|
|
|
|
#include <sstream>
|
|
|
|
#include "boost/algorithm/string.hpp"
|
|
#include "boost/uuid/random_generator.hpp"
|
|
#include "boost/uuid/uuid_io.hpp"
|
|
|
|
namespace webcc {
|
|
|
|
std::string RandomUuid() {
|
|
boost::uuids::uuid u = boost::uuids::random_generator()();
|
|
std::stringstream ss;
|
|
ss << u;
|
|
return ss.str();
|
|
}
|
|
|
|
bool SplitKV(const std::string& str, char delimiter,
|
|
std::string* part1, std::string* part2) {
|
|
std::size_t pos = str.find(delimiter);
|
|
if (pos == std::string::npos) {
|
|
return false;
|
|
}
|
|
|
|
*part1 = str.substr(0, pos);
|
|
*part2 = str.substr(pos + 1);
|
|
|
|
boost::trim(*part1);
|
|
boost::trim(*part2);
|
|
|
|
return true;
|
|
}
|
|
|
|
} // namespace webcc
|