1
0
forked from Alepha/Alepha

Started work on some formatting primitives.

Things like markdown and indent fixing in UDLs.
This commit is contained in:
2024-04-04 18:18:11 -04:00
parent 6d60639b1c
commit 4cec1a7299

40
Format.dir/format.h Normal file
View File

@ -0,0 +1,40 @@
static_assert( __cplusplus > 2020'99 );
#pragma once
#include <Alepha/Alepha.h>
#include <string>
namespace Alepha::Hydrogen::Format ::detail:: format_m
{
inline namespace exports
{
std::string operator ""_format ( const char *p, std::size_t sz );
}
inline std::string
exports::operator ""_format ( const char *const p, const std::size_t sz )
{
std::string s{ p, p + s };
if( s.empty() ) return s;
std::size_t indent= 0;
if( s.at( 0 ) == '\n' )
{
s= s.substr( 1 );
while( s.at( 0 ) == ' ' )
{
++indent;
s= s.substr( 1 );
}
}
}
}
namespace Alepha::Hydrogen::Format::inline exports::inline format_m
{
using namespace detail::format_m::exports;
}