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
b3fd1b81
Commit
b3fd1b81
authored
Jan 22, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copyright change and new TYPE_COLLECTOR class
parent
324fd9ac
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
2 deletions
+73
-2
collectors.cpp
pcbnew/collectors.cpp
+21
-1
collectors.h
pcbnew/collectors.h
+52
-1
No files found.
pcbnew/collectors.cpp
View file @
b3fd1b81
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2007
Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2007
-2008 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2004-2007 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -365,4 +365,24 @@ void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, const KICAD_T aScanList[],
}
// see collectors.h
SEARCH_RESULT
TYPE_COLLECTOR
::
Inspect
(
EDA_BaseStruct
*
testItem
,
const
void
*
testData
)
{
// The Vist() function only visits the testItem if its type was in the
// the scanList, so therefore we can collect anything given to us here.
Append
(
testItem
);
return
SEARCH_CONTINUE
;
// always when collecting
}
void
TYPE_COLLECTOR
::
Collect
(
BOARD_ITEM
*
aBoard
,
const
KICAD_T
aScanList
[]
)
{
Empty
();
// empty any existing collection
// visit the board with the INSPECTOR (me).
aBoard
->
Visit
(
this
,
// INSPECTOR* inspector
NULL
,
// const void* testData,
aScanList
);
}
//EOF
pcbnew/collectors.h
View file @
b3fd1b81
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2007
Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2007
-2008 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2004-2007 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -500,4 +500,55 @@ public:
void
SetIgnoreModulesOnCmp
(
bool
ignore
)
{
m_IgnoreModulesOnCmp
=
ignore
;
}
};
/**
* Class TYPE_COLLECTOR
* merely gathers up all BOARD_ITEMs of a given set of KICAD_T type(s).
* @see class COLLECTOR
*/
class
TYPE_COLLECTOR
:
public
COLLECTOR
{
public
:
/**
* Function operator[int]
* overloads COLLECTOR::operator[](int) to return a BOARD_ITEM* instead of
* an EDA_BaseStruct* type.
* @param ndx The index into the list.
* @return BOARD_ITEM* - or something derived from it, or NULL.
*/
BOARD_ITEM
*
operator
[](
int
ndx
)
const
{
if
(
(
unsigned
)
ndx
<
(
unsigned
)
GetCount
()
)
return
(
BOARD_ITEM
*
)
m_List
[
ndx
];
return
NULL
;
}
/**
* Function Inspect
* is the examining function within the INSPECTOR which is passed to the
* Iterate function.
*
* @param testItem An EDA_BaseStruct to examine.
* @param testData is not used in this class.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
*/
SEARCH_RESULT
Inspect
(
EDA_BaseStruct
*
testItem
,
const
void
*
testData
);
/**
* Function Collect
* scans a BOARD_ITEM using this class's Inspector method, which does
* the collection.
* @param aBoard The BOARD_ITEM to scan.
* @param aScanList The KICAD_Ts to gather up.
*/
void
Collect
(
BOARD_ITEM
*
aBoard
,
const
KICAD_T
aScanList
[]
);
};
#endif // COLLECTORS_H
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