/
niceSOFT
/
swig
Обзор
Документация
Войти
/
niceSOFT
/
swig
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Examples/test-suite/cpp17_std_filesystem.i
65 строк
2 KB
William S Fulton
Add forward class definition for std::filesystem::path class
19 авг 2024, 20:33
19 авг 2024, 20:33
5ac5d90
Код
Авторство
О чём код?
%module cpp17_std_filesystem %include <std_string.i> %include <std_filesystem.i> %{ #include <filesystem> %} %inline %{ /* Test the "out" typemap for std::filesystem::path */ std::filesystem::path makePath(const std::string& s) { return std::filesystem::path(s); } /** * There is no "out" typemap for a pointer to a path, so * this should return a wrapped instance of a path * instead of the native path type for the target language. */ std::filesystem::path * makePathPtr(const std::string& s) { static std::filesystem::path p(s); return &p; } /** * There is no "out" typemap for a non-const reference to a path, so * this should return a wrapped instance of a std::filesystem::path instead of * the native path type for the target language. */ std::filesystem::path& makePathRef(const std::string& s) { static std::filesystem::path p(s); return p; } /** * There is no "out" typemap for a const reference to a path, so * this should return a wrapped instance of a std::filesystem::path * instead of the native path type for the target language. */ const std::filesystem::path & makePathConstRef(const std::string & s) { static std::filesystem::path p(s); return p; } /* Test the "in" typemap for std::filesystem::path */ std::string pathToStr(std::filesystem::path p) { return p.string(); } /* Test the "in" typemap for const std::filesystem::path & */ std::string pathConstRefToStr(const std::filesystem::path & p) { return p.string(); } /* Test the "in" typemap for const std::filesystem::path * */ std::string pathPtrToStr(const std::filesystem::path * p) { return p->string(); } namespace stdfs = std::filesystem; std::filesystem::path roundTrip(const stdfs::path& p) { return p; } %}