MCPcopy Create free account
hub / github.com/WinMerge/winmerge / ColStatusGet

Function ColStatusGet

Src/DirViewColItems.cpp:339–450  ·  view source on GitHub ↗

* @brief Format Result column data. * @param [in] pCtxt Pointer to compare context. * @param [in] p Pointer to DIFFITEM. * @return String to show in the column. */

Source from the content-addressed store, hash-verified

337 * @return String to show in the column.
338 */
339static String ColStatusGet(const CDiffContext *pCtxt, const void *p, int)
340{
341 const DIFFITEM &di = *static_cast<const DIFFITEM*>(p);
342 int nDirs = pCtxt->GetCompareDirs();
343 // Note that order of items does matter. We must check for
344 // skipped items before unique items, for example, so that
345 // skipped unique items are labeled as skipped, not unique.
346 String s;
347 bool bAddCompareFlags3WayString = false;
348 if (di.diffcode.isResultError())
349 {
350 s = _("Unable to compare files");
351 }
352 else if (di.diffcode.isResultAbort())
353 {
354 s = _("Item aborted");
355 }
356 else if (di.diffcode.isResultFiltered())
357 {
358 if (di.diffcode.isDirectory())
359 s = _("Folder skipped");
360 else
361 s = _("File skipped");
362 }
363 else if (di.renameMoveGroupId != -1)
364 {
365 s = ColStatusGetRenamedMoved(pCtxt, di);
366 }
367 else if (di.diffcode.isSideFirstOnly())
368 {
369 s = strutils::format_string1(_("Left only: %1"),
370 di.getFilepath(0, pCtxt->GetNormalizedLeft()));
371 }
372 else if (di.diffcode.isSideSecondOnly())
373 {
374 if (nDirs < 3)
375 {
376 s = strutils::format_string1(_("Right only: %1"),
377 di.getFilepath(1, pCtxt->GetNormalizedRight()));
378 }
379 else
380 {
381 s = strutils::format_string1(_("Middle only: %1"),
382 di.getFilepath(1, pCtxt->GetNormalizedMiddle()));
383 }
384 }
385 else if (di.diffcode.isSideThirdOnly())
386 {
387 s = strutils::format_string1(_("Right only: %1"),
388 di.getFilepath(2, pCtxt->GetNormalizedRight()));
389 }
390 else if (nDirs > 2 && !di.diffcode.existsFirst())
391 {
392 s = strutils::format_string1(_("Does not exist in %1"),
393 pCtxt->GetNormalizedLeft());
394 bAddCompareFlags3WayString = true;
395 }
396 else if (nDirs > 2 && !di.diffcode.existsSecond())

Callers

nothing calls this directly

Calls 15

ColStatusGetRenamedMovedFunction · 0.85
toTStringFunction · 0.85
isSideFirstOnlyMethod · 0.80
getFilepathMethod · 0.80
GetNormalizedLeftMethod · 0.80
isSideSecondOnlyMethod · 0.80
GetNormalizedRightMethod · 0.80
GetNormalizedMiddleMethod · 0.80
isSideThirdOnlyMethod · 0.80
existsFirstMethod · 0.80
existsSecondMethod · 0.80
existsThirdMethod · 0.80

Tested by

no test coverage detected