tools: fix nfdc::text::ItemAttributes evaluation order bug

When multiple ItemAttributes::operator() invocations appear on the same
expression, they are not always evaluated left-to-right, causing incorrect
text output.

refs #3864

Change-Id: I4c99c5bc4a76b4becf83f368c9f253c0b254fc05
diff --git a/tools/nfdc/format-helpers.hpp b/tools/nfdc/format-helpers.hpp
index 4fd2c38..9283855 100644
--- a/tools/nfdc/format-helpers.hpp
+++ b/tools/nfdc/format-helpers.hpp
@@ -140,11 +140,13 @@
 
   struct Attribute
   {
-    bool wantNewline;
-    Spaces spaces;
+    ItemAttributes& ia;
     std::string attribute;
   };
 
+  /** \note Caller must ensure ItemAttributes object is alive until after all Attribute objects are
+   *        destructed.
+   */
   Attribute
   operator()(const std::string& attribute);
 
@@ -155,6 +157,8 @@
   bool m_wantMultiLine;
   int m_maxAttributeWidth;
   int m_count;
+
+  friend std::ostream& operator<<(std::ostream& os, const ItemAttributes::Attribute& attr);
 };
 
 std::ostream&