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


C++ filesystem::path类代码示例

本文整理汇总了C++中boost::filesystem::path的典型用法代码示例。如果您正苦于以下问题:C++ path类的具体用法?C++ path怎么用?C++ path使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1:

	FileWatcher::FailedToWatchFileException::FailedToWatchFileException(const boost::filesystem::path& path, const std::string& why)
		: std::runtime_error("FailedToWatchFile: " + path.string() + " Why: " + why)
	{}
开发者ID:codyjackson,项目名称:voxel_engine,代码行数:3,代码来源:filesystem.cpp

示例2: Frame

Bundle2::Bundle2(const boost::filesystem::path& fileName, bool loadGeometry):
	version_(BUNDLE_VERSION), poiFirstFrame_(0) {
	// Opening file
	H5::H5File bundleFile;
	bundleFile.openFile(fileName.string(), H5F_ACC_RDONLY);
	loadParameters(bundleFile);

	// Loading POI
	H5::Group poiGroup = bundleFile.openGroup("/POI");

	hsize_t count;
	H5::Attribute attr = poiGroup.openAttribute("count");
	attr.read(H5::PredType::NATIVE_HSIZE, &count);
	attr.close();

	for(size_t frame = 0; frame < count; ++frame) {
		cout.flush();

		const std::string frameGroupName = boost::str(boost::format("Frame %1$04d") % frame);
		H5::Group frameGroup = poiGroup.openGroup(frameGroupName);

		addPOIFrame();
		for(size_t camera = 0; camera < numCameras_; ++camera)
			poi_[poi_.size() - 1][camera].load(frameGroup, camera);

		frameGroup.close();
	}

	poiGroup.close();

	// Loading frames
	H5::Group bundleGroup = bundleFile.openGroup("/Bundle");

	H5::Group framesGroup = bundleGroup.openGroup("Frames");

	attr = framesGroup.openAttribute("count");
	attr.read(H5::PredType::NATIVE_HSIZE, &count);
	attr.close();

	for(size_t frame = 0; frame < count; ++frame) {
		Frame* f = new Frame(framesGroup, frame, numCameras_);
		frames_.push_back(f);
	}

	framesGroup.close();

	// Loading tracks
	H5::DataSet tracksDataset = bundleGroup.openDataSet("Tracks");

	hsize_t tracksDim[2];
	H5::DataSpace tracksDS = tracksDataset.getSpace();
	tracksDS.getSimpleExtentDims(tracksDim);
	tracksDS.close();

	for(size_t i = 0; i < tracksDim[0]; ++i) {
		size_t j = addTrack();
		tracks_[j]->load(tracksDataset, frames_, i);
	}

	tracksDataset.close();

	bundleGroup.close();

	if(loadGeometry && checkGeometry_(bundleFile)) loadGeometry_(bundleFile);

	bundleFile.close();
}
开发者ID:ttnguyenUBP,项目名称:T3DV_backup,代码行数:67,代码来源:bundle2.cpp

示例3: parse

		static evaluation parse(const boost::filesystem::path& p)
		{
			evaluation e = parse_filename(p.filename().string());
			parse_file(e, p.string());
			return e;
		}
开发者ID:Wassasin,项目名称:vakkenranking,代码行数:6,代码来源:complete_parser.hpp

示例4:

void OMW::Engine::addZipResource (const boost::filesystem::path& path)
{
    mOgre->getRoot()->addResourceLocation (path.string(), "Zip",
        Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, false);
}
开发者ID:matrixworld,项目名称:openmw,代码行数:5,代码来源:engine.cpp

示例5: boostPathToQString

QString boostPathToQString(const boost::filesystem::path &path)
{
    return QString::fromStdString(path.string());
}
开发者ID:happycoinmaster,项目名称:Happycoin,代码行数:4,代码来源:guiutil.cpp

示例6: SaveOpticalFlowMap

void SaveOpticalFlowMap( boost::filesystem::path opticalFlowMapPath, cv::Mat opticalFlowMap )
{
    std::ofstream file( opticalFlowMapPath.native_file_string().c_str(), std::ios::binary );
    file.write( (char*)opticalFlowMap.data, opticalFlowMap.rows * opticalFlowMap.cols * sizeof( cv::Vec2f ) );
    file.close();
}
开发者ID:mikeroberts3000,项目名称:NeuralProcessReconstructionFromSparseUserScribbles,代码行数:6,代码来源:Main.cpp

示例7: as_string

inline const std::string as_string(const boost::filesystem::path & path) {
	return path.string();
}
开发者ID:a-detiste,项目名称:innoextract,代码行数:3,代码来源:boostfs_compat.hpp

示例8:

 BufferBuilder::BufferBuilder(boost::filesystem::path& file, size_t fileSize, unsigned int bufferCount, size_t cacheSize) :
 STR_FILE(file.string()), FILE_SIZE(fileSize), BUFFER_COUNT(bufferCount), CACHE_SIZE(cacheSize)
 { }
开发者ID:LarsHadidi,项目名称:BDSim,代码行数:3,代码来源:BufferBuilder.cpp

示例9: archive_error_t

void
archive_t::deploy(const fs::path& prefix) {
    archive * target = archive_write_disk_new();
    archive_entry * entry = NULL;

    int rv = ARCHIVE_OK;

    int flags = ARCHIVE_EXTRACT_TIME |
                ARCHIVE_EXTRACT_PERM |
                ARCHIVE_EXTRACT_ACL |
                ARCHIVE_EXTRACT_FFLAGS |
                ARCHIVE_EXTRACT_SECURE_NODOTDOT;

    archive_write_disk_set_options(target, flags);
    archive_write_disk_set_standard_lookup(target);
    
    while(true) {
        rv = archive_read_next_header(m_archive, &entry);
        
        if(rv == ARCHIVE_EOF) {
            break;
        } else if(rv != ARCHIVE_OK) {
            throw archive_error_t(m_archive);
        }

        fs::path path = archive_entry_pathname(entry);

        // NOTE: Prepend the target path to the stored file path
        // in order to unpack it into the right place.
        archive_entry_set_pathname(entry, (prefix / path).string().c_str());

        rv = archive_write_header(target, entry);
        
        if(rv != ARCHIVE_OK) {
            throw archive_error_t(target);
        } else if(archive_entry_size(entry) > 0) {
            extract(m_archive, target);
        }
    }

    rv = archive_write_finish_entry(target);

    if(rv != ARCHIVE_OK) {
        throw archive_error_t(target);
    }

    // NOTE: The reported count is off by one for some reason.
    size_t count = archive_file_count(m_archive) - 1;

    COCAINE_LOG_INFO(
        m_log,
        "archive type: %s, extracted %d %s to '%s'",
        type(),
        count,
        count == 1 ? "file" : "files",
        prefix.string()
    );

    archive_write_close(target);
    archive_write_finish(target);
}
开发者ID:zloidemon,项目名称:cocaine-core,代码行数:61,代码来源:archive.cpp

示例10: NotADirException

 NotADirException(const boost::filesystem::path& p)
     : std::runtime_error(p.string() + " Is not a directory") {}
开发者ID:thadeuluiz,项目名称:odeio-isso,代码行数:2,代码来源:errors.hpp

示例11: make_cpp_file

void make_cpp_file(const std::string & content, const fs::path & path)
{
    std::ofstream f { path.string() };
    f << content;
}
开发者ID:Ryuuke,项目名称:desperion,代码行数:5,代码来源:main.cpp

示例12: EventBlock

DataFileIndexer::DataFileIndexer(const boost::filesystem::path &data_file, 
								 const unsigned int _events_per_block,
								 const unsigned int multiplication_factor_per_level,
								 const int number_of_indexing_threads) : events_per_block(_events_per_block) {
	uri = "ldobinary:file://" + data_file.string();
	
	// I hate myself for this
	char *uri_temp = new char[uri.length() + 1];
	strncpy(uri_temp, uri.c_str(), uri.length() + 1);
	session = scarab_session_connect(uri_temp);
	delete [] uri_temp;

	
	{
		std::vector<boost::shared_ptr<EventBlock> > event_blocks;
		{
			number_of_events = 0;
			
			std::vector<unsigned int> event_codes_in_block;
			MonkeyWorksTime max_time = MIN_MONKEY_WORKS_TIME();
			MonkeyWorksTime min_time = MAX_MONKEY_WORKS_TIME();
			long int previous_datum_location = scarab_tell(session);
			
			ScarabDatum *datum = NULL;
			while(datum = scarab_read(session)) {
				event_codes_in_block.push_back(DataFileUtilities::getScarabEventCode(datum));
				
				const MonkeyWorksTime event_time = DataFileUtilities::getScarabEventTime(datum);
				max_time = max_time > event_time ? max_time : event_time;
				min_time = min_time < event_time ? min_time : event_time;
				
				number_of_events++; 
				//std::cout << number_of_events << " ";
				
				if(number_of_events % events_per_block == 0) { 
					std::sort(event_codes_in_block.begin(), event_codes_in_block.end());
					event_codes_in_block.erase(std::unique(event_codes_in_block.begin(), 
														   event_codes_in_block.end()), 
											   event_codes_in_block.end());
					std::cout << "indexing block " << event_blocks.size() << " .. time : " << min_time << "LL - " << max_time << "LL" << std::endl;

					//				cerr << "new event block : num events : " << event_codes_in_block.size() << endl;
					boost::shared_ptr<EventBlock> new_event_block = boost::shared_ptr<EventBlock>(new EventBlock(previous_datum_location, min_time, max_time, event_codes_in_block));
					event_blocks.push_back(new_event_block);
					
					event_codes_in_block.clear();
					max_time = MIN_MONKEY_WORKS_TIME();
					min_time = MAX_MONKEY_WORKS_TIME();
					previous_datum_location = scarab_tell(session);
				}			
				scarab_free_datum(datum);
			}
			
			// add in the remainder blocks
			boost::shared_ptr<EventBlock> new_event_block = boost::shared_ptr<EventBlock>(new EventBlock(previous_datum_location, min_time, max_time, event_codes_in_block));
			event_blocks.push_back(new_event_block);
			//std::cout << "size " << event_blocks.size();
			
		}
		
		
		{
			// build the tree
			int events_per_node = events_per_block;
			int number_of_levels = 1;
			while(events_per_node < number_of_events) {
				number_of_levels++;
				events_per_node *= multiplication_factor_per_level;
			}
			
			std::vector <boost::shared_ptr<EventBlock> > blocks_at_next_level = event_blocks;
			for(int i = 1; i < number_of_levels; ++i) {
				std::vector <boost::shared_ptr<EventBlock> > blocks_at_current_level;
				
				std::vector<boost::shared_ptr<EventBlock> >::const_iterator j = blocks_at_next_level.begin();
				while(j != blocks_at_next_level.end()) {
					std::vector <boost::shared_ptr<EventBlock> > children;					
					for(int k = 0; k < multiplication_factor_per_level && j != blocks_at_next_level.end(); ++k) {
						children.push_back(*j);
						++j;
					}
					boost::shared_ptr<EventBlock> new_block = boost::shared_ptr<EventBlock>(new EventBlock(children));
					blocks_at_current_level.push_back(new_block);
				}
				
				blocks_at_next_level = blocks_at_current_level;
			}
			
			if(blocks_at_next_level.size() != 1) {
				//badness
				std::cerr << "something went wrong...please abort and try again" << std::endl;
				throw new std::exception;
			}
			root = blocks_at_next_level.at(0);
		}
	}
}
开发者ID:maunsell,项目名称:MWorks,代码行数:97,代码来源:DataFileIndexer.cpp

示例13: createFilteredFlowcell

flowcell::Layout FastqFlowcell::createFilteredFlowcell(
    const std::string &tilesFilter,
    const boost::filesystem::path &baseCallsDirectory,
    const bool compressed,
    const unsigned laneNumberMax,
    const unsigned readNameLength,
    std::string useBasesMask,
    const bool allowVariableFastqLength,
    const std::string &seedDescriptor,
    const unsigned seedLength,
    const reference::ReferenceMetadataList &referenceMetadataList,
    unsigned &firstPassSeeds)
{

    FastqPathPairList flowcellFilePaths = findFastqPathPairs(compressed, laneNumberMax, baseCallsDirectory);
    if (flowcellFilePaths.empty())
    {
        const boost::format message = boost::format("\n   *** Could not find any fastq lanes in: %s ***\n") %
            baseCallsDirectory;
        BOOST_THROW_EXCEPTION(common::InvalidOptionException(message.str()));
    }

    FastqFlowcellInfo flowcellInfo = parseFastqFlowcellInfo(flowcellFilePaths, allowVariableFastqLength, readNameLength);

    std::vector<unsigned int> readLengths;
    if (flowcellInfo.readLengths_.first)
    {
        readLengths.push_back(flowcellInfo.readLengths_.first);
    }
    if (flowcellInfo.readLengths_.second)
    {
        readLengths.push_back(flowcellInfo.readLengths_.second);
    }

    if ("default" == useBasesMask)
    {
        if (readLengths.size() == 1)
        {
            useBasesMask = "y*n";
        }
        else if (readLengths.size() == 2)
        {
            useBasesMask = "y*n,y*n";
        }
        else
        {
            const boost::format message =
                boost::format("\n   *** Could not guess the use-bases-mask for '%s', please supply the explicit value ***\n") %
                baseCallsDirectory.string();
            BOOST_THROW_EXCEPTION(common::InvalidOptionException(message.str()));
        }
    }

    std::vector<unsigned int> readFirstCycles;

    ParsedUseBasesMask parsedUseBasesMask;
    alignment::SeedMetadataList seedMetadataList;
    if (!readLengths.empty())
    {
        parsedUseBasesMask = parseUseBasesMask(readFirstCycles, readLengths, seedLength, useBasesMask, baseCallsDirectory);
        seedMetadataList = parseSeedDescriptor(parsedUseBasesMask.dataReads_, seedDescriptor, seedLength, firstPassSeeds);
    }

    flowcell::Layout fc(baseCallsDirectory,
                        flowcell::Layout::Fastq,
                        flowcell::FastqFlowcellData(compressed),
                        laneNumberMax,
                        flowcellInfo.readNameLength_,
                        std::vector<unsigned>(),
                        parsedUseBasesMask.dataReads_,
                        seedMetadataList, flowcellInfo.flowcellId_);

    std::string regexString(tilesFilter);
    std::replace(regexString.begin(), regexString.end(), ',', '|');
    boost::regex re(regexString);
    BOOST_FOREACH(const unsigned int lane, flowcellInfo.getLanes())
    {
        std::string laneString((boost::format("s_%d") % lane).str());
        if (boost::regex_search(laneString, re))
        {
            fc.addTile(lane, 1);
        }
    }

    return fc;
}
开发者ID:zeus19900814,项目名称:isaac2,代码行数:86,代码来源:FastqFlowcell.cpp

示例14: geoprojectEditMadrid

void
geoprojectEditMadrid(boost::filesystem::path & geoproj_path, const std::vector<double> & dvs, int seed)
{
    pugi::xml_document doc;
    pugi::xml_parse_result result = doc.load_file(geoproj_path.c_str());
    //// Parameters - Self-Influence Neighbourhood Rules
    // Arable land (Function Class 1)
    // From ARAble land to ARAble land
    double araara1 = dvs[0];
    double araara2 = dvs[1];
    double araara3 = dvs[2];
    // Permanent crops (Function Class 2)
    // From PERmanent crops to PERmanent crops
    double perper1 = dvs[3];
    double perper2 = dvs[4];
    double perper3 = dvs[5];
	// Pastures (Function Class 3)
	// From PAStures to PAStures
	double paspas1 = dvs[6];
	double paspas2 = dvs[7];
	double paspas3 = dvs[8];
    // Agricultural areas (Function Class 4)
    // From AGRicultural areas to AGRicultural areas
    double agragr1 = dvs[9];
    double agragr2 = dvs[10];
    double agragr3 = dvs[11];
    // Residential (Function Class 5)
    // From RESidential to RESidential
    double resres1 = dvs[12];
    double resres2 = dvs[13];
    double resres3 = dvs[14];
    // Industry & commerce (Function class 6)
    // From INDustry & commerce to INDustry & commerce
    double indind1 = dvs[15];
    double indind2 = dvs[16];
    double indind3 = dvs[17];
	// Recreation areas (Function class 7)
	// From RECreation areas to RECreation areas
	double recrec1 = dvs[18];
	double recrec2 = dvs[19];
	double recrec3 = dvs[20];
	// Forest (Function class 8)
	// From FORest to FORest
	double forfor1 = dvs[21];
	double forfor2 = dvs[22];
	double forfor3 = dvs[23];

    //// Parameters - Interaction Neighbourhood Rules
    // Arable land (Function Class 1)
	// From NATural areas to ARAble land
	double natara1 = dvs[24];
	double natara2 = dvs[25];
	double natara3 = dvs[26];
	// From From PERmanent crops to ARAble land
	double perara1 = dvs[27];
	double perara2 = dvs[28];
	double perara3 = dvs[29];
	// From PAStures to ARAble land
	double pasara1 = dvs[30];
	double pasara2 = dvs[31];
	double pasara3 = dvs[32];
    // From AGRicultural areas to ARAble land
	double agrara1 = dvs[33];
	double agrara2 = dvs[34];
	double agrara3 = dvs[35];
	// From RESidential to ARAble land
	double resara1 = dvs[36];
	double resara2 = dvs[37];
	double resara3 = dvs[38];
    // From INDustry & commerce to ARAble land
    double indara1 = dvs[39];
    double indara2 = dvs[40];
    double indara3 = dvs[41];
    // From RECreation areas to ARAble land
    double recara1 = dvs[42];
    double recara2 = dvs[43];
    double recara3 = dvs[44];
    // From FORest to ARAble land
    double forara1 = dvs[45];
    double forara2 = dvs[46];
    double forara3 = dvs[47];
	// From ROAd & rail to ARAble land
	double roaara1 = dvs[48];
	double roaara2 = dvs[49];
	double roaara3 = dvs[50];
	// From PORt area to ARAble land
	double porara1 = dvs[51];
	double porara2 = dvs[52];
	double porara3 = dvs[53];
    // From AIRports to ARAble land
    double airara1 = dvs[54];
    double airara2 = dvs[55];
    double airara3 = dvs[56];
    // From MINe and dump sites to ARAble land
    double minara1 = dvs[57];
    double minara2 = dvs[58];
    double minara3 = dvs[59];
    // From FREsh water to ARAble land
    double freara1 = dvs[60];
    double freara2 = dvs[61];
//.........这里部分代码省略.........
开发者ID:jeffrey-newman,项目名称:Charles-Metronamica-Optimiser,代码行数:101,代码来源:GeoprojectManipMadrid.cpp

示例15: load

bool SpriteSet::load(fs::path const& filename)
{	
	//cerr << "Loading sprite set: " << filename.native_file_string() << endl;
	
	BITMAP *tempBitmap = gfx.loadBitmap(filename.native_file_string().c_str(), 0, true);
	
	if (!tempBitmap)
		return false;
		
	LocalSetColorConversion cc(COLORCONV_NONE);
	LocalSetColorDepth cd(bitmap_color_depth(tempBitmap));

	if ( (tempBitmap->w > 1) && (tempBitmap->h > 1) )
	{
		int lastY = 1;
		int pivotY = -1;
		angleCount = 0;
		
		for (int y = 1; y < tempBitmap->h; ++y)
		{
			if( gfx.compareRGB(getpixel(tempBitmap,0,y),makecol(255,0,0)) ) // Red pixel marks the pivot of the sprite
			{
				pivotY = y-lastY;
			}
			else if( gfx.compareRGB(getpixel(tempBitmap,0,y), 0) || y == tempBitmap->h - 1 )
			{
				++angleCount;
				
				int lastX = 1;
				int pivotX = -1;
				frameCount = 0;
				
				for (int x = 1; x < tempBitmap->w; ++x)
				{
					// Pivot again but for X axis
					if( gfx.compareRGB(getpixel(tempBitmap,x,0), makecol(255,0,0)) )
					{
						pivotX = x-lastX;
					}
					else if(gfx.compareRGB(getpixel(tempBitmap,x,0), 0) || x == tempBitmap->w - 1 )
					{
						BITMAP* spriteFrame = create_bitmap(x-lastX+1, y-lastY+1);
						blit(tempBitmap, spriteFrame, lastX, lastY, 0, 0, spriteFrame->w, spriteFrame->h);
						//m_frames.back().push_back(new Sprite( spriteFrame, pivotX, pivotY ) );
						m_frames.push_back(new Sprite( spriteFrame, pivotX, pivotY ) );
						++frameCount;
						
						pivotX = -1;
						
						lastX = x + 1;
					}
				}

				pivotY = -1;
				lastY = y + 1;
			}
		}
			
		// Fill the other 180º with the sprites but mirrored.

	}

	destroy_bitmap(tempBitmap);
	
	m_angleFactor = (angleCount - 1) * 2;
	m_halfAngleDivisonSize = (1 << 15) / angleCount / 2;

	return true;
}
开发者ID:a-sf-mirror,项目名称:gusanos,代码行数:69,代码来源:sprite_set.cpp


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