1 // format_padded_string().
2 
3 // General includes.
4 #include "base/cl_sysdep.h"
5 
6 // Specification.
7 #include "real/format-output/cl_format.h"
8 
9 
10 // Implementation.
11 
12 #include <cstring>
13 
14 namespace cln {
15 
format_padded_string(std::ostream & stream,sintL mincol,sintL colinc,sintL minpad,char padchar,bool padleftflag,const char * str)16 void format_padded_string (std::ostream& stream, sintL mincol, sintL colinc, sintL minpad, char padchar, bool padleftflag, const char * str)
17 {
18 	var sintL need = ::strlen(str) + minpad; // so viele Zeichen mindestens
19 	var uintL auxpad = (need < mincol
20 			    ? ceiling((uintL)(mincol - need), colinc) * colinc
21 			    : 0
22 			   );
23 	if (!padleftflag)
24 		fprint(stream,str);
25 	format_padding(stream,minpad+auxpad,padchar);
26 	if (padleftflag)
27 		fprint(stream,str);
28 }
29 
30 }  // namespace cln
31