1
0
forked from Alepha/Alepha

List delimiting primitive for output streams.

This commit is contained in:
2024-04-03 15:53:43 -04:00
parent 8bd9852bd4
commit 66e8acfd5b
5 changed files with 159 additions and 0 deletions

42
delimited_list.h Normal file
View File

@ -0,0 +1,42 @@
static_assert( __cplusplus > 2020'99 );
#pragma once
#include <Alepha/Alepha.h>
#include <ostream>
#include <Alepha/IOStreams/StackableStreambuf.h>
namespace Alepha::Hydrogen ::detail:: delimited_list_m
{
inline namespace exports {}
struct DelimitedList_params
{
const std::string delimiter;
explicit DelimitedList_params( const std::string delimiter ) : delimiter( delimiter ) {}
};
struct MarkItem_t {};
namespace exports
{
constexpr MarkItem_t NextItem;;
using StartDelimitedList= IOStreams::PushStack< DelimitedList_params >;
constexpr IOStreams::PopStack EndDelimitedList;
}
inline namespace impl
{
void build_streambuf( std::ostream &, StartDelimitedList && );
std::ostream &operator << ( std::ostream &os, MarkItem_t );
}
}
namespace Alepha::Hydrogen::inline exports::inline delimited_list_m
{
using namespace detail::delimited_list_m::exports;
}