Example #1
0
bool wxExTextFile::RunTool()
{
  if (!wxTextFile::Open(m_FileName.GetFullPath()))
  {
    return false;
  }

  m_Stats.m_Elements.Set(_("Files"), 1);

  if (m_Tool.IsCount())
  {
    m_Stats.m_Elements.Inc(_("Total Size"), m_FileName.GetStat().st_size);
    m_Stats.m_Elements.Inc(_("Lines"), GetLineCount());
  }

  if (GetLineCount() > 0)
  {
    if (!Parse())
    {
      Close();

      return false;
    }
  }

  if (m_Tool.IsStatisticsType())
  {
    if (m_Tool.GetId() == ID_TOOL_REPORT_KEYWORD)
    {
      if (!m_FileName.GetLexer().GetKeywordsString().empty())
      {
        IncActionsCompleted();
      }
    }

    ReportStatistics();
  }

  if (m_Modified && !m_FileName.GetStat().IsReadOnly())
  {
    if (!Write())
    {
      Close();

      return false;
    }
  }

  Close();

  return true;
}
cost AnyAngleAlgorithm::FindPath(xyLoc from, xyLoc to)
{
#ifdef ANY_ANGLE_STATISTICS
    StartStatistics(from, to);
#endif

    cost c;
    if (!UsingXYLocCont()) {
        xyloc_path_.clear();
        c = FindCornerLocPath(from, to, xyloc_path_);
#ifdef ANY_ANGLE_STATISTICS
        ReportStatistics(xyloc_path_, statistics_);
#endif

        if (ShouldSmoothPaths()) {
            c = SmoothPath(xyloc_path_, smoothed_xyloc_path_);
#ifdef ANY_ANGLE_STATISTICS
            ReportStatistics(smoothed_xyloc_path_, statistics_with_smoothing_);
#endif
        }
    }
    else {
        xyloc_cont_path_.clear();
        c = FindXYLocContPath(from, to, xyloc_cont_path_);
#ifdef ANY_ANGLE_STATISTICS
        ReportStatistics(xyloc_cont_path_, statistics_);
#endif
        if (ShouldSmoothPaths()) {
            c = SmoothPath(xyloc_cont_path_, smoothed_xyloc_cont_path_);
#ifdef ANY_ANGLE_STATISTICS
            ReportStatistics(smoothed_xyloc_cont_path_, statistics_with_smoothing_);
#endif
        }
    }

    return c;
}