项目地址:https://github.com/chmike/CxxUrl
1. 下载代码
https://github.com/chmike/CxxUrl.git
2. 编译
cd CxxUrl && cmake . && make
编译后生成 libCxxUrl.so
3. 使用 libCxxUrl.so
#include <iostream>
#include "url.hpp"
int main() {
auto homepage = "https://www.so.fengbohello.top/";
Url u{homepage};
Url bu;
bu.clear().scheme(url.scheme()).host(url.host());
if(!u.port().empty()) {
bu.port(u.port());
}
auto rooturl = bu.str();
std::cout << "root url: " << rooturl << std::endl;
return 0;
}