• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

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

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: writeAbundances

    void writeAbundances(ExpLib& alnLib,
                         boost::filesystem::path& fname,
                         std::string headerComments) {
        using sailfish::math::LOG_0;
        using sailfish::math::LOG_1;

        std::unique_ptr<std::FILE, int (*)(std::FILE *)> output(std::fopen(fname.c_str(), "w"), std::fclose);

        fmt::print(output.get(), "{}", headerComments);
        fmt::print(output.get(), "# Name\tLength\tTPM\tFPKM\tNumReads\n");


        auto& refs = alnLib.transcripts();
        auto numMappedReads = alnLib.numMappedReads();
        const double logBillion = std::log(1000000000.0);
        const double million = 1000000.0;
        const double logNumFragments = std::log(static_cast<double>(numMappedReads));
        auto clusters = alnLib.clusterForest().getClusters();
        size_t clusterID = 0;
        for(auto cptr : clusters) {

            double logClusterMass = cptr->logMass();
            double logClusterCount = std::log(static_cast<double>(cptr->numHits()));

            if (logClusterMass == LOG_0) {
                std::cerr << "Warning: cluster " << clusterID << " has 0 mass!\n";
            }

            bool requiresProjection{false};

            auto& members = cptr->members();
            size_t clusterSize{0};
            for (auto transcriptID : members) {
                Transcript& t = refs[transcriptID];
                t.uniqueCounts = t.uniqueCount();
                t.totalCounts = t.totalCount();
                //clusterCount += t.totalCounts;
            }

            for (auto transcriptID : members) {
                Transcript& t = refs[transcriptID];
                double logTranscriptMass = t.mass(false);
                if (logTranscriptMass == LOG_0) {
                    t.projectedCounts = 0;
                } else {
                    double logClusterFraction = logTranscriptMass - logClusterMass;
                    t.projectedCounts = std::exp(logClusterFraction + logClusterCount);
                    requiresProjection |= t.projectedCounts > static_cast<double>(t.totalCounts) or
                        t.projectedCounts < static_cast<double>(t.uniqueCounts);
                }
                ++clusterSize;
            }

            if (clusterSize > 1 and requiresProjection) {
                cptr->projectToPolytope(refs);
            }
            ++clusterID;
        }

        auto& transcripts_ = refs;
        double tfracDenom{0.0};
        for (auto& transcript : transcripts_) {
            tfracDenom += (transcript.projectedCounts / numMappedReads) / transcript.RefLength;
        }

        // Now posterior has the transcript fraction
        for (auto& transcript : transcripts_) {
            double logLength = std::log(transcript.RefLength);
            double fpkmFactor = std::exp(logBillion - logLength - logNumFragments);
            double count = transcript.projectedCounts;
            //double countTotal = transcripts_[transcriptID].totalCounts;
            //double countUnique = transcripts_[transcriptID].uniqueCounts;
            double fpkm = count > 0 ? fpkmFactor * count : 0.0;
            double npm = (transcript.projectedCounts / numMappedReads);
            double tfrac = (npm / transcript.RefLength) / tfracDenom;
            double tpm = tfrac * million;

            fmt::print(output.get(), "{}\t{}\t{}\t{}\t{}\n",
                    transcript.RefName, transcript.RefLength,
                    tpm, fpkm, count);
        }

    }
开发者ID:homologus,项目名称:KmerMagic,代码行数:83,代码来源:SalmonUtils.cpp


示例17: SaveImage

void SaveImage( boost::filesystem::path path, cv::Mat image )
{
    cv::imwrite( path.native_file_string(), image );
}
开发者ID:mikeroberts3000,项目名称:NeuralProcessReconstructionFromSparseUserScribbles,代码行数:4,代码来源:Main.cpp


示例18: conv

void
tc_simple_wchar()
{
    using dotconf::Document ;
    using dotconf::Item ;
    utf8_to_oem conv( locale , console_cp_name );
    std::auto_ptr< const Document > doc_ptr ;
    try {
        const wchar_t * fname = L"Простой документ.conf" ;
        const fs::path test_path ( testdir_path / fname );
        const std::wstring testfile_str ( test_path.wstring() );
        BOOST_TEST_MESSAGE( i18n("Test file path") << ": " << conv(testfile_str) );
        doc_ptr.reset( new Document( testfile_str ) );
    } catch( const dotconf::SyntaxError & error ) {
        BOOST_FAIL( error.what() << " in position " << error.textpos );
    } catch( const std::exception & error ) {
        BOOST_FAIL( error.what() );
    } catch(...) {
        BOOST_FAIL( i18n("Unknown exception") );
    }
    BOOST_REQUIRE( 0 != doc_ptr.get() );
    const Document::Items_t & items = *doc_ptr;
    BOOST_REQUIRE( !items.empty() );
    Document::const_iterator it = items.begin();
    BOOST_REQUIRE( items.end() != it );
    BOOST_CHECK_EQUAL( *it , Item::create_comment("# Simple config file") );
    BOOST_CHECK_EQUAL( *++it , Item::create_endl() );
    BOOST_CHECK_EQUAL( *++it , Item::create_param("simpleParam") );
    BOOST_REQUIRE( items.has_child( it ) );
    it = items.get_child( it );
    BOOST_CHECK_EQUAL( *it , Item::create_value("simpleValue") );
    BOOST_CHECK( items.next_sibling( it ) == items.end() );
    it = items.next_sibling( items.get_parent( it ) );
    BOOST_REQUIRE( items.end() != it );
    BOOST_CHECK_EQUAL( *it , Item::create_endl() );
    BOOST_CHECK_EQUAL( *++it , Item::create_endl() );
    BOOST_CHECK_EQUAL( *++it , Item::create_param("strParam") );
    BOOST_REQUIRE( items.has_child( it ) );
    it = items.get_child( it );
    BOOST_CHECK_EQUAL( *it , Item::create_value("string value") );
    BOOST_CHECK( items.next_sibling( it ) == items.end() );
    it = items.next_sibling( items.get_parent( it ) );
    BOOST_REQUIRE( items.end() != it );
    BOOST_CHECK_EQUAL( *it , Item::create_endl() );
    BOOST_CHECK_EQUAL( *++it , Item::create_endl() );
    BOOST_CHECK_EQUAL( *++it , Item::create_param("textParam") );
    BOOST_REQUIRE( items.has_child( it ) );
    it = items.get_child( it );
    BOOST_CHECK_EQUAL( *it , Item::create_value
        ("Line 1 of big text param value...\n"
         "Line 2 of text parameter value...\n"
         "Line 3 (last) of text parameter value.") );
    BOOST_CHECK( items.next_sibling( it ) == items.end() );
    it = items.next_sibling( items.get_parent( it ) );
    BOOST_REQUIRE( items.end() != it );
    BOOST_CHECK_EQUAL( *it , Item::create_endl() );
    BOOST_CHECK_EQUAL( *++it , Item::create_endl() );
    BOOST_CHECK_EQUAL( *++it , Item::create_param("vectorParam") );
    BOOST_REQUIRE( items.has_child( it ) );
    it = items.get_child( it );
    BOOST_CHECK_EQUAL( *it , Item::create_value("value1") );
    BOOST_CHECK_EQUAL( *++it , Item::create_value("value2") );
    BOOST_CHECK_EQUAL( *++it , Item::create_value("value3") );
    BOOST_CHECK_EQUAL( *++it , Item::create_value("value4") );
    BOOST_CHECK( items.next_sibling( it ) == items.end() );
    it = items.next_sibling( items.get_parent( it ) );
    BOOST_REQUIRE( items.end() != it );
    BOOST_CHECK_EQUAL( *it , Item::create_endl() );
    BOOST_CHECK_EQUAL( *++it , Item::create_endl() );
    BOOST_CHECK_EQUAL( *++it , Item::create_node("Node1") );
    BOOST_CHECK( !items.has_child( it ) );
    BOOST_CHECK_EQUAL( *++it , Item::create_endl() );
    BOOST_CHECK( items.next_sibling( it ) == items.end() );
} // tc_simple_wchar
开发者ID:Aleksei-Badyaev,项目名称:msdotconf,代码行数:74,代码来源:ts_document_simple_wchar.cpp


示例19: start

	bool start(const boost::filesystem::path &root) override
 	{
		if (running_) {
			if (root_ == root) {
				return true;
			} else {
				return false;
			}
		}

		SECURITY_ATTRIBUTES sa = {};

		sa.nLength = sizeof(sa);
		sa.bInheritHandle = TRUE;

		cancel_event_ = ::CreateEventW(&sa, TRUE, FALSE, nullptr);

		if (cancel_event_ == nullptr) {
			return false;
		}

		HANDLE hstdout_read = nullptr;
		HANDLE hstdout_write = nullptr;
		HANDLE hstderr_write = nullptr;

		if (::CreatePipe(&hstdout_read, &hstdout_write, &sa, 0) == FALSE) {
			return false;
		}

		if (::DuplicateHandle(
			::GetCurrentProcess(), hstdout_write, ::GetCurrentProcess(), &hstderr_write,
			0, TRUE, DUPLICATE_SAME_ACCESS) == FALSE)
		{
			::CloseHandle(hstdout_read);
			::CloseHandle(hstdout_write);
			return false;
		}

		if (::DuplicateHandle(
			::GetCurrentProcess(), hstdout_read, ::GetCurrentProcess(), &hstdout_,
			0, FALSE, DUPLICATE_SAME_ACCESS) == FALSE)
		{
			::CloseHandle(hstdout_read);
			::CloseHandle(hstdout_write);
			::CloseHandle(hstderr_write);
			return false;
		}

		STARTUPINFOW si = {};

		si.cb = sizeof(STARTUPINFOW);
		si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
		si.hStdOutput = hstdout_write;
		si.hStdError = hstderr_write;
		si.wShowWindow = SW_HIDE;

		PROCESS_INFORMATION pi = {};

		std::wstring command = L'\"' + (get_exe_path().remove_filename() / L"console-helper.exe").wstring();

		command += L"\" ";
		command += std::to_wstring(reinterpret_cast<std::uintptr_t>(cancel_event_));
		command += L' ';
		command += L"jupyter notebook --no-browser ";
		command += L"--notebook-dir=\"";
		command += root.wstring();
		command += L'\"';

		auto result = ::CreateProcessW(
			nullptr,
			const_cast<LPWSTR>(command.c_str()),
			nullptr,
			nullptr,
			TRUE,
			CREATE_NO_WINDOW | CREATE_NEW_PROCESS_GROUP,
			nullptr,
			nullptr,
			&si,
			&pi);

		::CloseHandle(hstdout_read);
		::CloseHandle(hstdout_write);
		::CloseHandle(hstderr_write);

		if (result == FALSE) {
			::CloseHandle(hstdout_);
			return false;
		}

		running_ = true;
		helper_process_ = pi.hProcess;

		char buf_array[256];
		DWORD read;

		std::string buf;

		const char *text = "The Jupyter Notebook is running at: ";
		auto text_len = ::strlen(text);

//.........这里部分代码省略.........
开发者ID:quartorz,项目名称:reveal-viewer,代码行数:101,代码来源:jupyter_server.hpp


示例20: load

 virtual void load(const boost::filesystem::path& filepath, int& index)
 {
   std::cout << "Loading content file " << filepath.string() << std::endl;
   mListener.setLabel(MyGUI::TextIterator::toTagsString(filepath.string()));
 }
开发者ID:EmperorArthur,项目名称:openmw,代码行数:5,代码来源:contentloader.hpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ gregorian::months类代码示例发布时间:2022-05-31
下一篇:
C++ fibers::condition_variable_any类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap