当前位置: 首页>>代码示例>>C++>>正文


C++ ProjectsArray::GetCount方法代码示例

本文整理汇总了C++中ProjectsArray::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectsArray::GetCount方法的具体用法?C++ ProjectsArray::GetCount怎么用?C++ ProjectsArray::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProjectsArray的用法示例。


在下文中一共展示了ProjectsArray::GetCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Execute

/** Count the lines on all project's files and display the results.
 *  @param languages Languages definitions
 *  @param nb_languages Number of languages defined in the 'languages' array
 */
int CodeStatExecDlg::Execute(LanguageDef languages[NB_FILETYPES_MAX], int numLanguages)
{
    m_choice->Clear();
    m_choice->Append(_T("Entire workspace"));

    ProjectsArray* projects = Manager::Get()->GetProjectManager()->GetProjects();
    for (size_t i = 0, length = projects->GetCount(); i < length; ++i)
    {
        m_choice->Append(projects->Item(i)->GetTitle());
    }
    m_cache.clear();
    m_cache.resize(projects->GetCount() + 1);

    m_languages = languages;
    m_numLanguages = numLanguages;

    // Check if all files have been saved
    bool all_saved = true;
    for (size_t i = 0, nb_projects = projects->GetCount(); i < nb_projects; ++i)
    {
        cbProject* project = projects->Item(i);
        for (int j = 0, nb_files = project->GetFilesCount(); j < nb_files; ++j)
        {
            ProjectFile* pf = project->GetFile(j);
            if (pf->GetFileState() == fvsModified)
            {
                all_saved = false;
                break;
            }
        }
    }

    // If not, ask user if we can save them
    if (!all_saved)
    {
        if (cbMessageBox(_T("Some files are not saved.\nDo you want to save them before running the plugin?"),
                         _("Warning"),
                         wxICON_EXCLAMATION | wxYES_NO,
                         Manager::Get()->GetAppWindow()) == wxID_YES)
        {
            for (size_t i = 0, nb_projects = projects->GetCount(); i < nb_projects; ++i)
                (*projects)[i]->SaveAllFiles();
        }
    }

    cbProject* project = Manager::Get()->GetProjectManager()->GetActiveProject();
    int index = m_choice->FindString(project->GetTitle(), true);
    m_choice->SetSelection(index);
    DoParseProject(index);

    ShowResults(index);

    ShowModal();

    return 0;
}
开发者ID:simple-codeblocks,项目名称:Codeblocks,代码行数:60,代码来源:codestatexec.cpp

示例2: FillList

void ProjectDepsDlg::FillList()
{
    wxChoice* cmb = XRCCTRL(*this, "cmbProject", wxChoice);
    wxCheckListBox* lst = XRCCTRL(*this, "lstDeps", wxCheckListBox);

    int idx = cmb->GetSelection();
    if (m_LastSel != idx && m_LastSel != -1)
    {
        // save old list
        SaveList();
    }
    m_LastSel = idx;
    if (idx == -1)
        return;

    cbProject* thisprj = static_cast<cbProject*>(cmb->GetClientData(idx));
    if (!thisprj)
        return;
    const ProjectsArray* arr = Manager::Get()->GetProjectManager()->GetDependenciesForProject(thisprj);

    lst->Clear();
    ProjectsArray* mainarr = Manager::Get()->GetProjectManager()->GetProjects();
    for (size_t i = 0; i < mainarr->GetCount(); ++i)
    {
        cbProject* prj = mainarr->Item(i);
        if (prj == thisprj)
            continue;
        lst->Append(prj->GetTitle());

        // check dependency
        lst->Check(lst->GetCount() - 1, arr && arr->Index(prj) != wxNOT_FOUND);
    }
}
开发者ID:WinterMute,项目名称:codeblocks_sf,代码行数:33,代码来源:projectdepsdlg.cpp

示例3: OperateWorkspace

bool ProjectOptionsManipulator::OperateWorkspace(wxArrayString& result)
{
  ProjectsArray* pa = Manager::Get()->GetProjectManager()->GetProjects();
  bool success = true;
  if (pa)
  {
    for (size_t i=0; i<pa->GetCount(); ++i)
      success &= OperateProject( pa->Item(i), result );
  }

  return success;
}
开发者ID:DowerChest,项目名称:codeblocks,代码行数:12,代码来源:ProjectOptionsManipulator.cpp

示例4: GetProject

cbProject* wxcHelper::GetProject(const wxString& name)
{
    cbProject *selectedProject ( NULL );
    ProjectsArray* projects = Manager::Get()->GetProjectManager()->GetProjects();
    for ( size_t i=0; i<projects->GetCount(); ++i ) {
        if ( projects->Item(i)->GetTitle() == name ) {
            selectedProject = projects->Item(i);
            break;
        }
    }
    return selectedProject;
}
开发者ID:erdincay,项目名称:wxCrafterCB,代码行数:12,代码来源:wxcHelper.cpp

示例5: OnScanSelect

void ProjectOptionsManipulatorDlg::OnScanSelect(wxCommandEvent& event)
{
  m_ChoScanProjects->Clear();
  if ( event.GetInt()==1 ) // project
  {
    ProjectsArray* pa = Manager::Get()->GetProjectManager()->GetProjects();
    if (pa)
    {
      for (size_t i=0; i<pa->GetCount(); ++i)
      {
        cbProject* prj = pa->Item(i);
        if (prj)
          m_ChoScanProjects->Append( prj->GetTitle() );
      }

      if ( pa->GetCount() )
        m_ChoScanProjects->SetSelection(0);
    }
    m_ChoScanProjects->Enable();
  }
  else
    m_ChoScanProjects->Disable();
}
开发者ID:stahta01,项目名称:codeblocks_backup,代码行数:23,代码来源:ProjectOptionsManipulatorDlg.cpp

示例6: DoParseWorkspace

void CodeStatExecDlg::DoParseWorkspace()
{
    ProjectCodeStats& statWS = m_cache[0];
    if (statWS.isParsed)
        return;

    m_progress = new wxProgressDialog(_("Code Statistics plugin"),_("Parsing workspace files. Please wait..."));

    m_currentFile = 0;
    m_numFiles = 0;

    ProjectsArray* projects = Manager::Get()->GetProjectManager()->GetProjects();
    for (size_t i = 0, count = projects->GetCount(); i < count; ++i)
        m_numFiles += projects->Item(i)->GetFilesCount();

    ParsedFileNamesSet parsedFileNames;

    for (size_t i = 1, count = projects->GetCount(); i < count + 1; ++i)
    {
        ProjectCodeStats statProject = ParseProject(i, &parsedFileNames);

        statWS.numFiles           += statProject.numFiles;
        statWS.numFilesNotFound   += statProject.numFilesNotFound;
        statWS.numSkippedFiles    += statProject.numSkippedFiles;
        statWS.codeLines          += statProject.codeLines;
        statWS.emptyLines         += statProject.emptyLines;
        statWS.commentLines       += statProject.commentLines;
        statWS.codeAndCommentLines += statProject.codeAndCommentLines;
        statWS.totalLines         += statProject.totalLines ;
    }

    statWS.isParsed = true;

    m_progress->Update(100);
    delete m_progress;
    m_progress = nullptr;
}
开发者ID:simple-codeblocks,项目名称:Codeblocks,代码行数:37,代码来源:codestatexec.cpp

示例7: SaveList

bool ProjectDepsDlg::SaveList()
{
    wxChoice* cmb = XRCCTRL(*this, "cmbProject", wxChoice);
    wxCheckListBox* lst = XRCCTRL(*this, "lstDeps", wxCheckListBox);

    if (m_LastSel == -1)
        return true;

    cbProject* thisprj = static_cast<cbProject*>(cmb->GetClientData(m_LastSel));
    if (!thisprj)
        return true;

    // first clear all deps for this project
    Manager::Get()->GetProjectManager()->ClearProjectDependencies(thisprj);

    // now set the the new deps
    for (size_t i = 0; i < lst->GetCount(); ++i)
    {
        if (!lst->IsChecked(i))
            continue;

        cbProject* prj = nullptr;

        ProjectsArray* mainarr = Manager::Get()->GetProjectManager()->GetProjects();
        for (size_t x = 0; x < mainarr->GetCount(); ++x)
        {
            if (mainarr->Item(x)->GetTitle() == lst->GetString(i))
            {
                prj = mainarr->Item(x);
                break;
            }
        }
        if (!prj)
            continue;

        if (!Manager::Get()->GetProjectManager()->AddProjectDependency(thisprj, prj))
        {
            cbMessageBox(wxString::Format(_("Cannot add project '%s' as a dependency to '%s' because this "
                                            "would cause a circular dependency error..."),
                                            thisprj->GetTitle().c_str(), prj->GetTitle().c_str()),
                        _("Error"), wxICON_ERROR, this);
            return false;
        }
    }
    return true;
}
开发者ID:WinterMute,项目名称:codeblocks_sf,代码行数:46,代码来源:projectdepsdlg.cpp

示例8: GetAllFiles

void wxcHelper::GetAllFiles(FilesList& files, const wxString& filterExt)
{
    wxString filterExtLowerCase = filterExt;
    filterExtLowerCase.MakeLower();

    ProjectsArray* projects = Manager::Get()->GetProjectManager()->GetProjects();
    for ( size_t i=0; i<projects->GetCount(); ++i ) {
        cbProject* pProj = projects->Item(i);
        const FilesList& fileList = pProj->GetFilesList();
        FilesList::const_iterator iter = fileList.begin();
        for( ; iter != fileList.end(); ++iter ) {
            if( filterExtLowerCase.IsEmpty() || filterExtLowerCase == (*iter)->file.GetExt().MakeLower() ) {
                files.insert( (*iter) );
            }
        }
    }
}
开发者ID:erdincay,项目名称:wxCrafterCB,代码行数:17,代码来源:wxcHelper.cpp

示例9: Save

bool WorkspaceLoader::Save(const wxString& title, const wxString& filename)
{
    const char* ROOT_TAG = "CodeBlocks_workspace_file";

    TiXmlDocument doc;
    doc.SetCondenseWhiteSpace(false);
    doc.InsertEndChild(TiXmlDeclaration("1.0", "UTF-8", "yes"));
    TiXmlElement* rootnode = static_cast<TiXmlElement*>(doc.InsertEndChild(TiXmlElement(ROOT_TAG)));
    if (!rootnode)
        return false;

    TiXmlElement* wksp = static_cast<TiXmlElement*>(rootnode->InsertEndChild(TiXmlElement("Workspace")));
    wksp->SetAttribute("title", cbU2C(title));

    ProjectsArray* arr = Manager::Get()->GetProjectManager()->GetProjects();
    for (unsigned int i = 0; i < arr->GetCount(); ++i)
    {
        cbProject* prj = arr->Item(i);

        wxFileName wfname(filename);
        wxFileName fname(prj->GetFilename());
        fname.MakeRelativeTo(wfname.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR));

        TiXmlElement* node = static_cast<TiXmlElement*>(wksp->InsertEndChild(TiXmlElement("Project")));
        node->SetAttribute("filename", cbU2C( ExportFilename(fname) ) );
        if (prj == Manager::Get()->GetProjectManager()->GetActiveProject())
            node->SetAttribute("active", 1);

        const ProjectsArray* deps = Manager::Get()->GetProjectManager()->GetDependenciesForProject(prj);
        if (deps && deps->GetCount())
        {
            for (size_t i = 0; i < deps->GetCount(); ++i)
            {
                prj = deps->Item(i);
                fname.Assign(prj->GetFilename());
                fname.MakeRelativeTo(wfname.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR));
                TiXmlElement* dnode = static_cast<TiXmlElement*>(node->InsertEndChild(TiXmlElement("Depends")));
                dnode->SetAttribute("filename", cbU2C( ExportFilename(fname) ) );
            }
        }
    }
    return cbSaveTinyXMLDocument(&doc, filename);
}
开发者ID:stahta01,项目名称:codeblocks_r7456,代码行数:43,代码来源:workspaceloader.cpp

示例10: RemoveProjectFromAllDependencies

void ProjectManager::RemoveProjectFromAllDependencies(cbProject* base)
{
    if (!base)
        return;
    DepsMap::iterator it = m_ProjectDeps.begin();
    while (it != m_ProjectDeps.end())
    {
        if (it->first == base)
        {
            ++it;
            continue;
        }

        ProjectsArray* arr = it->second;
        // only check projects that do have a dependencies array
        if (!arr)
        {
            ++it;
            continue;
        }

        int index = arr->Index(base);
        if (index != wxNOT_FOUND)
            arr->RemoveAt(index);

        if (m_pWorkspace)
            m_pWorkspace->SetModified(true);

        // if it was the last dependency, delete the array
        if (!arr->GetCount())
        {
            DepsMap::iterator it2 = it++;
            m_ProjectDeps.erase(it2);
            delete arr;
        }
        else
            ++it;
    }
    Manager::Get()->GetLogManager()->DebugLog(F(_T("Removed %s from all deps"), base->GetTitle().wx_str()));
}
开发者ID:Three-DS,项目名称:codeblocks-13.12,代码行数:40,代码来源:projectmanager.cpp

示例11: RemoveProjectDependency

void ProjectManager::RemoveProjectDependency(cbProject* base, cbProject* doesNotDependOn)
{
    if (!base || !doesNotDependOn)
        return;

    DepsMap::iterator it = m_ProjectDeps.find(base);
    if (it == m_ProjectDeps.end())
        return; // nothing to remove

    ProjectsArray* arr = it->second;
    arr->Remove(doesNotDependOn);

    Manager::Get()->GetLogManager()->DebugLog(F(_T("%s now does not depend on %s (%lu deps)"), base->GetTitle().wx_str(), doesNotDependOn->GetTitle().wx_str(), static_cast<unsigned long>(arr->GetCount())));
    // if it was the last dependency, delete the array
    if (!arr->GetCount())
    {
        m_ProjectDeps.erase(it);
        delete arr;
    }
    if (m_pWorkspace)
        m_pWorkspace->SetModified(true);
}
开发者ID:Three-DS,项目名称:codeblocks-13.12,代码行数:22,代码来源:projectmanager.cpp

示例12: XRCCTRL

ProjectDepsDlg::ProjectDepsDlg(wxWindow* parent, cbProject* sel)
    : m_LastSel(-1)
{
    //ctor
    wxXmlResource::Get()->LoadObject(this, parent, _T("dlgConfigureProjectDeps"),_T("wxScrollingDialog"));

    wxChoice* cmb = XRCCTRL(*this, "cmbProject", wxChoice);

    int idx = 0;
    ProjectsArray* mainarr = Manager::Get()->GetProjectManager()->GetProjects();
    for (size_t i = 0; i < mainarr->GetCount(); ++i)
    {
        cbProject* prj = mainarr->Item(i);
        cmb->Append(prj->GetTitle(), prj);
        if (prj == sel)
            idx = i;
    }
    cmb->SetSelection(idx);
    m_LastSel = idx;
    FillList();

    Fit();
}
开发者ID:DowerChest,项目名称:codeblocks,代码行数:23,代码来源:projectdepsdlg.cpp

示例13: FindMatchTokens

size_t WorkspaceBrowserF::FindMatchTokens(wxString search, TokensArrayF& result)
{
    size_t count=0;
    switch (m_BrowserOptions.displayFilter)
    {
        case bdfFile:
        {
            count = m_pParser->FindMatchTokens(m_ActiveFilename, search, result);
            break;
        }
        case bdfProject:
        {
            for (FilesList::iterator it = m_pActiveProject->GetFilesList().begin(); it != m_pActiveProject->GetFilesList().end(); ++it)
            {
                ProjectFile* pf = *it;
                count = m_pParser->FindMatchTokens(pf->file.GetFullPath(), search, result);
            }
            break;
        }
        case bdfWorkspace:
        {
            ProjectsArray* projects = Manager::Get()->GetProjectManager()->GetProjects();
            for (size_t i=0; i < projects->GetCount(); ++i)
            {
                cbProject* project = projects->Item(i);
                for (FilesList::iterator it = project->GetFilesList().begin(); it != project->GetFilesList().end(); ++it)
                {
                    ProjectFile* pf = *it;
                    count = m_pParser->FindMatchTokens(pf->file.GetFullPath(), search, result);
                }
            }
            break;
        }
    }
    return count;
}
开发者ID:Three-DS,项目名称:codeblocks-13.12,代码行数:36,代码来源:workspacebrowserf.cpp

示例14: event

void *ThreadSearchThread::Entry()
{
    // Tests if we have a working searcher object.
    // Cancel search if it is not the case
    if ( m_pTextFileSearcher == NULL )
        return 0;

    size_t i = 0;

    // For now, we look for all paths for the different search scopes
    // and store them in a sorted array to avoid pasing several times
    // the same file.
    // This will be changed to avoid consuming a lot of memory (parsing
    // form C:\ and storing all paths...). Aim is to avoid the use of the
    // array for storing items.

    // Search in directory files ?
    if ( m_FindData.MustSearchInDirectory() == true )
    {
        int flags = wxDIR_FILES | wxDIR_DIRS | wxDIR_DOTDOT;
        flags    |= m_FindData.GetHiddenSearch() ? wxDIR_HIDDEN : 0;

        const wxString &path = m_FindData.GetSearchPath(true);
        if (!wxDir::Exists(path))
        {
            ThreadSearchEvent event(wxEVT_THREAD_SEARCH_ERROR, -1);
            event.SetString(_("Cannot open folder ") + path);

            // Using wxPostEvent, we avoid multi-threaded memory violation.
            wxPostEvent(m_pThreadSearchView,event);
            return 0;
        }
        else
        {
            wxDir Dir(path);
            Dir.Traverse(*(static_cast<wxDirTraverser*>(this)), wxEmptyString, flags);
        }

        // Tests thread stop (cancel search, app shutdown)
        if ( TestDestroy() == true ) return 0;
    }

    // Search in workspace files ?
    if ( m_FindData.MustSearchInWorkspace() == true )
    {
        ProjectsArray* pProjectsArray = Manager::Get()->GetProjectManager()->GetProjects();
        for ( size_t j=0; j < pProjectsArray->GetCount(); ++j )
        {
            AddProjectFiles(m_FilePaths, *pProjectsArray->Item(j));
            if ( TestDestroy() == true ) return 0;
        }
    }
    else if ( m_FindData.MustSearchInProject() == true )
    {
        // Search in project files ?
        // Necessary only if not already parsed in worspace part
        cbProject* pProject = Manager::Get()->GetProjectManager()->GetActiveProject();
        if ( pProject != NULL )
        {
            AddProjectFiles(m_FilePaths, *pProject);
            if ( TestDestroy() == true ) return 0;
        }
    }
    else if ( m_FindData.MustSearchInTarget() == true )
    {
        // Search in target files ?
        // Necessary only if not already parsed in project part
        cbProject* pProject = Manager::Get()->GetProjectManager()->GetActiveProject();
        if ( pProject != NULL )
        {
            ProjectBuildTarget *pTarget = pProject->GetBuildTarget(pProject->GetActiveBuildTarget());
            if ( pTarget != 0 )
            {
                AddTargetFiles(m_FilePaths, *pTarget);
                if ( TestDestroy() == true ) return 0;
            }
        }
    }

    // Tests thread stop (cancel search, app shutdown)
    if ( TestDestroy() == true ) return 0;

    // Open files
    if ( m_FindData.MustSearchInOpenFiles() == true )
    {
        EditorManager* pEdManager = Manager::Get()->GetEditorManager();
        for (i = 0; i < (size_t)pEdManager->GetNotebook()->GetPageCount(); ++i)
        {
            cbEditor* pEditor = pEdManager->GetBuiltinEditor(i);
            if ( pEditor != NULL )
            {
                AddNewItem(m_FilePaths, pEditor->GetFilename(), m_Masks);
            }
        }
    }

    // Tests thread stop (cancel search, app shutdown)
    if ( TestDestroy() == true ) return 0;

    // if the list is empty, leave
//.........这里部分代码省略.........
开发者ID:obfuscated,项目名称:codeblocks_sf,代码行数:101,代码来源:ThreadSearchThread.cpp

示例15: OnBtnRunClick

void Execution::OnBtnRunClick(wxCommandEvent& /*event*/)
{
  ToggleControls(false);

  ProjectsArray* Projects = Manager::Get()->GetProjectManager()->GetProjects();
  if ( !Projects->GetCount() )
  {
    cbMessageBox(_("No active project(s) to process."),_T("Header Fixup"));
    ToggleControls(true);
    return;
  }

  // Generating list of files to process
  wxArrayString FilesToProcess;

  if ( m_Scope->GetSelection()==0 ) // project scope
  {
    cbProject* Project = Manager::Get()->GetProjectManager()->GetActiveProject();
    AddFilesFromProject(FilesToProcess,Project);
  }
  else                              // workspace scope
  {
    ProjectsArray* Projects2 = Manager::Get()->GetProjectManager()->GetProjects();
    for ( size_t i = 0; i < Projects2->GetCount(); ++i )
      AddFilesFromProject(FilesToProcess,(*Projects2)[i]);
  }

  if ( FilesToProcess.IsEmpty() )
  {
    cbMessageBox(_("No files to process."),_T("Header Fixup"));
    ToggleControls(true);
    return;
  }

  // Generating list of header groups to use
  wxArrayString Groups;
  for ( size_t i = 0; i < m_Sets->GetCount(); i++ )
  {
    if ( m_Sets->IsChecked(i) )
    {
      Groups.Add(m_Sets->GetString(i));
    }
  }

  if ( Groups.IsEmpty() )
  {
    cbMessageBox(_("Please select at least one header group."),_T("Header Fixup"));
    ToggleControls(true);
    return;
  }

  // Running the scan
  int HeadersAdded = 0;
  if      ( m_FileType->GetSelection()==0 )
  {
    Manager::Get()->GetLogManager()->DebugLog(F(_T("[HeaderFixup]: Processing header files...")));
    m_Log.Add( _T("[header files]\n"));
    m_Processor   = ProcessHeaderFiles;
    HeadersAdded += RunScan(FilesToProcess,Groups);
  }
  else if ( m_FileType->GetSelection()==1 )
  {
    Manager::Get()->GetLogManager()->DebugLog(F(_T("[HeaderFixup]: Processing source files...")));
    m_Log.Add(_T("[source files]\n"));
    m_Processor   = ProcessSourceFiles;
    HeadersAdded += RunScan(FilesToProcess,Groups);
  }
  else
  {
    Manager::Get()->GetLogManager()->DebugLog(F(_T("[HeaderFixup]: Processing header files...")));
    m_Log.Add( _T("[header files]\n"));
    m_Processor   = ProcessHeaderFiles;
    HeadersAdded += RunScan(FilesToProcess,Groups);

    Manager::Get()->GetLogManager()->DebugLog(F(_T("[HeaderFixup]: Processing source files...")));
    m_Log.Add( _T("\n[source files]\n"));
    m_Processor   = ProcessSourceFiles;
    HeadersAdded += RunScan(FilesToProcess,Groups);
  }

  if ( HeadersAdded )
  {
    wxString log; log.Printf(_("Added %d extra includes.\n"),HeadersAdded);
    if ( !m_Protocol->IsChecked() )
      cbMessageBox(log);

    m_Log.Add( _T("\n--> ") + log);
  }
  else
  {
    if ( !m_Protocol->IsChecked() )
      cbMessageBox(_("All files were OK. Nothing to be done."),_T("Header Fixup"));

    m_Log.Add( _("\n--> All files were OK. Nothing to be done.\n"));
  }

  if ( m_Protocol->IsChecked() )
  {
    this->Show(false);
    Protocol Prot(NULL);
//.........这里部分代码省略.........
开发者ID:simple-codeblocks,项目名称:Codeblocks,代码行数:101,代码来源:execution.cpp


注:本文中的ProjectsArray::GetCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。