Function forEachLevel

Synopsis

#include <src/easylogging++.h>

static void forEachLevel(base::type::EnumType *startIndex, const std::function< bool(void)> &fn)

Description

Applies specified function to each level starting from startIndex.

Parameters

startIndex - initial value to start the iteration from. This is passed as pointer and is left-shifted so this can be used inside function (fn) to represent current level.

fn - function to apply with each level. This bool represent whether or not to stop iterating through levels.

Source

Lines 174-182 in src/easylogging++.cc. Line 633 in src/easylogging++.h.

void LevelHelper::forEachLevel(base::type::EnumType* startIndex, const std::function<bool(void)>& fn) {
  base::type::EnumType lIndexMax = LevelHelper::kMaxValid;
  do {
    if (fn()) {
      break;
    }
    *startIndex = static_cast<base::type::EnumType>(*startIndex << 1);
  } while (*startIndex <= lIndexMax);
}





Add Discussion

Log in to comment