* \brief Stores a set of parameters controlling the way matrices are printed * * List of available parameters: * - \b precision number of digits for floating point values, or one of the special constants \c StreamPrecision and \c FullPrecision. * The default is the special value \c StreamPrecision which means to use the * stream's own precision setting, a
| 40 | |
| 41 | */ |
| 42 | struct IOFormat |
| 43 | { |
| 44 | /** Default constructor, see class IOFormat for the meaning of the parameters */ |
| 45 | IOFormat(int _precision = StreamPrecision, int _flags = 0, |
| 46 | const std::string& _coeffSeparator = " ", |
| 47 | const std::string& _rowSeparator = "\n", const std::string& _rowPrefix = "", const std::string& _rowSuffix = "", |
| 48 | const std::string& _matPrefix = "", const std::string& _matSuffix = "", const char _fill = ' ', |
| 49 | const std::string& _batchPrefix = "[\n", const std::string& _batchSuffix="\n]", const std::string& _batchSeparator = "\n],[\n") |
| 50 | : matPrefix(_matPrefix), matSuffix(_matSuffix), rowPrefix(_rowPrefix), rowSuffix(_rowSuffix), rowSeparator(_rowSeparator), |
| 51 | rowSpacer(""), coeffSeparator(_coeffSeparator), fill(_fill), precision(_precision), flags(_flags), |
| 52 | batchPrefix(_batchPrefix), batchSuffix(_batchSuffix), batchSeparator(_batchSeparator) |
| 53 | { |
| 54 | // TODO check if rowPrefix, rowSuffix or rowSeparator contains a newline |
| 55 | // don't add rowSpacer if columns are not to be aligned |
| 56 | if ((flags & DontAlignCols)) |
| 57 | return; |
| 58 | int i = int(matSuffix.length()) - 1; |
| 59 | while (i >= 0 && matSuffix[i] != '\n') |
| 60 | { |
| 61 | rowSpacer += ' '; |
| 62 | i--; |
| 63 | } |
| 64 | } |
| 65 | std::string matPrefix, matSuffix; |
| 66 | std::string rowPrefix, rowSuffix, rowSeparator, rowSpacer; |
| 67 | std::string coeffSeparator; |
| 68 | char fill; |
| 69 | int precision; |
| 70 | int flags; |
| 71 | std::string batchPrefix; |
| 72 | std::string batchSuffix; |
| 73 | std::string batchSeparator; |
| 74 | }; |
| 75 | |
| 76 | namespace internal |
| 77 | { |