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


C++ Files::push_back方法代码示例

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


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

示例1: readFiles

Files Extractor::readFiles() {
	Files files;
	while (i < content.size()) {
		files.push_back(readFile());
	}
	return files;
}
开发者ID:s3rvac,项目名称:ar-cpp,代码行数:7,代码来源:extractor.cpp

示例2: getConfigMergeFiles

ConfigProcessor::Files ConfigProcessor::getConfigMergeFiles(const std::string & config_path)
{
    Files res;

    Poco::Path merge_dir_path(config_path);
    merge_dir_path.setExtension("d");

    std::vector<std::string> merge_dirs;
    merge_dirs.push_back(merge_dir_path.toString());
    if (merge_dir_path.getBaseName() != "conf")    {
        merge_dir_path.setBaseName("conf");
        merge_dirs.push_back(merge_dir_path.toString());
    }

    for (const std::string & merge_dir_name : merge_dirs)
    {
        Poco::File merge_dir(merge_dir_name);
        if (!merge_dir.exists() || !merge_dir.isDirectory())
            continue;
        for (Poco::DirectoryIterator it(merge_dir_name); it != Poco::DirectoryIterator(); ++it)
        {
            Poco::File & file = *it;
            if (file.isFile() && (endsWith(file.path(), ".xml") || endsWith(file.path(), ".conf")))
            {
                res.push_back(file.path());
            }
        }
    }

    return res;
}
开发者ID:bamx23,项目名称:ClickHouse,代码行数:31,代码来源:ConfigProcessor.cpp

示例3: operator

 ReturnCode operator()(const Files &files, const SufficientInfo &si) const
 {
     MSS_BEGIN(ReturnCode);
     MSS(remove_(files));
     Files cachedFiles;
     if (cache_)
     {
         std::ostringstream oss;
         oss << si;
         using namespace hash::md5;
         Stream md5_base;
         md5_base << oss.str();
         for (auto f: files)
         {
             Stream md5(md5_base);
             md5 << f.name();
             File cachedFile(*cache_);
             cachedFile << md5.hash_hex();
             cachedFile.setType(File::Unknown);
             cachedFiles.push_back(cachedFile);
         }
         bool foundAll = true;
         for (auto cf: cachedFiles)
         {
             foundAll = false;
             if (!isRegular(cf))
                 continue;
             foundAll = true;
         }
         if (foundAll)
         {
             //We found all files in the cache, just copy them and finished
             size_t i = 0;
             for (auto &cf: cachedFiles)
             {
                 receiver_().creater_copyFromCache(cf, files[i]);
                 MSS(copy(cf, files[i]));
                 ++i;
             }
             MSS_END();
         }
     }
     //No cache present, or the files are not present in the cache => we have to generate them
     MSS(receiver_().creater_create(files, si));
     //Check that all files are present
     for (auto f: files)
         MSS(isRegular(f));
     //Put the generated files in the cache
     if (cache_)
     {
         size_t i = 0;
         for (auto &cf: cachedFiles)
         {
             receiver_().creater_copyToCache(files[i], cf);
             MSS(copy(files[i], cf));
             ++i;
         }
     }
     MSS_END();
 }
开发者ID:gfannes,项目名称:gubg.io,代码行数:60,代码来源:Creater.hpp

示例4: parse

void Options::parse()
{
    for (int i = 1; i < _argc; i++)
    {
        if (_argv[i][0] == '-')
        {
            for (int j = 1; _argv[i][j]; j++)
            {
                switch (_argv[i][j])
                {
                case 'v':
                    _verbose = true;
                    break;
                case 'R':
                    _recursive = true;
                    break;
                case 'f':
                    _force = true;
                    break;
                }
            }
        }
        else
        {
            _files.push_back(_argv[i]);
        }
    }
}
开发者ID:jterweeme,项目名称:wincore,代码行数:28,代码来源:rm.cpp

示例5: UpkUse7z

bool UpkUse7z(LPCTSTR szExeFile, LPCTSTR szExtractPath, Files &files)
{
#if 0 
	static CExeUnpack7z *upk=NULL;
	if(!upk)
	{
		upk = new CExeUnpack7z;
		upk->Initialize(szPath7z, szPathWcx);
	}
	
	strings fs;
	CStringA s1 = CT2CA(szExeFile);
	CStringA s2 = CT2CA(szExtractPath);
	bool bRet = upk->Extract(s1, s2, fs);
	if(bRet)
	{
		for(size_t i=0; i<fs.size(); ++i)
		{
			files.push_back( CString(CA2CT(fs[i].c_str())) );
		}
	}
	return bRet;
#endif
	return false;
}
开发者ID:dreamsxin,项目名称:PcManager,代码行数:25,代码来源:libPkgUpkTest.cpp

示例6: allRoots

Forest::Files Forest::allRoots() const
{
    assert(invariants_());

    Files files;
    for (auto tree: trees_)
    {
        files.push_back(tree->root());
    }
    return files;
}
开发者ID:gfannes,项目名称:gubg.io,代码行数:11,代码来源:Forest.cpp

示例7: allFiles

Forest::Files Forest::allFiles() const
{
    assert(invariants_());

    Files files;
    for (auto tree: trees_)
    {
        for (const auto &f: tree->files())
            files.push_back(f);
    }
    return files;
}
开发者ID:gfannes,项目名称:gubg.io,代码行数:12,代码来源:Forest.cpp

示例8: search

TextSearch::Files TextSearch::search(Files& files, const SearchString& sstr)
{
  Files results;
  for (auto file : files)
  {
    std::ostringstream stext;
    std::ofstream fs;
    fs.open(file, std::fstream::in);
    if (fs.good())
    {
      stext << fs.rdbuf();
      std::string text = stext.str();
      size_t pos = text.find(sstr);
      if (pos < text.size())
        results.push_back(file);
    }
  }
  return results;
}
开发者ID:DavidNingGithub,项目名称:Performance-Assessment-Framework-of-Remote-Server,代码行数:19,代码来源:TextSearch.cpp

示例9: getDicomFilesInDirectory

        bool getDicomFilesInDirectory(const std::string& path, Files& files) const
        {
            osgDB::DirectoryContents contents = osgDB::getDirectoryContents(path);

            std::sort(contents.begin(), contents.end());

            for(osgDB::DirectoryContents::iterator itr = contents.begin();
                itr != contents.end();
                ++itr)
            {
                std::string localFile = path + "/" + *itr;
                info()<<"contents = "<<localFile<<std::endl;
                if (acceptsExtension(osgDB::getLowerCaseFileExtension(localFile)) &&
                    osgDB::fileType(localFile) == osgDB::REGULAR_FILE)
                {
                    files.push_back(localFile);
                }
            }
            
            return !files.empty();
        }
开发者ID:BlitzMaxModules,项目名称:osg.mod,代码行数:21,代码来源:ReaderWriterDICOM.cpp

示例10: GetFilesInDirectory

// Get a list of files in the given directory
Files GetFilesInDirectory(const std::string &path, const std::vector<std::string> &extensions)
{
	DIR *dir;
	dirent *entry;
	Files files;

	std::string finalPath = path;
	if (finalPath[path.size() - 1] != '/')
		finalPath += '/';

	if ((dir = opendir(path.c_str())))
	{
		while ((entry = readdir(dir)))
		{
			std::string filename = std::string(entry->d_name);
			if (filename == "." || filename == "..")
				continue;
			std::string fullPath = finalPath + filename;
			// Although the following function is for checking if a directory
			// exists, it can also be used to check if a path is a directory,
			// saving a little bit of extra code
			if (DirExists(fullPath))
				continue;
			// We want to skip any files not matching the extensions we gave, if any
			std::string thisExtension = GetExtension(filename);
			auto extensionMatch = std::find_if(extensions.begin(), extensions.end(), [&](const std::string &extension)
			{
				return extension == thisExtension;
			});
			if (extensions.empty() || extensionMatch != extensions.end())
				files.push_back(fullPath);
		}
		closedir(dir);
	}

	return files;
}
开发者ID:soneek,项目名称:SDATStuff,代码行数:38,代码来源:NCSF.cpp

示例11: readImage

        virtual ReadResult readImage(const std::string& file, const osgDB::ReaderWriter::Options* options) const
        {
            notice()<<"Reading DICOM file "<<file<<" using DCMTK"<<std::endl;

            std::string ext = osgDB::getLowerCaseFileExtension(file);
            if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED;
            
            std::string fileName = file;
            if (ext=="dicom")
            {
                fileName = osgDB::getNameLessExtension(file);
            }

            fileName = osgDB::findDataFile( fileName, options );
            if (fileName.empty()) return ReadResult::FILE_NOT_FOUND;

            Files files;
            
            osgDB::FileType fileType = osgDB::fileType(fileName);
            if (fileType==osgDB::DIRECTORY)
            {
                getDicomFilesInDirectory(fileName, files);
            }
            else
            {
#if 1
                files.push_back(fileName);
#else                            
                if (!getDicomFilesInDirectory(osgDB::getFilePath(fileName), files))
                {
                    files.push_back(fileName);
                }
#endif            
            }

            if (files.empty())
            {
                return ReadResult::FILE_NOT_FOUND;
            }

            osg::ref_ptr<osg::RefMatrix> matrix = new osg::RefMatrix;
            osg::ref_ptr<osg::Image> image;
            unsigned int imageNum = 0;
            EP_Representation pixelRep = EPR_Uint8;
            int numPlanes = 0;
            GLenum pixelFormat = 0;
            GLenum dataType = 0;
            unsigned int pixelSize = 0;
            
            typedef std::list<FileInfo> FileInfoList;
            FileInfoList fileInfoList;

            typedef std::map<double, FileInfo> DistanceFileInfoMap;
            typedef std::map<osg::Vec3d, DistanceFileInfoMap> OrientationFileInfoMap;
            OrientationFileInfoMap orientationFileInfoMap;
            
            unsigned int totalNumSlices = 0;

            for(Files::iterator itr = files.begin();
                itr != files.end();
                ++itr)
            {
                DcmFileFormat fileformat;
                OFCondition status = fileformat.loadFile((*itr).c_str());
                if(!status.good()) return ReadResult::ERROR_IN_READING_FILE;
                
                FileInfo fileInfo;
                fileInfo.filename = *itr;

                double pixelSize_y = 1.0;
                double pixelSize_x = 1.0;
                double sliceThickness = 1.0;
                double imagePositionPatient[3] = {0, 0, 0};
                double imageOrientationPatient[6] = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0 };
                Uint16 numOfSlices = 1;
                
                double value = 0.0;
                if (fileformat.getDataset()->findAndGetFloat64(DCM_PixelSpacing, value,0).good())
                {
                    pixelSize_y = value;
                    fileInfo.matrix(1,1) = pixelSize_y;
                }

                if (fileformat.getDataset()->findAndGetFloat64(DCM_PixelSpacing, value,1).good())
                {
                    pixelSize_x = value;
                    fileInfo.matrix(0,0) = pixelSize_x;
                }

                // Get slice thickness
                if (fileformat.getDataset()->findAndGetFloat64(DCM_SliceThickness, value).good())
                {
                    sliceThickness = value;
                    notice()<<"sliceThickness = "<<sliceThickness<<std::endl;
                    fileInfo.sliceThickness = sliceThickness;
                }
    
                notice()<<"tagExistsWithValue(DCM_NumberOfFrames)="<<fileformat.getDataset()->tagExistsWithValue(DCM_NumberOfFrames)<<std::endl;
                notice()<<"tagExistsWithValue(DCM_NumberOfSlices)="<<fileformat.getDataset()->tagExistsWithValue(DCM_NumberOfSlices)<<std::endl;

//.........这里部分代码省略.........
开发者ID:BlitzMaxModules,项目名称:osg.mod,代码行数:101,代码来源:ReaderWriterDICOM.cpp

示例12: main

int main(int argc, char** argv)
{
	if(argc < 3){
		cout << "Prague metadata tool" << endl;
		cout << "Usage: " << argv[0] <<" [-s] [-c] [-o  <output file>] <metadata filename1>...<metadata filenameN>" << endl;
		cout << "\t-s\t\t" << "change byteorder of metadata from little-endian to big-endian" << endl;
		cout << "\t-c\t\t" << "save in metacache format" << endl;
		cout << "\t-m\t\t" << "save in multimeta format" << endl;
		cout << "\t-o <filename>\t" << "name of output file [default is out.meta]" << endl;
		return -1;
	}
	bool swap = false;
	bool cache = false;
	bool multi = false;
	Files files;
	int i = 1;
	string outfile("out.meta");
	while(i < argc){
		if(argv[i][0] == '-'){
			switch(argv[i++][1]){
			case 's': swap = true; break;
			case 'c': cache = true; break;
			case 'm': multi = true; break;	
			case 'o': 
				if(i < argc) 
					outfile = argv[i++]; 
				else 
					cerr << "an output file is not specified" << endl;
				break;					
			default: cerr << "unknown option '" << argv[i][1] << "'" << endl;
			}
		}
		else
			files.push_back(argv[i++]);
	}
	PragueMetadata metadata;
	MetaLoader<GetLEValue> loader;
	for(Files::const_iterator i = files.begin(); i != files.end(); ++i)
		if(!loader.load(i->c_str(), metadata)){
			cerr << "Can't load metadata from " << *i << endl;
			continue;
		}
	bool result = false;
	if(swap){
		MetaSaver<SaveBEValue> saver;
		if(!saver.open(outfile.c_str())){
			cerr << "can't open " << outfile << endl;
			return -1;
		}
		if(cache)
			result = saver.saveCache(metadata);
		else if(multi || (metadata.count() > 1))
			result = saver.saveMulti(metadata);
		else 
			result = saver.saveOne(metadata);
	}
	else{
		MetaSaver<SaveValue> saver;
		if(!saver.open(outfile.c_str())){
			cerr << "can't open " << outfile << endl;
			return -1;
		}
		if(cache)
			result = saver.saveCache(metadata);
		else if(multi || (metadata.count() > 1))
			result = saver.saveMulti(metadata);
		else 
			result = saver.saveOne(metadata);
	}
	if(!result){
		cerr << "Can't save metadata to " << outfile << endl;
		return -1;
	}

	return 0;
}
开发者ID:hackshields,项目名称:antivirus,代码行数:76,代码来源:metatool.cpp


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