String formatting class.  
 More...
#include <string_format.h>
|  | 
|  | StringFormat (const std::string &format_string) | 
|  | Constructs a formatted string object. 
 | 
|  | 
|  | ~StringFormat () | 
|  | 
| const std::string & | get_result () const | 
|  | Retrieves the formatted string with all argument replacements. 
 | 
|  | 
| void | set_arg (int index, const std::string &text) | 
|  | Sets an argument (string version) 
 | 
|  | 
| void | set_arg (int index, double value) | 
|  | Sets an argument (double version) 
 | 
|  | 
| void | set_arg (int index, float value) | 
|  | Sets an argument (float version) 
 | 
|  | 
| void | set_arg (int index, int value, int min_length=0) | 
|  | Sets an argument (int version) 
 | 
|  | 
| void | set_arg (int index, long long value, int min_length=0) | 
|  | Sets an argument (long long version) 
 | 
|  | 
| void | set_arg (int index, long unsigned int value, int min_length=0) | 
|  | Sets an argument (long unsigned int version) 
 | 
|  | 
| void | set_arg (int index, unsigned int value, int min_length=0) | 
|  | Sets an argument (unsigned int version) 
 | 
|  | 
| void | set_arg (int index, unsigned long long value, int min_length=0) | 
|  | Sets an argument (unsigned long long version) 
 | 
|  | 
String formatting class. 
Combines a format string with arbitrary arguments to create a resulting string that contains the inserted arguments.
A format string consists of normal text and placeholders that are replaced by the given arguments. A placeholder is identified by a percentage symbol '%' followed by an integer that represents the argument index.
Example:
format.set_arg(0, 10);
format.set_arg(1, "test");
std::string result = format.get_result();
 The global function clan::string_format is a shortcut to create formatted strings. Note that the indexing starts at 1 when using this function. Therefore the first argument is automatically referenced by the placeholder %1.
Example:
std::string string_format(const std::string &format)
See clan::StringFormat for details.
Definition string_format.h:157
  ◆ StringFormat()
      
        
          | clan::StringFormat::StringFormat | ( | const std::string & | format_string | ) |  | 
      
 
Constructs a formatted string object. 
- Parameters
- 
  
    | format_string | = Format string (see detailed description) |  
 
 
 
◆ ~StringFormat()
      
        
          | clan::StringFormat::~StringFormat | ( |  | ) |  | 
      
 
 
◆ get_result()
      
        
          | const std::string & clan::StringFormat::get_result | ( |  | ) | const | 
      
 
Retrieves the formatted string with all argument replacements. 
 
 
◆ set_arg() [1/8]
      
        
          | void clan::StringFormat::set_arg | ( | int | index, | 
        
          |  |  | const std::string & | text ) | 
      
 
Sets an argument (string version) 
- Parameters
- 
  
    | index | = Argument index |  | text | = Argument value as a string |  
 
 
 
◆ set_arg() [2/8]
      
        
          | void clan::StringFormat::set_arg | ( | int | index, | 
        
          |  |  | double | value ) | 
      
 
Sets an argument (double version) 
- Parameters
- 
  
    | index | = Argument index |  | value | = Argument value as a floating point value with double precision |  
 
 
 
◆ set_arg() [3/8]
      
        
          | void clan::StringFormat::set_arg | ( | int | index, | 
        
          |  |  | float | value ) | 
      
 
Sets an argument (float version) 
- Parameters
- 
  
    | index | = Argument index |  | value | = Argument value as a floating point value |  
 
 
 
◆ set_arg() [4/8]
      
        
          | void clan::StringFormat::set_arg | ( | int | index, | 
        
          |  |  | int | value, | 
        
          |  |  | int | min_length = 0 ) | 
      
 
Sets an argument (int version) 
- Parameters
- 
  
    | index | = Argument index |  | value | = Argument value as an integer |  | min_length | = Minimum amount of digits to display |  
 
 
 
◆ set_arg() [5/8]
      
        
          | void clan::StringFormat::set_arg | ( | int | index, | 
        
          |  |  | long long | value, | 
        
          |  |  | int | min_length = 0 ) | 
      
 
Sets an argument (long long version) 
- Parameters
- 
  
    | index | = Argument index |  | value | = Argument value as a long long |  | min_length | = Minimum amount of digits to display |  
 
 
 
◆ set_arg() [6/8]
      
        
          | void clan::StringFormat::set_arg | ( | int | index, | 
        
          |  |  | long unsigned int | value, | 
        
          |  |  | int | min_length = 0 ) | 
      
 
Sets an argument (long unsigned int version) 
- Parameters
- 
  
    | index | = Argument index |  | value | = Argument value as a long unsigned integer |  | min_length | = Minimum amount of digits to display |  
 
 
 
◆ set_arg() [7/8]
      
        
          | void clan::StringFormat::set_arg | ( | int | index, | 
        
          |  |  | unsigned int | value, | 
        
          |  |  | int | min_length = 0 ) | 
      
 
Sets an argument (unsigned int version) 
- Parameters
- 
  
    | index | = Argument index |  | value | = Argument value as an unsigned integer |  | min_length | = Minimum amount of digits to display |  
 
 
 
◆ set_arg() [8/8]
      
        
          | void clan::StringFormat::set_arg | ( | int | index, | 
        
          |  |  | unsigned long long | value, | 
        
          |  |  | int | min_length = 0 ) | 
      
 
Sets an argument (unsigned long long version) 
- Parameters
- 
  
    | index | = Argument index |  | value | = Argument value as an unsigned long long |  | min_length | = Minimum amount of digits to display |  
 
 
 
The documentation for this class was generated from the following file: