示例#1
0
 virtual void run () {
     while (!isDone()) {
         std::ostringstream oss;
         oss.width(8);
         oss << getLogCount() << "\b\b\b\b\b\b\b\b";
         std::cout << oss.str() << std::flush;
         sleep(1);
     }
 }
示例#2
0
Handle<Value> LogJs::log(const Arguments& args, Log::WarningLevel level) {
  HandleScope scope;
  Context::Scope context_scope(Context::GetCurrent());

  if (level >= Log::getInstance().getLevel())
  {
    Local<StackTrace> stack = StackTrace::CurrentStackTrace(1);
    Local<StackFrame> frame = stack->GetFrame(0);
    int lineNumber = -1;
    QString script("<unknown>");
    QString functionName("<unknown>");

    if (stack->GetFrameCount() >= 1)
    {
      lineNumber = frame->GetLineNumber();
      script = toString(frame->GetScriptName());
      functionName = toString(frame->GetFunctionName());
    }

    std::stringstream rMessage;
    for (int i = 0; i < args.Length(); i++)
    {
      if (i != 0)
      {
        rMessage << " ";
      }
      rMessage << args[i];
    }

    QString message = QString::fromUtf8(rMessage.str().data());

    int logLimit = ConfigOptions().getOgrLogLimit();
    int messageCount = getLogCount(message);

    if (messageCount == logLimit)
    {
      message = QString("Received %1 of the same message. Silencing: ").arg(messageCount) + message;
    }

    if (messageCount <= logLimit)
    {
      Log::getInstance().log(level, message, script, functionName, lineNumber);
    }
  }

  return scope.Close(Undefined());
}
示例#3
0
/**
 * Get the number of backtracks (unlucky guesses) required
 * when solving this puzzle.
 */
int BoardGenerator::getBacktrackCount(){
    return getLogCount(solveHistory, LogItem::ROLLBACK);
}
示例#4
0
/**
 * Get the number of box/line reductions that were performed
 * in solving this puzzle.
 */
int BoardGenerator::getBoxLineReductionCount(){
    return getLogCount(solveInstructions, LogItem::ROW_BOX)+
            getLogCount(solveInstructions, LogItem::COLUMN_BOX);
}
示例#5
0
/**
 * Get the number lucky guesses in solving this puzzle.
 */
int BoardGenerator::getGuessCount(){
    return getLogCount(solveInstructions, LogItem::GUESS);
}
示例#6
0
/**
 * Get the number of pointing pair/triple reductions that were performed
 * in solving this puzzle.
 */
int BoardGenerator::getPointingPairTripleCount(){
    return getLogCount(solveInstructions, LogItem::POINTING_PAIR_TRIPLE_ROW)+
            getLogCount(solveInstructions, LogItem::POINTING_PAIR_TRIPLE_COLUMN);
}
示例#7
0
/**
 * Get the number of hidden pair reductions that were performed
 * in solving this puzzle.
 */
int BoardGenerator::getHiddenPairCount(){
    return getLogCount(solveInstructions, LogItem::HIDDEN_PAIR_ROW) +
            getLogCount(solveInstructions, LogItem::HIDDEN_PAIR_COLUMN) +
            getLogCount(solveInstructions, LogItem::HIDDEN_PAIR_SECTION);
}
示例#8
0
/**
 * Get the number of naked pair reductions that were performed
 * in solving this puzzle.
 */
int BoardGenerator::getNakedPairCount(){
    return getLogCount(solveInstructions, LogItem::NAKED_PAIR_ROW) +
            getLogCount(solveInstructions, LogItem::NAKED_PAIR_COLUMN) +
            getLogCount(solveInstructions, LogItem::NAKED_PAIR_SECTION);
}
示例#9
0
/**
 * Get the number of cells for which the solution was determined
 * because that cell had the only possibility for some value in
 * the row, column, or section.
 */
int BoardGenerator::getHiddenSingleCount(){
    return getLogCount(solveInstructions, LogItem::HIDDEN_SINGLE_ROW) +
            getLogCount(solveInstructions, LogItem::HIDDEN_SINGLE_COLUMN) +
            getLogCount(solveInstructions, LogItem::HIDDEN_SINGLE_SECTION);
}
示例#10
0
/**
 * Get the number of cells for which the solution was determined
 * because there was only one possible value for that cell.
 */
int BoardGenerator::getSingleCount(){
    return getLogCount(solveInstructions, LogItem::SINGLE);
}