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 
39 #include <tool/selection.h>
40 
42 {
43 public:
44  CLIPBOARD_PARSER( LINE_READER* aReader = NULL ): PCB_PARSER( aReader ) {};
45 
46  MODULE* parseMODULE( wxArrayString* aInitialComments )
47  {
48  MODULE* mod = PCB_PARSER::parseMODULE( aInitialComments );
49 
50  //TODO: figure out better way of handling paths
51  mod->SetPath( wxT( "" ) );
52  return mod;
53  }
54 };
55 
56 class CLIPBOARD_IO : public PCB_IO
57 {
58 
59 public:
60  /* Saves the entire board to the clipboard formatted using the PCB_IO formatting */
61  void Save( const wxString& aFileName, BOARD* aBoard,
62  const PROPERTIES* aProperties = NULL ) override;
63  /* Writes all the settings of the BOARD* set by setBoard() and then adds all
64  * the BOARD_ITEM* found in selection formatted by PCB_IO to clipboard as a text
65  */
66  void SaveSelection( const SELECTION& selected );
67 
68  BOARD_ITEM* Parse();
69 
70  BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPERTIES* aProperties = NULL ) override;
71  CLIPBOARD_IO();
72  ~CLIPBOARD_IO();
73 
74  void SetBoard( BOARD* aBoard );
75  STRING_FORMATTER* GetFormatter();
76 
77 private:
78  void writeHeader( BOARD* aBoard );
79 
82 };
83 
84 
85 #endif /* KICAD_CLIPBOARD_H */
Class LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived...
Definition: richio.h:81
Class PCB_IO is a PLUGIN derivation for saving and loading Pcbnew s-expression formatted files...
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
Class PCB_PARSER reads a Pcbnew s-expression formatted LINE_READER object and returns the appropriate...
Definition: pcb_parser.h:65
Classes BOARD_ITEM and BOARD_CONNECTED_ITEM.
STRING_FORMATTER m_formatter
Class PROPERTIES is a name/value tuple with unique names and optional values.
Definition: properties.h:34
static struct PcbQueue * Save
Definition: queue.cpp:56
void SetBoard(BOARD *aBoard)
Definition: pcb_parser.h:300
BOARD_ITEM * Parse()
Definition: pcb_parser.cpp:442
MODULE * parseMODULE(wxArrayString *aInitialComments)
CLIPBOARD_PARSER * m_parser
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
CLIPBOARD_PARSER(LINE_READER *aReader=NULL)
KICAD_PLUGIN_EXPORT SCENEGRAPH * Load(char const *aFileName)
reads a model file and creates a generic display structure
Pcbnew s-expression file format parser definition.
Module description (excepted pads)
MODULE * parseMODULE(wxArrayString *aInitialComments=0)
Function parseMODULE.
Class STRING_FORMATTER implements OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:445
#define mod(a, n)
Definition: greymap.cpp:24
void SetPath(const wxString &aPath)
Definition: class_module.h:203