forked from Alepha/Alepha
List delimiting primitive for output streams.
This commit is contained in:
42
delimited_list.h
Normal file
42
delimited_list.h
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user