41 io.
Save( aFilename, &board );
52 return std::unique_ptr<BOARD_ITEM>( parser.
Parse() );
66 std::unique_ptr<BOARD_ITEM> board;
70 board.reset( parser.
Parse() );
80 const std::string& aFilename, std::istream& aFallback )
82 std::istream* in_stream =
nullptr;
83 std::ifstream file_stream;
85 if( aFilename.empty() )
88 in_stream = &aFallback;
92 file_stream.open( aFilename );
93 in_stream = &file_stream;
96 return ReadItemFromStream<BOARD>( *in_stream );
A PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
Read a Pcbnew s-expression formatted LINE_READER object and returns the appropriate BOARD_ITEM object...
std::unique_ptr< BOARD_ITEM > ReadBoardItemFromStream(std::istream &aStream)
Utility function to read a BOARD_ITEM (probably a FOOTPRINT or a BOARD) from a file.
std::unique_ptr< BOARD_ITEM > ReadBoardItemFromFile(const std::string &aFilename)
A LINE_READER that reads from an open file.
void SetStream(std::istream &aStream)
Set the stream for this line reader.
LINE_READER that wraps a given std::istream instance.
void DumpBoardToFile(BOARD &board, const std::string &aFilename)
Utility function to simply write a Board out to a file.
LINE_READER * SetLineReader(LINE_READER *aReader)
Set aLineReader into the parser, and returns the previous one, if any.
Information pertinent to a Pcbnew printed circuit board.
virtual void Save(const wxString &aFileName, BOARD *aBoard, const PROPERTIES *aProperties=nullptr) override
Write aBoard to a storage file in a format that this PLUGIN implementation knows about or it can be u...
Pcbnew s-expression file format parser definition.
General utilities for PCB file IO for QA programs.
std::unique_ptr< BOARD > ReadBoardFromFileOrStream(const std::string &aFilename, std::istream &aFallback)
Read a board from a file, or another stream, as appropriate.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.