Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
0fb4954f
Commit
0fb4954f
authored
Dec 02, 2011
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix comments, add IO_MGR::Save()
parent
086c8dec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
7 deletions
+35
-7
io_mgr.cpp
pcbnew/io_mgr.cpp
+22
-3
io_mgr.h
pcbnew/io_mgr.h
+13
-4
No files found.
pcbnew/io_mgr.cpp
View file @
0fb4954f
...
@@ -100,6 +100,25 @@ BOARD* IO_MGR::Load( PCB_FILE_T aFileType, const wxString& aFileName,
...
@@ -100,6 +100,25 @@ BOARD* IO_MGR::Load( PCB_FILE_T aFileType, const wxString& aFileName,
}
}
void
IO_MGR
::
Save
(
PCB_FILE_T
aFileType
,
const
wxString
&
aFileName
,
BOARD
*
aBoard
,
PROPERTIES
*
aProperties
)
{
// release the PLUGIN even if an exception is thrown.
PLUGIN
::
RELEASER
pi
=
PluginFind
(
aFileType
);
if
(
(
PLUGIN
*
)
pi
)
// test pi->plugin
{
pi
->
Save
(
aFileName
,
aBoard
,
aProperties
);
// virtual
return
;
}
wxString
msg
;
msg
.
Printf
(
_
(
"Plugin type '%s' is not found."
),
ShowType
(
aFileType
).
GetData
()
);
THROW_IO_ERROR
(
msg
);
}
BOARD
*
PLUGIN
::
Load
(
const
wxString
&
aFileName
,
BOARD
*
aAppendToMe
,
PROPERTIES
*
aProperties
)
BOARD
*
PLUGIN
::
Load
(
const
wxString
&
aFileName
,
BOARD
*
aAppendToMe
,
PROPERTIES
*
aProperties
)
{
{
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface,
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface,
...
@@ -107,21 +126,21 @@ BOARD* PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES*
...
@@ -107,21 +126,21 @@ BOARD* PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES*
wxString
msg
;
wxString
msg
;
msg
.
Printf
(
_
(
"Plugin %s does not implement the BOARD Load() function.
\n
"
),
msg
.
Printf
(
_
(
"Plugin %s does not implement the BOARD Load() function."
),
PluginName
().
GetData
()
);
PluginName
().
GetData
()
);
THROW_IO_ERROR
(
msg
);
THROW_IO_ERROR
(
msg
);
}
}
void
PLUGIN
::
Save
(
const
wxString
*
aFileName
,
BOARD
*
aBoard
,
PROPERTIES
*
aProperties
)
void
PLUGIN
::
Save
(
const
wxString
&
aFileName
,
BOARD
*
aBoard
,
PROPERTIES
*
aProperties
)
{
{
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface,
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface,
// e.g. Load() or Save() but not both.
// e.g. Load() or Save() but not both.
wxString
msg
;
wxString
msg
;
msg
.
Printf
(
_
(
"Plugin %s does not implement the BOARD Save() function.
\n
"
),
msg
.
Printf
(
_
(
"Plugin %s does not implement the BOARD Save() function."
),
PluginName
().
GetData
()
);
PluginName
().
GetData
()
);
THROW_IO_ERROR
(
msg
);
THROW_IO_ERROR
(
msg
);
...
...
pcbnew/io_mgr.h
View file @
0fb4954f
...
@@ -116,21 +116,27 @@ public:
...
@@ -116,21 +116,27 @@ public:
/**
/**
* Function Save
* Function Save
* will write a full aBoard to a storage file in a format that this
* will write
either
a full aBoard to a storage file in a format that this
* implementation knows about, or it can be used to write a portion of
* implementation knows about, or it can be used to write a portion of
* aBoard to a special kind of export file.
* aBoard to a special kind of export file.
*
*
* @param aFileName is the name of a file to save to on disk.
* @param aFileName is the name of a file to save to on disk.
* @param aBoard is the BOARD document (data tree) to save or export to disk.
* @param aBoard is the BOARD document (data tree) to save or export to disk.
*
*
* @param aBoard is the in memory document tree from which to extract information
* when writing to \a aFileName. The caller continues to own the BOARD, and
* the plugin should refrain from modifying the BOARD if possible.
*
* @param aProperties is an associative array that can be used to tell the
* @param aProperties is an associative array that can be used to tell the
* saver how to save the file, because it can take any number of
* saver how to save the file, because it can take any number of
* additional named tuning arguments that the plugin is known to support.
* additional named tuning arguments that the plugin is known to support.
* The caller continues to own this object (plugin may not delete it), and
* plugins should expect it to be optionally NULL.
*
*
* @throw IO_ERROR if there is a problem saving or exporting.
* @throw IO_ERROR if there is a problem saving or exporting.
*/
*/
static
void
Save
(
PCB_FILE_T
aFileType
,
const
wxString
&
aFileName
,
static
void
Save
(
PCB_FILE_T
aFileType
,
const
wxString
&
aFileName
,
PROPERTIES
*
aProperties
=
NULL
);
BOARD
*
aBoard
,
PROPERTIES
*
aProperties
=
NULL
);
};
};
...
@@ -237,7 +243,10 @@ public:
...
@@ -237,7 +243,10 @@ public:
* aBoard to a special kind of export file.
* aBoard to a special kind of export file.
*
*
* @param aFileName is the name of a file to save to on disk.
* @param aFileName is the name of a file to save to on disk.
* @param aBoard is the BOARD document (data tree) to save or export to disk.
*
* @param aBoard is the class BOARD in memory document tree from which to
* extract information when writing to \a aFileName. The caller continues to
* own the BOARD, and the plugin should refrain from modifying the BOARD if possible.
*
*
* @param aProperties is an associative array that can be used to tell the
* @param aProperties is an associative array that can be used to tell the
* saver how to save the file, because it can take any number of
* saver how to save the file, because it can take any number of
...
@@ -247,7 +256,7 @@ public:
...
@@ -247,7 +256,7 @@ public:
*
*
* @throw IO_ERROR if there is a problem saving or exporting.
* @throw IO_ERROR if there is a problem saving or exporting.
*/
*/
virtual
void
Save
(
const
wxString
*
aFileName
,
BOARD
*
aBoard
,
virtual
void
Save
(
const
wxString
&
aFileName
,
BOARD
*
aBoard
,
PROPERTIES
*
aProperties
=
NULL
);
PROPERTIES
*
aProperties
=
NULL
);
//-----</PUBLIC PLUGIN API>------------------------------------------------
//-----</PUBLIC PLUGIN API>------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment