@@ -170,6 +170,30 @@ class format_object5 : public format_object_base {
170
170
}
171
171
};
172
172
173
+ // / format_object6 - This is a templated helper class used by the format
174
+ // / function that captures the object to be formated and the format string. When
175
+ // / actually printed, this synthesizes the string into a temporary buffer
176
+ // / provided and returns whether or not it is big enough.
177
+ template <typename T1, typename T2, typename T3, typename T4, typename T5,
178
+ typename T6>
179
+ class format_object6 : public format_object_base {
180
+ T1 Val1;
181
+ T2 Val2;
182
+ T3 Val3;
183
+ T4 Val4;
184
+ T5 Val5;
185
+ T6 Val6;
186
+ public:
187
+ format_object6 (const char *Fmt, const T1 &Val1, const T2 &Val2,
188
+ const T3 &Val3, const T4 &Val4, const T5 &Val5, const T6 &Val6)
189
+ : format_object_base(Fmt), Val1(Val1), Val2(Val2), Val3(Val3), Val4(Val4),
190
+ Val5(Val5), Val6(Val6) { }
191
+
192
+ int snprint (char *Buffer, unsigned BufferSize) const override {
193
+ return snprintf (Buffer, BufferSize, Fmt, Val1, Val2, Val3, Val4, Val5, Val6);
194
+ }
195
+ };
196
+
173
197
// / This is a helper function that is used to produce formatted output.
174
198
// /
175
199
// / This is typically used like:
@@ -231,6 +255,21 @@ inline format_object5<T1, T2, T3, T4, T5> format(const char *Fmt,const T1 &Val1,
231
255
return format_object5<T1, T2, T3, T4, T5>(Fmt, Val1, Val2, Val3, Val4, Val5);
232
256
}
233
257
258
+ // / This is a helper function that is used to produce formatted output.
259
+ // /
260
+ // / This is typically used like:
261
+ // / \code
262
+ // / OS << format("%0.4f", myfloat) << '\n';
263
+ // / \endcode
264
+ template <typename T1, typename T2, typename T3, typename T4, typename T5,
265
+ typename T6>
266
+ inline format_object6<T1, T2, T3, T4, T5, T6>
267
+ format (const char *Fmt, const T1 &Val1, const T2 &Val2, const T3 &Val3,
268
+ const T4 &Val4, const T5 &Val5, const T6 &Val6) {
269
+ return format_object6<T1, T2, T3, T4, T5, T6>(Fmt, Val1, Val2, Val3, Val4,
270
+ Val5, Val6);
271
+ }
272
+
234
273
} // end namespace llvm
235
274
236
275
#endif
0 commit comments