4#include "Stroika/Foundation/StroikaPreComp.h"
6#include "Stroika/Foundation/Characters/FloatConversion.h"
8#include "Stroika/Foundation/Characters/String2Int.h"
9#include "Stroika/Foundation/DataExchange/BadFormatException.h"
17using namespace Stroika::Foundation::DataExchange::Variant;
18using namespace Stroika::Foundation::DataExchange::Variant::CharacterDelimitedLines;
19using namespace Stroika::Foundation::Streams;
25using Memory::MakeSharedPtr;
39 bool fTrimTokens_{
false};
41 : fDelimiters_{columnDelimiters}
42 , fTrimTokens_{trimTokens}
45 virtual _SharedPtrIRep Clone ()
const override
47 return MakeSharedPtr<Rep_> (fDelimiters_, fTrimTokens_);
49 virtual optional<filesystem::path> GetDefaultFileSuffix ()
const override
67#if USE_NOISY_TRACE_IN_THIS_MODULE_
71 for (
const String& line : in.ReadLines ()) {
76#if USE_NOISY_TRACE_IN_THIS_MODULE_
77 DbgTrace (
"DataExchange::Variant::CharacterDelimitedLines::Reader::ReadMatrix: line={}, tokenCount={}"_f, line, tokens.size ());
78 for ([[maybe_unused]]
const auto& i : tokens) {
87CharacterDelimitedLines::Reader::Reader (
const Set<Character>& columnDelimiters,
bool trimTokens)
88 : inherited{
MakeSharedPtr<Rep_> (columnDelimiters, trimTokens)}
99 return Debug::UncheckedDynamicCast<const Rep_&> (_GetRep ()).ReadMatrix (in);
auto MakeSharedPtr(ARGS_TYPE &&... args) -> shared_ptr< T >
same as make_shared, but if type T has block allocation, then use block allocation for the 'shared pa...
conditional_t< qStroika_Foundation_Memory_PreferBlockAllocation and andTrueCheck, BlockAllocationUseHelper< T >, Common::Empty > UseBlockAllocationIfAppropriate
Use this to enable block allocation for a particular class. Beware of subclassing.
String is like std::u32string, except it is much easier to use, often much more space efficient,...
A generalization of a vector: a container whose elements are keyed by the natural numbers.
nonvirtual RESULT_CONTAINER Map(ELEMENT_MAPPER &&elementMapper) const
'override' Iterable<>::Map () function so RESULT_CONTAINER defaults to Sequence, and improve that cas...
nonvirtual void Append(ArgByValueType< value_type > item)
Set<T> is a container of T, where once an item is added, additionally adds () do nothing.
nonvirtual Iterable< Sequence< String > > ReadMatrix(const Streams::InputStream::Ptr< byte > &in) const
Simple variant-value (case variant union) object, with (variant) basic types analogous to a value in ...
Iterable<T> is a base class for containers which easily produce an Iterator<T> to traverse them.
Ptr New(const InputStream::Ptr< byte > &src, optional< AutomaticCodeCvtFlags > codeCvtFlags={}, optional< SeekableFlag > seekable={}, ReadAhead readAhead=eReadAheadAllowed)
Create an InputStream::Ptr<Character> from the arguments (usually binary source) - which can be used ...