CoreComponents 3.0.0
A Modern C++ Toolkit
Loading...
Searching...
No Matches

CSV output formatter. More...

#include <cc/CsvFormat>

Inheritance diagram for CsvFormat:

Public Member Functions

 CsvFormat (const Stream &stream=Stream{})
 Create a new CSV line output formatter.
 
CsvFormatoperator<< (const String &s)
 Add a string item.
 
template<class T >
CsvFormatoperator<< (const T &x)
 Add an item of a non-string string.
 
 operator String () const
 Gather the CSV formatted output line.
 
String join () const
 Gather the CSV formatted output line.
 
- Public Member Functions inherited from List< String >
iterator begin ()
 Return iterator pointing to the first item (if any)
 
const_iterator begin () const
 Return readonly iterator pointing to the first item (if any)
 
iterator end ()
 Return iterator pointing behind the last item
 
const_iterator end () const
 Return readonly iterator pointing behind the last item
 
const_iterator cbegin () const
 Return readonly iterator pointing to the first item (if any)
 
const_iterator cend () const
 Return readonly iterator pointing behind the last item
 
reverse_iterator rbegin ()
 Return reverse iterator pointing to the last item (if any)
 
const_reverse_iterator rbegin () const
 Return readonly reverse iterator pointing to the last item (if any)
 
reverse_iterator rend ()
 Return reverse iterator pointing before the first item
 
const_reverse_iterator rend () const
 Return reverse iterator pointing before the first item
 
const_reverse_iterator crbegin () const
 Return readonly reverse iterator pointing to the last item (if any)
 
const_reverse_iterator crend () const
 Return reverse iterator pointing before the first item
 
const Tree & tree () const
 
 List ()=default
 Construct an empty list.
 
 List (const List &other)=default
 Construct a copy of other.
 
 List (std::initializer_list< Item > items)
 Construct with initial items.
 
 List (std::initializer_list< List > lists)
 Initialize by joining initial lists.
 
 List (List &&other)
 Take over the right-side list other.
 
Listoperator= (const List &other)=default
 Assign list other.
 
Listoperator= (List &&other)
 Assign right-side list other.
 
Locator head () const
 Get a locator pointing to the first item.
 
Locator tail () const
 Get a locator pointing to the last item.
 
Locator from (long index) const
 Get a locator pointing to the item at index.
 
long count () const
 Get the number of items stored in the list.
 
long size () const
 Get the number of items stored in the list.
 
bool has (long i) const
 Check if i is a valid index.
 
 operator bool () const
 Check if this list is non-empty.
 
long operator+ () const
 Get the number of items stored in the list.
 
const Itemat (Locator pos) const
 Get constant reference to the item at position pos.
 
const Itemat (long index) const
 Get constant reference to the item at index.
 
ItemmutableAt (Locator pos)
 Get reference to the item at position pos.
 
ItemmutableAt (long index)
 Get reference to the item at index.
 
const Itemoperator[] (long index) const
 Get constant reference to the item at index.
 
Itemoperator[] (long index)
 Get reference to the item at index.
 
Item operator() (long index) const
 Get value at index if 0 <= index && index < count(), otherwise return fallback.
 
Listoperator() (long index, const String &value)
 Set value at index if 0 <= i && i < count(), otherwise do nothing.
 
const Itemfirst () const
 Get constant reference to first item.
 
const Itemlast () const
 Get constant reference to last item.
 
bool firstIs (const Item &item) const
 Tell if item is the first item.
 
bool lastIs (const Item &item) const
 Tell if item is the last item.
 
ItemtouchFirst ()
 Get reference to first item.
 
ItemtouchLast ()
 Get reference to last item.
 
void append (const Item &item)
 Insert item at the end of the list.
 
void prepend (const Item &item)
 Insert item at the beginning of the list.
 
void appendList (const List< Item > &other)
 Append a copy of list other.
 
void prependList (const List< Item > &other)
 Prepend a copy of list other.
 
void pushBack (const Item &item)
 Insert item as a new last item.
 
void pushFront (const Item &item)
 Insert item as a new first item.
 
void popBack ()
 Remove the last item.
 
void popFront ()
 Remove the first item.
 
void emplaceBack (Args... args)
 Insert a new last item.
 
void emplaceFront (Args... args)
 Emplace a new first item.
 
Listoperator<< (const Item &item)
 Append item.
 
Listoperator>> (Item &item)
 Remove and return the first item.
 
void insertAt (Locator &pos, const Item &item)
 Insert item at position pos.
 
void insertAt (long index, const Item &item)
 Insert item at index.
 
void removeAt (Locator &pos)
 Remove item at position pos (and advance pos to the next item)
 
void removeAt (long index)
 Remove item at index.
 
void emplaceAt (Locator &pos, Args... args)
 Create a new item at position pos (initialized with args)
 
void emplaceAt (long index, Args... args)
 Create a new item at index (initialized with args)
 
bool find (const Pattern &pattern, InOut< Locator > pos=None{}) const
 Find item b.
 
bool contains (const Pattern &pattern) const
 Convenience method.
 
void replace (const Pattern &pattern, const Item &substitute)
 Replace all occurences of pattern by substitute.
 
void sort ()
 Sort the list in-situ.
 
void sortUnique ()
 Sorts the list and removes all doubles.
 
List sorted () const
 Return a sorted copy of this list
 
List sortedUnique () const
 Return a sorted copy of this list which does not contain repeated items
 
void reverse ()
 Reverse the order of items in the list
 
List reversed () const
 Return a copy of the list in which the order of items is reversed
 
void forEach (F f) const
 Call function f for each item
 
void forEach (F f)
 Call function f for each item
 
void deplete ()
 Remove all items.
 
join (S sep) const
 Merge into a single item interspersed by sep.
 
join () const
 Merge into a single item.
 
bool operator== (const Other &other) const
 Equality operator.
 
std::strong_ordering operator<=> (const Other &other) const
 Ordering operator.
 

Additional Inherited Members

- Public Types inherited from List< String >
using Item
 Item type.
 
using value_type
 Item value type.
 
using size_type
 Type of the container capacity.
 
using iterator
 Value iterator.
 
using const_iterator
 Readonly value iterator.
 
using reverse_iterator
 Reverse value iterator.
 
using const_reverse_iterator
 Readonly reverse value iterator.
 
using Tree
 

Detailed Description

CSV output formatter.

Constructor & Destructor Documentation

◆ CsvFormat()

CsvFormat ( const Stream & stream = Stream{})

Create a new CSV line output formatter.

Member Function Documentation

◆ operator<<() [1/2]

CsvFormat & operator<< ( const String & s)

Add a string item.

◆ operator<<() [2/2]

template<class T >
CsvFormat & operator<< ( const T & x)

Add an item of a non-string string.

◆ operator String()

operator String ( ) const

Gather the CSV formatted output line.

◆ join()

String join ( ) const

Gather the CSV formatted output line.