From bfe86b8fc0434cf03838bc1534f9f810594f2f08 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Sat, 23 Aug 2008 19:41:00 +0000 Subject: * add documentation of the cool (?) "print with format" feature * move the ioformat.cpp test to a documentation example * rename IoFormat => IOFormat --- doc/snippets/IOFormat.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 doc/snippets/IOFormat.cpp (limited to 'doc/snippets/IOFormat.cpp') diff --git a/doc/snippets/IOFormat.cpp b/doc/snippets/IOFormat.cpp new file mode 100644 index 000000000..9db70980c --- /dev/null +++ b/doc/snippets/IOFormat.cpp @@ -0,0 +1,14 @@ +std::string sep = "\n----------------------------------------\n"; +Matrix3f m1; +m1 << 1.111111, 2, 3.33333, 4, 5, 6, 7, 8.888888, 9; + +IOFormat CommaInitFmt(4, Raw, ", ", ", ", "", "", " << ", ";"); +IOFormat CleanFmt(4, AlignCols, ", ", "\n", "[", "]"); +IOFormat OctaveFmt(4, AlignCols, ", ", ";\n", "", "", "[", "]"); +IOFormat HeavyFmt(4, AlignCols, ", ", ";\n", "[", "]", "[", "]"); + +std::cout << m1 << sep; +std::cout << m1.format(CommaInitFmt) << sep; +std::cout << m1.format(CleanFmt) << sep; +std::cout << m1.format(OctaveFmt) << sep; +std::cout << m1.format(HeavyFmt) << sep; -- cgit v1.2.3