2#ifndef STORMM_ORDERED_LIST_H
3#define STORMM_ORDERED_LIST_H
8#include "FileManagement/file_enumerators.h"
9#include "Parsing/textfile.h"
10#include "reporting_enumerators.h"
11#include "summary_file.h"
16using diskutil::PrintSituation;
33 OrderedList(ListEnumeration style_in,
int reserved_length = 0,
int indentation_in = 2,
34 char bullet_in =
'*', ListEnumeration nested_style_in = ListEnumeration::BULLET,
35 int nested_reserved_length = 0,
int nested_indentation_in = 4,
36 char nested_bullet_in =
'-',
int format_width_in = default_output_file_width);
38 OrderedList(ListEnumeration style_in, ListEnumeration nested_style_in);
76 std::string
getItem(
int item_index,
int width = -1,
int alt_indent = -1,
77 ListEnumeration alt_style = ListEnumeration::NONE)
const;
91 std::string
getNestedItem(
int item_index,
int nested_item_index,
int width = -1,
93 ListEnumeration alt_style = ListEnumeration::NONE)
const;
117 std::string
printList(
int width = default_output_file_width,
int alt_indent = -1,
118 int alt_nested_indent = -1,
119 ListEnumeration alt_style = ListEnumeration::NONE,
120 ListEnumeration alt_nested_style = ListEnumeration::NONE)
const;
123 int alt_nested_indent = -1,
124 ListEnumeration alt_marking = ListEnumeration::NONE,
125 ListEnumeration alt_nested_marking = ListEnumeration::NONE)
const;
127 void printList(std::ofstream *foutp, OutputSyntax style,
int width = default_output_file_width,
128 int alt_indent = -1,
int alt_nested_indent = -1,
129 ListEnumeration alt_marking = ListEnumeration::NONE,
130 ListEnumeration alt_nested_marking = ListEnumeration::NONE)
const;
132 void printList(
const std::string &file_name, PrintSituation expectation, OutputSyntax style,
133 int width = default_output_file_width,
int alt_indent = -1,
134 int alt_nested_indent = -1, ListEnumeration alt_marking = ListEnumeration::NONE,
135 ListEnumeration alt_nested_marking = ListEnumeration::NONE)
const;
142 void setStyle(ListEnumeration style_in);
174 void addItem(
const std::string &item_in,
int item_index = -1);
189 void addItemBefore(
const std::string &item_in,
int item_index);
190 void addItemBefore(
const std::string &item_in,
const std::string ¤t_item);
206 void addItemAfter(
const std::string &item_in,
int item_index);
207 void addItemAfter(
const std::string &item_in,
const std::string ¤t_item);
221 void addNestedItem(
const std::string &nested_item_in,
int current_item = -1);
222 void addNestedItem(
const std::string &nested_item_in,
const std::string ¤t_item);
227 ListEnumeration style;
232 ListEnumeration nested_style;
236 int nested_indentation;
245 int max_marker_length;
247 int max_nested_marker_length;
253 std::vector<std::string> items;
255 std::vector<int> nested_item_limits;
257 std::vector<int> nested_item_contents;
259 std::vector<std::string> nested_items;
260 std::vector<int> item_homes;
266 void validateItemIndex(
int item_index,
const char* caller =
nullptr)
const;
272 void validateNestedItemIndex(
int item_index,
int nested_item_index,
273 const char* caller =
nullptr)
const;
283 int locateItem(
const std::string ¤t_item)
const;
288 void calculateMarkerLengths();
Structure for translating a text file into a compact, rapidly parsable vector of characters in CPU RA...
Definition textfile.h:45
void addItemAfter(const std::string &item_in, int item_index)
Add an item after a specific member of the current list.
Definition ordered_list.cpp:269
std::string printList(int width=default_output_file_width, int alt_indent=-1, int alt_nested_indent=-1, ListEnumeration alt_style=ListEnumeration::NONE, ListEnumeration alt_nested_style=ListEnumeration::NONE) const
Print all items and nested items in the list, in order. Each overloads of this function delegates wor...
Definition ordered_list.cpp:132
int getNestedItemCount() const
Get the number of nested items.
Definition ordered_list.cpp:55
void setBullet(char bullet_in)
Set the bullet character. This produces an error if the LineEnumeration type of main list items is no...
Definition ordered_list.cpp:202
void setNestedBullet(char nested_bullet_in)
Set the nested bullet character. This produces an error if the LineEnumeration type of main list item...
Definition ordered_list.cpp:208
std::string getNestedItem(int item_index, int nested_item_index, int width=-1, int alt_indent=-1, ListEnumeration alt_style=ListEnumeration::NONE) const
Get one of the nested items associates with a main list item, formated with indentation and the neste...
Definition ordered_list.cpp:99
void addItemBefore(const std::string &item_in, int item_index)
Add an item before a specific member of the current list.
Definition ordered_list.cpp:249
OrderedList(ListEnumeration style_in, int reserved_length=0, int indentation_in=2, char bullet_in=' *', ListEnumeration nested_style_in=ListEnumeration::BULLET, int nested_reserved_length=0, int nested_indentation_in=4, char nested_bullet_in='-', int format_width_in=default_output_file_width)
The constructor takes an indication of the enumerative style (e.g. bullet points with a specific symb...
Definition ordered_list.cpp:22
OrderedList(const OrderedList &original)=default
With no const members or pointers to repair and all Standard Template Library components,...
void setFormatWidth(int format_width_in)
Set the format width for all getItem() and getNestedItem() calls. The width set here can be overridde...
Definition ordered_list.cpp:214
void setStyle(ListEnumeration style_in)
Set the main list itemization style. Recalculate the maximum marker lengths, anticipating format chan...
Definition ordered_list.cpp:190
int getItemCount() const
Get the number of items in the list.
Definition ordered_list.cpp:50
std::string getItem(int item_index, int width=-1, int alt_indent=-1, ListEnumeration alt_style=ListEnumeration::NONE) const
Get one of the items in the list, formatted with indentation and the marker symbol.
Definition ordered_list.cpp:69
void addItem(const std::string &item_in, int item_index=-1)
Add an item to the list.
Definition ordered_list.cpp:219
void setNestedStyle(ListEnumeration nested_style_in)
Set the nested itemization style. Recalculate the maximum marker lengths, anticipating format changes...
Definition ordered_list.cpp:196
void addNestedItem(const std::string &nested_item_in, int current_item=-1)
Add a nested item to one of the main list items.
Definition ordered_list.cpp:289