12#include <fmt/format.h>
16 constexpr struct select1st_t {
17 template <
typename S,
typename T>
18 const S& operator()(
const std::pair<S, T>& p )
const {
21 template <
typename S,
typename T>
22 S& operator()( std::pair<S, T>& p )
const {
29 std::vector<std::string> result;
30 std::transform( std::begin(
catalog_ ), std::end(
catalog_ ), std::back_inserter( result ), select1st );
37 CatalogSet::mapped_type properties;
38 properties.insert( property );
42 it->second.erase( *property );
43 it->second.insert( property );
49 if ( it ==
catalog_.end() )
return nullptr;
51 auto pit = std::find_if( it->second.begin(), it->second.end(),
52 [&](
const Property& property ) { return name == property.NameInClient(); } );
54 return ( pit != it->second.end() ) ? &*pit :
nullptr;
58 for (
const auto& client :
catalog_ ) {
59 for (
const auto& current : client.second ) { result += current.ToString() +
"\n"; }
64 o << R
"(// ==================================================================================
66// ==================================================================================
69 size_t nComponents = 0;
70 size_t nProperties = 0;
72 for (
const auto& client :
catalog_ ) {
73 o << fmt::format(
"// Properties of {:<25} # = {}", fmt::format(
"'{}'", client.first ), client.second.size() );
75 nProperties += client.second.size();
76 for (
const auto& current : client.second ) {
77 o << fmt::format(
"{:<44} = {} ;", current.FullName(), current.ValueAsString() );
80 o << fmt::format( R
"(// ==================================================================================
81// End parser catalog #Components={} #Properties={}
82// ==================================================================================
84 nComponents, nProperties );
Property * Find(std::string_view client, std::string_view name)
bool Add(Property *property)
std::vector< std::string > ClientNames() const
std::string ToString() const
std::ostream & fillStream(std::ostream &out) const
print the content of the catalogue to std::ostream
const std::string & ClientName() const