10 #include <boost/exception/exception.hpp> 11 #include <boost/exception/info.hpp> 15 namespace duds {
namespace ui {
23 virtual std::exception,
virtual boost::exception { };
29 typedef boost::error_info<struct Info_StringLength, std::string::size_type>
36 typedef boost::error_info<struct Info_PathMaxLength, unsigned int>
43 typedef boost::error_info<struct Info_PathMaxTitleLength, unsigned int>
50 typedef boost::error_info<struct Info_PathMinTitleLength, unsigned int>
136 unsigned int maxLen = -1;
140 unsigned int maxPages = -1;
145 unsigned int maxPageLen = -1;
150 unsigned int minPageLen = 4;
160 bool wholeCurrent =
false;
164 bool abruptSplit =
false;
190 std::string::size_type titleLength(
191 const std::string &title,
208 std::string::size_type
len;
235 static int averageLength(
int numtitles,
int totalLen,
int currLen);
248 const std::string &separator,
249 unsigned int mlen = -1
250 ) : sep(separator), maxLen(mlen) { }
264 const std::string &separator,
265 const std::string &ellipsis,
266 unsigned int mlen = -1,
267 unsigned int mtitle = -1
296 void ellipsis(
const std::string &e);
311 void currentHeader(
const std::string &h);
326 void currentFooter(
const std::string &f);
340 void maxLength(
unsigned int max);
376 void maxTitleLength(
unsigned int max);
395 void minTitleLength(
unsigned int min);
444 std::string generate(
const Path &path)
const;
TrucatedTitle(const std::string &t)
const std::string * title
The title string.
void showForwardPage(bool show=true)
Changes if the page in the forward direction may be included in the output path string.
unsigned int maxTitleLength() const
Returns the maximum length allocated to a page title in the output path string.
std::string preCur
Marker string that preceds the current page title.
unsigned int maxTitles() const
Returns the maximum number of page titles that may be included in the output path string...
boost::error_info< struct Info_StringLength, std::string::size_type > StringLength
Error attribute used by PathStringGenerator to denote a string length that is important in the contex...
const std::string & ellipsis() const
Returns the string appended to the end of page titles that are shortened to fit.
void showWholeCurrentPage(bool show=true)
Changes if the length of the current page title is bound by the maximum output length (true) or by th...
unsigned int maxLength() const
Returns the maximum length of the generated path strings.
const std::string & currentHeader() const
Returns the string prepended to the current page title.
PathStringGenerator(const std::string &separator, unsigned int mlen=-1)
Makes a PathStringGenerator with the given title separator and maximum path length.
std::string ellip
Last character(s) to use when part of a title is not shown.
std::string::size_type len
The length of the title.
boost::error_info< struct Info_PathMaxTitleLength, unsigned int > PathMaxTitleLength
Error attribute used by PathStringGenerator to hold the maximum length of page titles in its output...
Produces a string showing the path through pages as tracked by a Path object.
std::string postCur
Marker string that follows the current page title.
std::string sep
Separator between page titles.
bool showForwardPage() const
True if the page in the forward direction may be included in the output path string.
void maxTitles(unsigned int max)
Changes the maximum number of page titles that may be included in the output path string...
TrucatedTitle(const std::string &t, std::string::size_type l)
const std::string & currentFooter() const
Returns the string appended to the end of the current page title.
boost::error_info< struct Info_PathMaxLength, unsigned int > PathMaxLength
Error attribute used by PathStringGenerator to hold the maximum length of its string output...
Error that signifies a PathStringGenerator object was given a parameter value that conflicts with ano...
unsigned int minTitleLength() const
Returns the minimum length for a shortened page title in the output path string.
const std::string & separator() const
Returns the string used to separate the titles.
bool showWholeCurrentPage() const
True when the length of the current page title is not bound by the maximum title length (maxTitleLeng...
boost::error_info< struct Info_PathMinTitleLength, unsigned int > PathMinTitleLength
Error attribute used by PathStringGenerator to hold the minimum length of page titles in its output...
An internal data structure used to track the titles to include in the path string and the length of e...
void separator(const std::string &s)
Changes the string used to separate the titles.
Stores a list of pages the user has visited in the order of the visits.