KiCad PCB EDA Suite
kicad_clipboard.h
Go to the documentation of this file.
1 
30 #ifndef KICAD_CLIPBOARD_H
31 #define KICAD_CLIPBOARD_H
32 
33 #include <kicad_plugin.h>
34 #include <class_board_item.h>
35 #include <class_module.h>
36 #include <pcb_parser.h>
37 #include <memory.h>
38 #include <tools/pcbnew_selection.h>
39 
41 {
42 public:
43  CLIPBOARD_PARSER( LINE_READER* aReader = NULL ): PCB_PARSER( aReader ) {};
44 
45  MODULE* parseMODULE( wxArrayString* aInitialComments )
46  {
47  return PCB_PARSER::parseMODULE( aInitialComments );
48  }
49 };
50 
51 class CLIPBOARD_IO : public PCB_IO
52 {
53 
54 public:
55  /* Saves the entire board to the clipboard formatted using the PCB_IO formatting */
56  void Save( const wxString& aFileName, BOARD* aBoard,
57  const PROPERTIES* aProperties = NULL ) override;
58  /* Writes all the settings of the BOARD* set by setBoard() and then adds all
59  * the BOARD_ITEM* found in selection formatted by PCB_IO to clipboard as a text
60  */
61  void SaveSelection( const PCBNEW_SELECTION& selected );
62 
63  BOARD_ITEM* Parse();
64 
65  BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPERTIES* aProperties = NULL ) override;
66  CLIPBOARD_IO();
67  ~CLIPBOARD_IO();
68 
69  void SetBoard( BOARD* aBoard );
71 
72 private:
73  void writeHeader( BOARD* aBoard );
74 
77 };
78 
79 
80 #endif /* KICAD_CLIPBOARD_H */
BOARD * Load(const wxString &aFileName, BOARD *aAppendToMe, const PROPERTIES *aProperties=NULL) override
Function Load loads information from some input file format that this PLUGIN implementation knows abo...
BOARD_ITEM * Parse()
STRING_FORMATTER * GetFormatter()
LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived to re...
Definition: richio.h:81
PCB_IO is a PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
PCB_PARSER reads a Pcbnew s-expression formatted LINE_READER object and returns the appropriate BOARD...
Definition: pcb_parser.h:69
Classes BOARD_ITEM and BOARD_CONNECTED_ITEM.
STRING_FORMATTER m_formatter
PROPERTIES is a name/value tuple with unique names and optional values.
Definition: properties.h:34
void SetBoard(BOARD *aBoard)
#define NULL
void Save(const wxString &aFileName, BOARD *aBoard, const PROPERTIES *aProperties=NULL) override
Function Save will write aBoard to a storage file in a format that this PLUGIN implementation knows a...
MODULE * parseMODULE(wxArrayString *aInitialComments)
CLIPBOARD_PARSER * m_parser
void SaveSelection(const PCBNEW_SELECTION &selected)
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:181
CLIPBOARD_PARSER(LINE_READER *aReader=NULL)
void writeHeader(BOARD *aBoard)
Pcbnew s-expression file format parser definition.
MODULE * parseMODULE(wxArrayString *aInitialComments=0)
Function parseMODULE.
STRING_FORMATTER implements OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:445