libzypp
10.5.0
|
00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00012 #ifndef ZYPP_URL_URLUTILS_H 00013 #define ZYPP_URL_URLUTILS_H 00014 00015 #include <zypp/url/UrlException.h> 00016 00017 #include <string> 00018 #include <vector> 00019 #include <map> 00020 00022 #define URL_SAFE_CHARS ":/?#[]@!$&'()*+,;=" 00023 00025 namespace zypp 00026 { 00027 00029 00030 namespace url 00031 { 00032 00033 00034 // --------------------------------------------------------------- 00040 typedef std::vector < std::string > ParamVec; 00041 00042 00047 typedef std::map < std::string, std::string > ParamMap; 00048 00049 00052 typedef enum { 00053 E_ENCODED, 00054 E_DECODED 00055 } EEncoding; 00056 00057 00058 // --------------------------------------------------------------- 00084 std::string 00085 encode(const std::string &str, const std::string &safe = "", 00086 EEncoding eflag = E_DECODED); 00087 00088 00089 // --------------------------------------------------------------- 00105 std::string 00106 decode(const std::string &str, bool allowNUL = false); 00107 00108 00109 // --------------------------------------------------------------- 00119 std::string 00120 encode_octet(const unsigned char c); 00121 00122 00123 // --------------------------------------------------------------- 00142 int 00143 decode_octet(const char *hex); 00144 00145 00146 // --------------------------------------------------------------- 00160 void 00161 split(ParamVec &pvec, 00162 const std::string &pstr, 00163 const std::string &psep); 00164 00165 00166 // --------------------------------------------------------------- 00194 void 00195 split(ParamMap &pmap, 00196 const std::string &pstr, 00197 const std::string &psep, 00198 const std::string &vsep, 00199 EEncoding eflag = E_ENCODED); 00200 00201 00202 // --------------------------------------------------------------- 00216 std::string 00217 join(const ParamVec &pvec, 00218 const std::string &psep); 00219 00220 00221 // --------------------------------------------------------------- 00243 std::string 00244 join(const ParamMap &pmap, 00245 const std::string &psep, 00246 const std::string &vsep, 00247 const std::string &safe); 00248 00249 00251 } // namespace url 00253 00255 } // namespace zypp 00257 00258 #endif /* ZYPP_URL_URLUTILS_H */ 00259 /* 00260 ** vim: set ts=2 sts=2 sw=2 ai et: 00261 */