⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 proj_tree.cpp

📁 ncbi源码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/* * =========================================================================== * PRODUCTION $Log: proj_tree.cpp,v $ * PRODUCTION Revision 1000.1  2004/06/01 18:31:29  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.3 * PRODUCTION * =========================================================================== *//* $Id: proj_tree.cpp,v 1000.1 2004/06/01 18:31:29 gouriano Exp $ * =========================================================================== * *                            PUBLIC DOMAIN NOTICE *               National Center for Biotechnology Information * *  This software/database is a "United States Government Work" under the *  terms of the United States Copyright Act.  It was written as part of *  the author's official duties as a United States Government employee and *  thus cannot be copyrighted.  This software/database is freely available *  to the public for use. The National Library of Medicine and the U.S. *  Government have not placed any restriction on its use or reproduction. * *  Although all reasonable efforts have been taken to ensure the accuracy *  and reliability of the software and data, the NLM and the U.S. *  Government do not and cannot warrant the performance or results that *  may be obtained by using this software or data. The NLM and the U.S. *  Government disclaim all warranties, express or implied, including *  warranties of performance, merchantability or fitness for any particular *  purpose. * *  Please cite the author in any work or product based on this material. * * =========================================================================== * * Author:  Viatcheslav Gorelenkov * */#include <ncbi_pch.hpp>#include <app/project_tree_builder/proj_tree.hpp>#include <app/project_tree_builder/proj_tree_builder.hpp>#include <app/project_tree_builder/proj_utils.hpp>#include <app/project_tree_builder/proj_builder_app.hpp>#include <algorithm>BEGIN_NCBI_SCOPE//-----------------------------------------------------------------------------CProjectItemsTree::CProjectItemsTree(void){    Clear();}CProjectItemsTree::CProjectItemsTree(const string& root_src){    Clear();    m_RootSrc = root_src;}CProjectItemsTree::CProjectItemsTree(const CProjectItemsTree& projects){    SetFrom(projects);}CProjectItemsTree& CProjectItemsTree::operator= (const CProjectItemsTree& projects){    if (this != &projects) {        Clear();        SetFrom(projects);    }    return *this;}CProjectItemsTree::~CProjectItemsTree(void){    Clear();}void CProjectItemsTree::Clear(void){    m_RootSrc.erase();    m_Projects.clear();}void CProjectItemsTree::SetFrom(const CProjectItemsTree& projects){    m_RootSrc  = projects.m_RootSrc;    m_Projects = projects.m_Projects;}void CProjectItemsTree::CreateFrom(const string& root_src,                                   const TFiles& makein,                                    const TFiles& makelib,                                    const TFiles& makeapp,                                    const TFiles& makemsvc,                                    CProjectItemsTree* tree){    tree->m_Projects.clear();    tree->m_RootSrc = root_src;    ITERATE(TFiles, p, makein) {        const string& fc_path = p->first;        const CSimpleMakeFileContents& fc_makein = p->second;        string source_base_dir;        CDirEntry::SplitPath(fc_path, &source_base_dir);        SMakeProjectT::TMakeInInfoList list_info;        SMakeProjectT::AnalyzeMakeIn(fc_makein, &list_info);        ITERATE(SMakeProjectT::TMakeInInfoList, i, list_info) {            const SMakeProjectT::SMakeInInfo& info = *i;            //Iterate all project_name(s) from makefile.in             ITERATE(list<string>, n, info.m_ProjNames) {                //project id will be defined latter                const string proj_name = *n;                        string applib_mfilepath =                     CDirEntry::ConcatPath(source_base_dir,                    SMakeProjectT::CreateMakeAppLibFileName(source_base_dir,                                                             proj_name));                if ( applib_mfilepath.empty() )                    continue;                            if (info.m_Type == SMakeProjectT::SMakeInInfo::eApp) {                    SAsnProjectT::TAsnType asn_type =                         SAsnProjectT::GetAsnProjectType(applib_mfilepath,                                                        makeapp,                                                        makelib);                    if (asn_type == SAsnProjectT::eMultiple) {                        SAsnProjectT::DoCreate(source_base_dir,                                                proj_name,                                                applib_mfilepath,                                                makeapp, makelib, tree);                    } else {                        SAppProjectT::DoCreate(source_base_dir,                                                proj_name,                                                applib_mfilepath,                                                makeapp, tree);                    }                }                else if (info.m_Type == SMakeProjectT::SMakeInInfo::eLib) {                    SAsnProjectT::TAsnType asn_type =                         SAsnProjectT::GetAsnProjectType(applib_mfilepath,                                                        makeapp,                                                        makelib);                    if (asn_type == SAsnProjectT::eMultiple) {                        SAsnProjectT::DoCreate(source_base_dir,                                                proj_name,                                                applib_mfilepath,                                                makeapp, makelib, tree);                    } else {                        SLibProjectT::DoCreate(source_base_dir,                                                proj_name,                                                applib_mfilepath,                                                makelib, tree);                    }                }                else if (info.m_Type == SMakeProjectT::SMakeInInfo::eAsn) {                    SAsnProjectT::DoCreate(source_base_dir,                                            proj_name,                                            applib_mfilepath,                                            makeapp, makelib, tree);                }                else if (info.m_Type == SMakeProjectT::SMakeInInfo::eMsvc) {                    SMsvcProjectT::DoCreate(source_base_dir,                                            proj_name,                                            applib_mfilepath,                                            makemsvc, tree);                }            }        }    }    {{        // REQUIRES tags in Makefile.in(s)        ITERATE(TFiles, p, makein) {            string makein_dir;            CDirEntry::SplitPath(p->first, &makein_dir);            const CSimpleMakeFileContents& makein_contents = p->second;            NON_CONST_ITERATE(TProjects, n, tree->m_Projects) {                CProjItem& project = n->second;                if ( IsSubdir(makein_dir, project.m_SourcesBaseDir) ) {                    CSimpleMakeFileContents::TContents::const_iterator k =                         makein_contents.m_Contents.find("REQUIRES");                    if ( k != makein_contents.m_Contents.end() ) {                        const list<string> requires = k->second;                        copy(requires.begin(),                              requires.end(),                              back_inserter(project.m_Requires));                                                project.m_Requires.sort();                        project.m_Requires.unique();                    }                }            }        }    }}}void CProjectItemsTree::GetInternalDepends(list<CProjKey>* depends) const{    depends->clear();    set<CProjKey> depends_set;    ITERATE(TProjects, p, m_Projects) {        const CProjItem& proj_item = p->second;        ITERATE(list<CProjKey>, n, proj_item.m_Depends) {            depends_set.insert(*n);        }    }    copy(depends_set.begin(), depends_set.end(), back_inserter(*depends));}void CProjectItemsTree::GetExternalDepends(list<CProjKey>* external_depends) const{    external_depends->clear();    list<CProjKey> depends;    GetInternalDepends(&depends);    ITERATE(list<CProjKey>, p, depends) {        const CProjKey& depend_id = *p;        if (m_Projects.find(depend_id) == m_Projects.end())            external_depends->push_back(depend_id);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -