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


C++ path::native方法代码示例

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


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

示例1:

        path operator/( path const & p, path const & rel_path )
        {
            if ( p.empty() ) return rel_path;
            if ( rel_path.empty() ) return p;

            path::string_type new_path_name = p.native(), rel_path_name = rel_path.native();
            if ( !IS_DIR_SEPARATORW( new_path_name.back() ) ) {
                new_path_name += ( IS_DIR_SEPARATORW( rel_path_name.front() ) ? L"" : L"\\" ) + rel_path_name;
            } else {
                int const index = rel_path_name.find_first_not_of( L"\\." );
                new_path_name += rel_path_name.substr( index, path::string_type::npos );
            }
            return path{ new_path_name };
        }
开发者ID:iamOgunyinka,项目名称:tinydircpp,代码行数:14,代码来源:utilities.cpp

示例2: __equivalent

bool __equivalent(const path& p1, const path& p2, std::error_code *ec)
{
    std::error_code ec1, ec2;
    struct ::stat st1 = {};
    struct ::stat st2 = {};
    auto s1 = detail::posix_stat(p1.native(), st1, &ec1);
    auto s2 = detail::posix_stat(p2.native(), st2, &ec2);

    if ((!exists(s1) && !exists(s2)) || (is_other(s1) && is_other(s2))) {
        set_or_throw(make_error_code(errc::not_supported), ec,
                     "equivalent", p1, p2);
        return false;
    }
    if (ec) ec->clear();
    return (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino);
}
开发者ID:AstroVPK,项目名称:LLVM-4.0.0,代码行数:16,代码来源:operations.cpp

示例3: Load

void CDynamicLibrary::Load(const path& path) const {
#if UCFG_USE_POSIX
	m_hModule = ::dlopen(String(path), 0);
	DlCheck(m_hModule == 0);
#else
	Win32Check((m_hModule = ::LoadLibrary(String(path.native()))) != 0);
#endif
}
开发者ID:ufasoft,项目名称:el,代码行数:8,代码来源:dl.cpp

示例4: invalid_argument

std::unique_ptr<std::ifstream> read(const path& path)
{
    if (!File::exists(path) || !File::is_regular_file(path)) {
        throw std::invalid_argument("File "+path.native()+" not found");
    }

    return std::unique_ptr<std::ifstream>(new ::boost::filesystem::ifstream(path));
}
开发者ID:ibizaman,项目名称:dbobject,代码行数:8,代码来源:FileIO.cpp

示例5: SourceException

    Source::Source(Language *sourceLanguage, const path &sourceFilePath) throw(SourceException)
    {
        //variables
        ifstream sourceFile;
        FileBuffer *sourceBuffer = nullptr;
        size_t sourceFileSize = 0;

        //vérification de l'existence du fichier
        if (!exists(sourceFilePath))
        {
            throw SourceException(tr("Le fichier source \"%0\" n'existe pas.", sourceFilePath.native()));
        }

        //taille du fichier
        sourceFileSize = file_size(sourceFilePath);

        //ouverture du fichier
        sourceFile.open(sourceFilePath.c_str(), ios::in);
        if (sourceFile.is_open())
        {
            //allocation d'un buffer
            sourceBuffer = new FileBuffer(sourceFileSize);

            //récupération des données dans le fichier source
            sourceFile.read(sourceBuffer->getBufferPtr(), sourceBuffer->getBufferSize());
            if (sourceFile.bad())
            {
                throw SourceException(tr("La lecture du fichier source \"%0\" a échoué.", sourceFilePath.native()));
            }

            //fermeture du fichier
            sourceFile.close();

            //parsage des données
            _sourceParser.parseSource(sourceFilePath.native(), sourceBuffer, sourceLanguage);

            //déallocation du buffer
            delete sourceBuffer;
        }
        else
        {
            //traitement des erreurs
            throw SourceException(tr("La lecture du fichier source \"%0\" a échoué.", sourceFilePath.native()));
        }
    }
开发者ID:hasardel,项目名称:aye-aye,代码行数:45,代码来源:Source.cpp

示例6: __equivalent

bool __equivalent(const path& p1, const path& p2, std::error_code *ec)
{
    auto make_unsupported_error = [&]() {
      set_or_throw(make_error_code(errc::not_supported), ec,
                     "equivalent", p1, p2);
      return false;
    };
    std::error_code ec1, ec2;
    struct ::stat st1 = {};
    struct ::stat st2 = {};
    auto s1 = detail::posix_stat(p1.native(), st1, &ec1);
    if (!exists(s1))
      return make_unsupported_error();
    auto s2 = detail::posix_stat(p2.native(), st2, &ec2);
    if (!exists(s2))
      return make_unsupported_error();
    if (ec) ec->clear();
    return detail::stat_equivalent(st1, st2);
}
开发者ID:Xiaodingdangguaiguai,项目名称:catboost,代码行数:19,代码来源:operations.cpp

示例7: prepend

    void prepend(path fname, std::vector<uint8_t> const& prepend_data)
    {
        using namespace boost::iostreams;
        auto size    = file_size(fname);
        auto resized = size + prepend_data.size();

        resize_file(fname, resized);
        mapped_file mf(fname.native().c_str());

        std::rotate(mf.data(), mf.data() + size, mf.data() + resized);
        std::copy(prepend_data.begin(), prepend_data.end(), mf.data());
    }
开发者ID:CCJY,项目名称:coliru,代码行数:12,代码来源:main.cpp

示例8: copy_file_transact

void copy_file_transact(const path& from, const path& to)
{
	path t = to.native() + ".deleteme";
	SCOPE_FAIL{
		cout << "Scope Fail" << endl;
	::remove(t.c_str());
	};

	copy_file(from, t);
	rename(t, to);
	throw 1;
}
开发者ID:kodojong,项目名称:C11-STL-boost,代码行数:12,代码来源:1_스마트포인터12.cpp

示例9: LoadFileAsString

    std::string LoadFileAsString(const path &relpath)
    {
        const path abspath = GetResourceAbspath(relpath);

        std::ifstream input;
        input.open(abspath.native());
        if (!input.is_open())
        {
            throw std::runtime_error("Cannot open for reading: " + abspath.generic_string());
        }

        std::string text;
        text.reserve(FILE_RESERVE_SIZE);
        input.exceptions(std::ios::badbit);

        std::string line;
        while (std::getline(input, line))
        {
            text.append(line);
            text.append("\n");
        }

        return text;
    }
开发者ID:ps-group,项目名称:cg_course_examples,代码行数:24,代码来源:AssetLoader.cpp

示例10: compare

 int path::compare(const path& p) const noexcept
 {
   return native() < p.native();
 }
开发者ID:daniel-varela,项目名称:OTTO,代码行数:4,代码来源:filesystem.cpp


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