Sequence Chart Studio  svn HEAD revision
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Public Member Functions | Private Attributes | List of all members
BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator > Class Template Reference

#include <string_list_printer.h>

Collaboration diagram for BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >:
Collaboration graph

Classes

struct  Item
 structure for storing items to be printed; sorted primarily by the key, secondarily by the item itself More...
 

Public Member Functions

 BasicStringListPrinter (ItemType head=ItemType(), ItemType item_separator=ItemType(), ItemType tail=ItemType())
 if some of the arguments are passed, they are used as head, item_separator and tail, respectively More...
 
ItemType get_head () const
 returns a string which will be printed before all the items, but only if there really are some items More...
 
ItemType get_item_separator () const
 returns a string which will be printed between every two items More...
 
ItemType get_tail () const
 returns a string which will be printed after all the items, but only if there really were some items More...
 
BasicStringListPrinterset_head (ItemType new_head)
 sets a string which will be printed before all the items, but only if there really are some items provides a fluent interface More...
 
BasicStringListPrinterset_item_separator (ItemType new_item_separator)
 sets a string which will be printed between every two items provides a fluent interface More...
 
BasicStringListPrinterset_tail (ItemType new_tail)
 sets a string which will be printed after all the items, but only if there really were some items provides a fluent interface More...
 
int size () const
 returns the number of items in the printer (not counting a possible uncommitted item) More...
 
bool empty () const
 checks whether the printer is empty, i.e. there have not been any items added yet More...
 
void clear ()
 removes all committed items from the printer (any uncommitted item is untouched, though) More...
 
BasicStringListPrinteradd_item (ItemType item, KeyType key=KeyType())
 adds a single item to the string list, under a given key (or "" key if not specified) provides a fluent interface More...
 
void commit_item (KeyType key=KeyType())
 adds all the contents that have been pushed to the printer via operator<< under a given key and clears the push stream More...
 
template<typename T >
BasicStringListPrinteroperator<< (T item_part)
 pushes an item part to the current item stream (which may be committed later using commit_item()) provides a fluent interface More...
 
std::basic_stringstream
< CharType > & 
get_current_stream ()
 returns the current item stream for pushing item parts (which may be committed later using commit_item()) More...
 
template<class Stream >
Stream & print (Stream &out)
 prints the set contents including the specified head and tail (if there are some items) to a stream More...
 
 BasicStringListPrinter (ItemType head=ItemType(), ItemType item_separator=ItemType(), ItemType tail=ItemType())
 if some of the arguments are passed, they are used as head, item_separator and tail, respectively More...
 
ItemType get_head () const
 returns a string which will be printed before all the items, but only if there really are some items More...
 
ItemType get_item_separator () const
 returns a string which will be printed between every two items More...
 
ItemType get_tail () const
 returns a string which will be printed after all the items, but only if there really were some items More...
 
BasicStringListPrinterset_head (ItemType new_head)
 sets a string which will be printed before all the items, but only if there really are some items provides a fluent interface More...
 
BasicStringListPrinterset_item_separator (ItemType new_item_separator)
 sets a string which will be printed between every two items provides a fluent interface More...
 
BasicStringListPrinterset_tail (ItemType new_tail)
 sets a string which will be printed after all the items, but only if there really were some items provides a fluent interface More...
 
int size () const
 returns the number of items in the printer (not counting a possible uncommitted item) More...
 
bool empty () const
 checks whether the printer is empty, i.e. there have not been any items added yet More...
 
void clear ()
 removes all committed items from the printer (any uncommitted item is untouched, though) More...
 
BasicStringListPrinteradd_item (ItemType item, KeyType key=KeyType())
 adds a single item to the string list, under a given key (or "" key if not specified) provides a fluent interface More...
 
void commit_item (KeyType key=KeyType())
 adds all the contents that have been pushed to the printer via operator<< under a given key and clears the push stream More...
 
template<typename T >
BasicStringListPrinteroperator<< (T item_part)
 pushes an item part to the current item stream (which may be committed later using commit_item()) provides a fluent interface More...
 
std::basic_stringstream
< CharType > & 
get_current_stream ()
 returns the current item stream for pushing item parts (which may be committed later using commit_item()) More...
 
template<class Stream >
Stream & print (Stream &out)
 prints the set contents including the specified head and tail (if there are some items) to a stream More...
 

Private Attributes

ItemType m_head
 
ItemType m_item_separator
 
ItemType m_tail
 
std::vector< Itemm_items
 list of items to be printed More...
 
std::basic_stringstream< CharType > m_current_item_stream
 current item string stream - may be used for consecutively filling a single item, commited by commit_item() More...
 

Detailed Description

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
class BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >

Definition at line 132 of file string_list_printer.h.

Constructor & Destructor Documentation

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::BasicStringListPrinter ( ItemType  head = ItemType(),
ItemType  item_separator = ItemType(),
ItemType  tail = ItemType() 
)
inline

if some of the arguments are passed, they are used as head, item_separator and tail, respectively

Definition at line 163 of file string_list_printer.h.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::BasicStringListPrinter ( ItemType  head = ItemType(),
ItemType  item_separator = ItemType(),
ItemType  tail = ItemType() 
)
inline

if some of the arguments are passed, they are used as head, item_separator and tail, respectively

Definition at line 163 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_current_item_stream.

Member Function Documentation

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
BasicStringListPrinter& BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::add_item ( ItemType  item,
KeyType  key = KeyType() 
)
inline

adds a single item to the string list, under a given key (or "" key if not specified) provides a fluent interface

Definition at line 242 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_items.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
BasicStringListPrinter& BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::add_item ( ItemType  item,
KeyType  key = KeyType() 
)
inline

adds a single item to the string list, under a given key (or "" key if not specified) provides a fluent interface

Definition at line 244 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_items.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
void BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::clear ( void  )
inline

removes all committed items from the printer (any uncommitted item is untouched, though)

Definition at line 233 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_items.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
void BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::clear ( void  )
inline

removes all committed items from the printer (any uncommitted item is untouched, though)

Definition at line 235 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_items.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
void BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::commit_item ( KeyType  key = KeyType())
inline
template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
void BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::commit_item ( KeyType  key = KeyType())
inline

adds all the contents that have been pushed to the printer via operator<< under a given key and clears the push stream

Definition at line 251 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_current_item_stream, and BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_items.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
bool BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::empty ( ) const
inline

checks whether the printer is empty, i.e. there have not been any items added yet

Definition at line 225 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_items.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
bool BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::empty ( ) const
inline

checks whether the printer is empty, i.e. there have not been any items added yet

Definition at line 227 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_items.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
std::basic_stringstream<CharType>& BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::get_current_stream ( )
inline
template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
std::basic_stringstream<CharType>& BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::get_current_stream ( )
inline

returns the current item stream for pushing item parts (which may be committed later using commit_item())

Definition at line 269 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_current_item_stream.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
ItemType BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::get_head ( ) const
inline

returns a string which will be printed before all the items, but only if there really are some items

Definition at line 168 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_head.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
ItemType BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::get_head ( ) const
inline

returns a string which will be printed before all the items, but only if there really are some items

Definition at line 170 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_head.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
ItemType BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::get_item_separator ( ) const
inline

returns a string which will be printed between every two items

Definition at line 173 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_item_separator.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
ItemType BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::get_item_separator ( ) const
inline

returns a string which will be printed between every two items

Definition at line 175 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_item_separator.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
ItemType BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::get_tail ( ) const
inline

returns a string which will be printed after all the items, but only if there really were some items

Definition at line 179 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_tail.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
ItemType BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::get_tail ( ) const
inline

returns a string which will be printed after all the items, but only if there really were some items

Definition at line 181 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_tail.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
template<typename T >
BasicStringListPrinter& BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::operator<< ( item_part)
inline

pushes an item part to the current item stream (which may be committed later using commit_item()) provides a fluent interface

Definition at line 260 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::get_current_stream().

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
template<typename T >
BasicStringListPrinter& BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::operator<< ( item_part)
inline

pushes an item part to the current item stream (which may be committed later using commit_item()) provides a fluent interface

Definition at line 262 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::get_current_stream().

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
template<class Stream >
Stream& BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::print ( Stream &  out)
inline
template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
template<class Stream >
Stream& BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::print ( Stream &  out)
inline
template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
BasicStringListPrinter& BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::set_head ( ItemType  new_head)
inline

sets a string which will be printed before all the items, but only if there really are some items provides a fluent interface

Definition at line 188 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_head.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
BasicStringListPrinter& BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::set_head ( ItemType  new_head)
inline

sets a string which will be printed before all the items, but only if there really are some items provides a fluent interface

Definition at line 190 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_head.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
BasicStringListPrinter& BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::set_item_separator ( ItemType  new_item_separator)
inline

sets a string which will be printed between every two items provides a fluent interface

Definition at line 198 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_item_separator.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
BasicStringListPrinter& BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::set_item_separator ( ItemType  new_item_separator)
inline

sets a string which will be printed between every two items provides a fluent interface

Definition at line 200 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_item_separator.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
BasicStringListPrinter& BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::set_tail ( ItemType  new_tail)
inline

sets a string which will be printed after all the items, but only if there really were some items provides a fluent interface

Definition at line 208 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_tail.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
BasicStringListPrinter& BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::set_tail ( ItemType  new_tail)
inline

sets a string which will be printed after all the items, but only if there really were some items provides a fluent interface

Definition at line 210 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_tail.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
int BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::size ( ) const
inline

returns the number of items in the printer (not counting a possible uncommitted item)

Definition at line 217 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_items.

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
int BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::size ( ) const
inline

returns the number of items in the printer (not counting a possible uncommitted item)

Definition at line 219 of file string_list_printer.h.

References BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_items.

Member Data Documentation

template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
std::basic_stringstream< CharType > BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_current_item_stream
private
template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
ItemType BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_head
private
template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
ItemType BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_item_separator
private
template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
std::vector< Item > BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_items
private
template<typename KeyType = std::string, typename CharType = char, class KeyComparator = std::less<KeyType>, class ItemComparator = std::less<std::basic_string<CharType> >>
ItemType BasicStringListPrinter< KeyType, CharType, KeyComparator, ItemComparator >::m_tail
private

The documentation for this class was generated from the following file:

SourceForge.net Logo
Generated on Fri Jan 15 2016 16:26:57 for Sequence Chart Studio by  doxygen