Begin converting URL struct into modern C++ class

This commit is contained in:
2025-04-12 22:20:34 -04:00
parent 26b903f02f
commit 27ae7d91c1
18 changed files with 171 additions and 104 deletions

View File

@ -538,6 +538,23 @@ const char *dStr_printable(Dstr *in, int maxlen)
return out->str;
}
extern "C++"
{
#include <Alepha/AutoRAII.h>
}
std::string
dStr_printable_std(const std::string &in, const int maxlen)
{
const auto wrapped= Alepha::AutoRAII
{
[&]{ return dStr_new( in.c_str() ); },
[]( auto d ) { dStr_free( d, true ); }
};
return dStr_printable( wrapped, maxlen );
}
/*
*- dList ---------------------------------------------------------------------
*/

View File

@ -124,6 +124,13 @@ void dStr_sprintfa (Dstr *ds, const char *format, ...);
int dStr_cmp(Dstr *ds1, Dstr *ds2);
char *dStr_memmem(Dstr *haystack, Dstr *needle);
const char *dStr_printable(Dstr *in, int maxlen);
#ifdef __cplusplus
extern "C++"
{
#include <string>
}
std::string dStr_printable_std(const std::string &in, int maxlen);
#endif
/*
*-- dList --------------------------------------------------------------------