MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / toString

Method toString

JUCE/modules/juce_dsp/maths/juce_Matrix.cpp:278–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

276//==============================================================================
277template <typename ElementType>
278String Matrix<ElementType>::toString() const
279{
280 StringArray entries;
281 int sizeMax = 0;
282
283 auto* p = data.begin();
284
285 for (size_t i = 0; i < rows; ++i)
286 {
287 for (size_t j = 0; j < columns; ++j)
288 {
289 String entry (*p++, 4);
290 sizeMax = jmax (sizeMax, entry.length());
291
292 entries.add (entry);
293 }
294 }
295
296 sizeMax = ((sizeMax + 1) / 4 + 1) * 4;
297
298 MemoryOutputStream result;
299
300 auto n = static_cast<size_t> (entries.size());
301
302 for (size_t i = 0; i < n; ++i)
303 {
304 result << entries[(int) i].paddedRight (' ', sizeMax);
305
306 if (i % columns == (columns - 1))
307 result << newLine;
308 }
309
310 return result.toString();
311}
312
313template class Matrix<float>;
314template class Matrix<double>;

Callers

nothing calls this directly

Calls 6

jmaxFunction · 0.85
paddedRightMethod · 0.80
beginMethod · 0.45
lengthMethod · 0.45
addMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected