23#ifndef VCL_LOAD_SAVE_FORMATS_H
24#define VCL_LOAD_SAVE_FORMATS_H
26#include <vclib/exceptions/io.h>
27#include <vclib/io/file_format.h>
31constexpr FileFormat objFileFormat()
33 return FileFormat(
"obj",
"OBJ Wavefront .obj");
36constexpr FileFormat offFileFormat()
38 return FileFormat(
"off",
"OFF Object File Format .off");
41constexpr FileFormat plyFileFormat()
43 return FileFormat(
"ply",
"PLY Polygon File Format .ply");
46constexpr FileFormat stlFileFormat()
48 return FileFormat(
"stl",
"STL Stereolithography .stl");
51inline FileFormat fileFormat(
const std::string& format)
53 std::string ext = toLower(format);
55 return objFileFormat();
57 else if (ext ==
"off") {
58 return offFileFormat();
60 else if (ext ==
"ply") {
61 return plyFileFormat();
63 else if (ext ==
"stl") {
64 return stlFileFormat();
67 throw UnknownFileFormatException(ext);