Start
save
#include "dxfio/save.hpp"In DxfIO
Functions
auto Save(const Document &drawing, const Options &with = {}) -> std::expected<Saved, Failure>Writes a drawing as the bytes of a DXF file.
auto Save(const Document &drawing, std::ostream &to, const Options &with = {}) -> std::expected<std::vector<Issue>, Failure>Writes a drawing to a stream.
auto SaveFile(const Document &drawing, const std::filesystem::path &file, const Options &with = {}) -> std::expected<std::vector<Issue>, Failure>Writes a drawing to a file, replacing it.
struct Options
How a drawing is written.
| Field | Type and default | Meaning |
|---|---|---|
Release | Version{Version::R2018} | The release to write. A drawing of a newer release is narrowed to it, and what it cannot hold is noted. |
Codepage | std::string | The code page for text before R2007, such as "ANSI_1252"; empty keeps the drawing's $DWGCODEPAGE. A name no code page has makes Save fail. |
Binary | bool | Writes binary DXF instead of ASCII. |
struct Saved
A drawing written as DXF, with what the writer had to note about it.
| Field | Type | Meaning |
|---|---|---|
Bytes | std::string | The bytes of the file. |
Issues | std::vector<Issue> | What the release asked for could not hold, and how it was kept or left out. |