2010-11-13 23:59:23 +00:00
|
|
|
#ifndef S3FS_STRING_UTIL_H_
|
|
|
|
#define S3FS_STRING_UTIL_H_
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A collection of string utilities for manipulating URLs and HTTP responses.
|
|
|
|
*/
|
2011-06-26 00:37:52 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <syslog.h>
|
|
|
|
|
2010-11-13 23:59:23 +00:00
|
|
|
#include <string>
|
2011-06-26 00:37:52 +00:00
|
|
|
#include <sstream>
|
2010-11-13 23:59:23 +00:00
|
|
|
|
|
|
|
#define SPACES " \t\r\n"
|
|
|
|
|
2011-06-26 00:37:52 +00:00
|
|
|
template<typename T> std::string str(T value) {
|
|
|
|
std::stringstream s;
|
|
|
|
s << value;
|
|
|
|
return s.str();
|
2010-11-13 23:59:23 +00:00
|
|
|
}
|
|
|
|
|
2011-06-26 00:37:52 +00:00
|
|
|
extern bool debug;
|
|
|
|
extern bool foreground;
|
|
|
|
extern bool service_validated;
|
2010-11-13 23:59:23 +00:00
|
|
|
|
2011-06-26 00:37:52 +00:00
|
|
|
extern std::string bucket;
|
2010-11-13 23:59:23 +00:00
|
|
|
|
2011-06-26 00:37:52 +00:00
|
|
|
std::string trim_left(const std::string &s, const std::string &t = SPACES);
|
|
|
|
std::string trim_right(const std::string &s, const std::string &t = SPACES);
|
|
|
|
std::string trim(const std::string &s, const std::string &t = SPACES);
|
|
|
|
std::string lower(std::string s);
|
|
|
|
std::string IntToStr(int);
|
|
|
|
std::string get_date();
|
|
|
|
std::string urlEncode(const std::string &s);
|
|
|
|
std::string prepare_url(const char* url);
|
2010-12-21 15:24:46 +00:00
|
|
|
|
2010-11-13 23:59:23 +00:00
|
|
|
|
|
|
|
#endif // S3FS_STRING_UTIL_H_
|