MCPcopy Create free account
hub / github.com/DFHack/dfhack / pad_string

Function pad_string

plugins/uicommon.h:154–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154static inline string pad_string(string text, const int size, const bool front = true, const bool trim = false)
155{
156 if (text.length() > size_t(size))
157 {
158 if (trim && size > 10)
159 {
160 text = text.substr(0, size-3);
161 text.append("...");
162 }
163 return text;
164 }
165
166 string aligned(size - text.length(), ' ');
167 if (front)
168 {
169 aligned.append(text);
170 return aligned;
171 }
172 else
173 {
174 text.append(aligned);
175 return text;
176 }
177}
178
179static inline df::interface_key get_string_key(const std::set<df::interface_key> *input)
180{

Callers 6

fixWidthMethod · 0.85
getActivityItemMethod · 0.85
getFortAverageMethod · 0.85
getDwarfAverageMethod · 0.85
getBreakdownAverageMethod · 0.85

Calls 1

lengthMethod · 0.80

Tested by

no test coverage detected