mirror of
https://github.com/davidallendj/gdpm.git
synced 2025-12-20 22:00:04 -07:00
Major refactor and API changes
- Updated `.gitignore` file - Updated `CMakeLists.txt` to build static exectuable - Changed some `Doxyfile` configurations to build more robust and complete documentation (WIP) - Changed how `remote` works to better reflect `git`'s API (WIP) - Changed how error handling works - Improved `bin/compile.sh` script - Improved `bin/lines.sh` script (kinda) - Removed some instances of `fmt` in favor of `std` string functions - Restructed style for better readibility
This commit is contained in:
parent
ba23299777
commit
5a73651ad1
29 changed files with 1836 additions and 1140 deletions
|
|
@ -66,14 +66,22 @@ namespace gdpm::utils{
|
|||
return result;
|
||||
}
|
||||
|
||||
std::string replace_first(std::string &s, const std::string &from, const std::string &to){
|
||||
std::string replace_first(
|
||||
std::string &s,
|
||||
const std::string &from,
|
||||
const std::string &to
|
||||
){
|
||||
size_t pos = s.find(from);
|
||||
if(pos == std::string::npos)
|
||||
return s;
|
||||
return s.replace(pos, from.length(), to);
|
||||
}
|
||||
|
||||
std::string replace_all(std::string& s, const std::string& from, const std::string& to){
|
||||
std::string replace_all(
|
||||
std::string& s,
|
||||
const std::string& from,
|
||||
const std::string& to
|
||||
){
|
||||
size_t pos = 0;
|
||||
while((pos = s.find(from, pos)) != std::string::npos){
|
||||
s.replace(pos, s.length(), to);
|
||||
|
|
@ -83,7 +91,11 @@ namespace gdpm::utils{
|
|||
}
|
||||
|
||||
/* Ref: https://gist.github.com/mobius/1759816 */
|
||||
int extract_zip(const char *archive, const char *dest, int verbose){
|
||||
int extract_zip(
|
||||
const char *archive,
|
||||
const char *dest,
|
||||
int verbose
|
||||
){
|
||||
const char *prog = "gpdm";
|
||||
struct zip *za;
|
||||
struct zip_file *zf;
|
||||
|
|
@ -179,4 +191,15 @@ namespace gdpm::utils{
|
|||
sleep_for(millis);
|
||||
// sleep_until(system_clock::now() + millis);
|
||||
}
|
||||
|
||||
std::string join(
|
||||
const std::vector<std::string>& target,
|
||||
const std::string& delimiter
|
||||
){
|
||||
std::string o;
|
||||
std::for_each(target.begin(), target.end(), [&o, &delimiter](const std::string& s){
|
||||
o += s + delimiter;
|
||||
});
|
||||
return o;
|
||||
}
|
||||
} // namespace gdpm::utils
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue