src/Format.h

changeset 651
747e84062279
parent 650
db7146a87ae4
child 654
a74f2ff353b8
equal deleted inserted replaced
650:db7146a87ae4 651:747e84062279
17 */ 17 */
18 18
19 #pragma once 19 #pragma once
20 #include <QString> 20 #include <QString>
21 #include "Types.h" 21 #include "Types.h"
22
23 //! \file Format.h
24 //! Contains string formatting-related functions and classes.
22 25
23 //! 26 //!
24 //! Converts a given value into a string that can be retrieved with text(). 27 //! Converts a given value into a string that can be retrieved with text().
25 //! Used as the argument type to the formatting functions, hence its name. 28 //! Used as the argument type to the formatting functions, hence its name.
26 //! 29 //!
78 str = str.arg (StringFormatArg (arg1).text()); 81 str = str.arg (StringFormatArg (arg1).text());
79 formatHelper (str, rest...); 82 formatHelper (str, rest...);
80 } 83 }
81 84
82 //! 85 //!
83 //! Overload of \c formatHelper with no template args 86 //! Overload of \c formatHelper() with no template args
84 //! 87 //!
85 static void formatHelper (QString& str) __attribute__ ((unused)); 88 static void formatHelper (QString& str) __attribute__ ((unused));
86 static void formatHelper (QString& str) 89 static void formatHelper (QString& str)
87 { 90 {
88 (void) str; 91 (void) str;
89 } 92 }
90 93
91 //! 94 //!
92 //! Format the message with the given args 95 //! @brief Format the message with the given args.
96 //!
97 //! The formatting ultimately uses QString's arg() method to actually format
98 //! the args so the format string should be prepared accordingly, with %1
99 //! referring to the first arg, %2 to the second, etc.
100 //!
93 //! \param fmtstr The string to format 101 //! \param fmtstr The string to format
94 //! \param args The args to format with 102 //! \param args The args to format with
95 //! \return The formatted string 103 //! \return The formatted string
96 //! 104 //!
97 template<typename... Args> 105 template<typename... Args>

mercurial