Put the FormatToStream function in its own compilation unit as it might

be useful for other things to.
This commit is contained in:
eelke 2018-09-17 15:42:55 +02:00
parent 22bad8fb22
commit c13bbde2e4
4 changed files with 50 additions and 28 deletions

17
pglablib/FormatToStream.h Normal file
View file

@ -0,0 +1,17 @@
#ifndef FORMATTOSTREAM_H
#define FORMATTOSTREAM_H
#include <QString>
#include <functional>
class QTextStream;
/**
* @brief FormatToStream replaces /%var%/ variables in a string with the values returned by the callback
* @param stream The stream to which to write the result of the formatting operation
* @param format The format string containing the vars.
* @param field_callback A callable which returns the values for var.
*/
void FormatToStream(QTextStream &stream, QString format, std::function<void(QTextStream &, QString)> field_callback);
#endif // FORMATTOSTREAM_H