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


C++ ProjectPtr::AddFile方法代码示例

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


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

示例1: AddNewFile

bool clCxxWorkspace::AddNewFile(const wxString& vdFullPath, const wxString& fileName, wxString& errMsg)
{
    wxStringTokenizer tkz(vdFullPath, wxT(":"));

    // We should have at least 2 tokens:
    // project:virtual directory
    if(tkz.CountTokens() < 2)
        return false;

    wxString projName = tkz.GetNextToken();
    wxString fixedPath;
    // Construct new path excluding the first token
    size_t count = tkz.CountTokens();

    for(size_t i = 0; i < count - 1; i++) {
        fixedPath += tkz.GetNextToken();
        fixedPath += wxT(":");
    }
    fixedPath += tkz.GetNextToken();

    ProjectPtr proj = FindProjectByName(projName, errMsg);
    if(!proj) {
        errMsg = wxT("No such project");
        return false;
    }

    return proj->AddFile(fileName, fixedPath);
}
开发者ID:capturePointer,项目名称:codelite,代码行数:28,代码来源:workspace.cpp

示例2: CreateFiles

void VcImporter::CreateFiles(wxXmlNode* parent, wxString vdPath, ProjectPtr proj)
{
    if(!parent) {
        return;
    }

    wxXmlNode* child = parent->GetChildren();
    while(child) {
        if(child->GetName() == wxT("Filter")) {
            // add new virtual directory
            wxString name = XmlUtils::ReadString(child, wxT("Name"));
            wxString tmpPath = vdPath;
            if(tmpPath.IsEmpty() == false) {
                tmpPath << wxT(":");
            }
            tmpPath << name;
            proj->CreateVirtualDir(tmpPath);
            CreateFiles(child, tmpPath, proj);

        } else if(child->GetName() == wxT("File")) {
            // found a file
            wxString fileName = XmlUtils::ReadString(child, wxT("RelativePath"));
            wxString path = vdPath;
            if(path.IsEmpty()) {
                path = wxT("src");
            }

            fileName.Replace(wxT("\\"), wxT("/"));
            proj->AddFile(fileName, path);
        }
        child = child->GetNext();
    }
}
开发者ID:Slasher006,项目名称:codelite,代码行数:33,代码来源:vcimporter.cpp

示例3: Import


//.........这里部分代码省略.........

                        for(GenericEnvVarsValueType envVar : cfg->envVars) {
                            envVars += envVar.first + wxT("=") + envVar.second + wxT("\n");
                        }

                        le_conf->SetEnvvars(envVars);
                        
                        BuildCommandList preBuildCommandList;
                        BuildCommandList postBuildCommandList;
                        
                        for (wxString preBuildCmd : cfg->preBuildCommands) {
                            BuildCommand preBuildCommand;
                            preBuildCommand.SetCommand(preBuildCmd);
                            preBuildCommand.SetEnabled(true);
                            
                            preBuildCommandList.push_back(preBuildCommand);
                        }
                        
                        for (wxString postBuildCmd : cfg->postBuildCommands) {
                            BuildCommand postBuildCommand;
                            postBuildCommand.SetCommand(postBuildCmd);
                            postBuildCommand.SetEnabled(true);
                        
                            postBuildCommandList.push_back(postBuildCommand);
                        }
                        
                        le_conf->SetPreBuildCommands(preBuildCommandList);
                        le_conf->SetPostBuildCommands(postBuildCommandList);

                        le_settings->SetBuildConfiguration(le_conf);

                        if(!project->deps.IsEmpty())
                            proj->SetDependencies(project->deps, cfg->name);
                    }

                    proj->SetSettings(le_settings);

                    proj->BeginTranscation();

                    // Delete default virtual directory
                    proj->DeleteVirtualDir("include");
                    proj->DeleteVirtualDir("src");

                    for(GenericProjectFilePtr file : project->files) {
                        wxString vpath;

                        if(file->vpath.IsEmpty()) {
                            wxFileName fileInfo(file->name);
                            wxString ext = fileInfo.GetExt().Lower();

                            if(ext == wxT("h") || ext == wxT("hpp") || ext == wxT("hxx") || ext == wxT("hh") ||
                               ext == wxT("inl") || ext == wxT("inc")) {
                                vpath = wxT("include");
                            } else if(ext == wxT("c") || ext == wxT("cpp") || ext == wxT("cxx") || ext == wxT("cc")) {
                                vpath = wxT("src");
                            } else if(ext == wxT("s") || ext == wxT("S") || ext == wxT("asm")) {
                                vpath = wxT("src");
                            } else {
                                vpath = wxT("resource");
                            }
                        } else {
                            vpath = file->vpath;

                            if(file->vpath.Contains(wxT("\\"))) {
                                vpath.Replace(wxT("\\"), wxT(":"));
                            } else if(file->vpath.Contains(wxT("/"))) {
                                vpath.Replace(wxT("/"), wxT(":"));
                            }
                        }

                        proj->CreateVirtualDir(vpath);
                        proj->AddFile(file->name, vpath);
                    }

                    proj->CommitTranscation();
                }

                if(clWorkspace) {
                    BuildMatrixPtr clMatrix = clWorkspace->GetBuildMatrix();

                    WorkspaceConfigurationPtr wsconf = clMatrix->GetConfigurationByName(wxT("Debug"));
                    if(wsconf) {
                        wsconf->SetConfigMappingList(cmlDebug);
                    }

                    wsconf = clMatrix->GetConfigurationByName(wxT("Release"));
                    if(wsconf) {
                        wsconf->SetConfigMappingList(cmlRelease);
                    }

                    clWorkspace->SetBuildMatrix(clMatrix);
                }

                return true;
            }
        }
    }

    return false;
}
开发者ID:Jactry,项目名称:codelite,代码行数:101,代码来源:WSImporter.cpp


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