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
dda28ed6
Commit
dda28ed6
authored
Aug 06, 2007
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more new search stuff, beautification
parent
6f7209aa
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
247 additions
and
229 deletions
+247
-229
base_struct.cpp
common/base_struct.cpp
+2
-2
base_struct.h
include/base_struct.h
+16
-13
class_board.cpp
pcbnew/class_board.cpp
+3
-3
class_module.cpp
pcbnew/class_module.cpp
+1
-1
class_module.h
pcbnew/class_module.h
+1
-1
classpcb.cpp
pcbnew/classpcb.cpp
+224
-209
No files found.
common/base_struct.cpp
View file @
dda28ed6
...
@@ -231,7 +231,7 @@ std::ostream& EDA_BaseStruct::NestedSpace( int nestLevel, std::ostream& os )
...
@@ -231,7 +231,7 @@ std::ostream& EDA_BaseStruct::NestedSpace( int nestLevel, std::ostream& os )
// see base_struct.h
// see base_struct.h
SEARCH_RESULT
EDA_BaseStruct
::
IterateForward
(
EDA_BaseStruct
*
listStart
,
SEARCH_RESULT
EDA_BaseStruct
::
IterateForward
(
EDA_BaseStruct
*
listStart
,
INSPECTOR
*
inspector
,
void
*
testData
,
const
KICAD_T
scanTypes
[]
)
INSPECTOR
*
inspector
,
const
void
*
testData
,
const
KICAD_T
scanTypes
[]
)
{
{
EDA_BaseStruct
*
p
=
listStart
;
EDA_BaseStruct
*
p
=
listStart
;
for
(
;
p
;
p
=
p
->
Pnext
)
for
(
;
p
;
p
=
p
->
Pnext
)
...
@@ -245,7 +245,7 @@ SEARCH_RESULT EDA_BaseStruct::IterateForward( EDA_BaseStruct* listStart,
...
@@ -245,7 +245,7 @@ SEARCH_RESULT EDA_BaseStruct::IterateForward( EDA_BaseStruct* listStart,
// see base_struct.h
// see base_struct.h
SEARCH_RESULT
EDA_BaseStruct
::
Traverse
(
INSPECTOR
*
inspector
,
void
*
testData
,
SEARCH_RESULT
EDA_BaseStruct
::
Traverse
(
INSPECTOR
*
inspector
,
const
void
*
testData
,
const
KICAD_T
scanTypes
[]
)
const
KICAD_T
scanTypes
[]
)
{
{
KICAD_T
stype
;
KICAD_T
stype
;
...
...
include/base_struct.h
View file @
dda28ed6
...
@@ -88,7 +88,7 @@ class EDA_BaseStruct;
...
@@ -88,7 +88,7 @@ class EDA_BaseStruct;
* Class INSPECTOR
* Class INSPECTOR
* is an abstract class that is used to inspect and possibly collect the
* is an abstract class that is used to inspect and possibly collect the
* (search) results of Iterating over a list or tree of KICAD_T objects.
* (search) results of Iterating over a list or tree of KICAD_T objects.
* Extend from this class and implment the Inspect function and provide for
* Extend from this class and impl
e
ment the Inspect function and provide for
* a way for the extension to collect the results of the search/scan data and
* a way for the extension to collect the results of the search/scan data and
* provide them to the caller.
* provide them to the caller.
*/
*/
...
@@ -99,15 +99,18 @@ public:
...
@@ -99,15 +99,18 @@ public:
/**
/**
* Function Inspect
* Function Inspect
* is the function type that can be passed to the Iterate function,
* is the examining function within the INSPECTOR which is passed to the
* used primarily for searching, but not exclusively.
* Iterate function. It is used primarily for searching, but not limited to
* that. It can also collect or modify the scanned objects.
*
* @param testItem An EDA_BaseStruct to examine.
* @param testData is arbitrary data needed by the inspector to determine
* @param testData is arbitrary data needed by the inspector to determine
* if the EDA_BaseStruct under test meets its match criteria.
* if the EDA_BaseStruct under test meets its match criteria.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
* else SCAN_CONTINUE;
*/
*/
SEARCH_RESULT
virtual
Inspect
(
EDA_BaseStruct
*
testItem
,
SEARCH_RESULT
virtual
Inspect
(
EDA_BaseStruct
*
testItem
,
void
*
testData
)
=
0
;
const
void
*
testData
)
=
0
;
// derived classes add more functions for collecting and subsequent
// derived classes add more functions for collecting and subsequent
// retrieval here.
// retrieval here.
...
@@ -199,27 +202,27 @@ public:
...
@@ -199,27 +202,27 @@ public:
/**
/**
* Function IterateForward
* Function IterateForward
* walks through the object tree calling the testFunc on each object
* walks through the object tree calling the testFunc on each object
* type requested in s
truct
Types.
* type requested in s
can
Types.
*
*
* @param listStart The first in a list of EDA_BaseStructs to iterate over.
* @param listStart The first in a list of EDA_BaseStructs to iterate over.
* @param inspector Is an INSPECTOR to call on each object that is o
f o
ne of
* @param inspector Is an INSPECTOR to call on each object that is one of
* the requested
item
Types.
* the requested
scan
Types.
* @param testData Is an aid to testFunc, and should be sufficient to
* @param testData Is an aid to testFunc, and should be sufficient to
* allow it to fully determine if an item meets the match criteria, but it
* allow it to fully determine if an item meets the match criteria, but it
* may also be used to collect output.
* may also be used to collect output.
* @param scanTypes
Is a char array of KICAD_T
that is EOT
* @param scanTypes
A KICAD_T array
that is EOT
* terminated, and provides both the order and interest level of of
* terminated, and provides both the order and interest level of of
* the types of objects to be iterated over.
* the types of objects to be iterated over.
* @return SEARCH_RESULT - SEARCH_QUIT if the
Iterator is to stop the scan,
* @return SEARCH_RESULT - SEARCH_QUIT if the
called INSPECTOR returned
* else SCAN_CONTINUE;
*
SEARCH_QUIT,
else SCAN_CONTINUE;
*/
*/
static
SEARCH_RESULT
IterateForward
(
EDA_BaseStruct
*
listStart
,
static
SEARCH_RESULT
IterateForward
(
EDA_BaseStruct
*
listStart
,
INSPECTOR
*
inspector
,
void
*
testData
,
const
KICAD_T
scanTypes
[]
);
INSPECTOR
*
inspector
,
const
void
*
testData
,
const
KICAD_T
scanTypes
[]
);
/**
/**
* Function Traverse
* Function Traverse
* should be re-implemented for each der
r
ived class in order to handle
* should be re-implemented for each derived class in order to handle
* all the types given by its member data. Implementations should call
* all the types given by its member data. Implementations should call
* inspector->Inspect() on types in scanTypes[], and may use IterateForward()
* inspector->Inspect() on types in scanTypes[], and may use IterateForward()
* to do so on lists of such data.
* to do so on lists of such data.
...
@@ -230,7 +233,7 @@ public:
...
@@ -230,7 +233,7 @@ public:
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
* else SCAN_CONTINUE;
*/
*/
virtual
SEARCH_RESULT
Traverse
(
INSPECTOR
*
inspector
,
void
*
testData
,
virtual
SEARCH_RESULT
Traverse
(
INSPECTOR
*
inspector
,
const
void
*
testData
,
const
KICAD_T
scanTypes
[]
);
const
KICAD_T
scanTypes
[]
);
...
...
pcbnew/class_board.cpp
View file @
dda28ed6
...
@@ -300,7 +300,7 @@ public:
...
@@ -300,7 +300,7 @@ public:
{
{
}
}
SEARCH_RESULT
Inspect
(
EDA_BaseStruct
*
testItem
,
void
*
testData
)
SEARCH_RESULT
Inspect
(
EDA_BaseStruct
*
testItem
,
const
void
*
testData
)
{
{
const
wxPoint
*
refPos
=
(
const
wxPoint
*
)
testData
;
const
wxPoint
*
refPos
=
(
const
wxPoint
*
)
testData
;
...
@@ -336,9 +336,9 @@ EDA_BaseStruct* BOARD::FindModuleOrPad( const wxPoint& refPos )
...
@@ -336,9 +336,9 @@ EDA_BaseStruct* BOARD::FindModuleOrPad( const wxPoint& refPos )
{
{
ModuleOrPad
inspector
;
ModuleOrPad
inspector
;
static
const
KICAD_T
scanTypes
[]
=
{
TYPE
MODULE
,
TYPEPAD
,
EOT
};
static
const
KICAD_T
scanTypes
[]
=
{
TYPE
PAD
,
TYPEMODULE
,
EOT
};
if
(
SEARCH_QUIT
==
IterateForward
(
m_Modules
,
&
inspector
,
(
void
*
)
&
refPos
,
scanTypes
)
)
if
(
SEARCH_QUIT
==
IterateForward
(
m_Modules
,
&
inspector
,
&
refPos
,
scanTypes
)
)
return
inspector
.
found
;
return
inspector
.
found
;
return
NULL
;
return
NULL
;
...
...
pcbnew/class_module.cpp
View file @
dda28ed6
...
@@ -1188,7 +1188,7 @@ void MODULE::Show( int nestLevel, std::ostream& os )
...
@@ -1188,7 +1188,7 @@ void MODULE::Show( int nestLevel, std::ostream& os )
// see class_module.h
// see class_module.h
SEARCH_RESULT
MODULE
::
Traverse
(
INSPECTOR
*
inspector
,
void
*
testData
,
SEARCH_RESULT
MODULE
::
Traverse
(
INSPECTOR
*
inspector
,
const
void
*
testData
,
const
KICAD_T
scanTypes
[]
)
const
KICAD_T
scanTypes
[]
)
{
{
KICAD_T
stype
;
KICAD_T
stype
;
...
...
pcbnew/class_module.h
View file @
dda28ed6
...
@@ -157,7 +157,7 @@ public:
...
@@ -157,7 +157,7 @@ public:
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
* else SCAN_CONTINUE;
*/
*/
virtual
SEARCH_RESULT
Traverse
(
INSPECTOR
*
inspector
,
void
*
testData
,
virtual
SEARCH_RESULT
Traverse
(
INSPECTOR
*
inspector
,
const
void
*
testData
,
const
KICAD_T
scanTypes
[]
);
const
KICAD_T
scanTypes
[]
);
#endif
#endif
...
...
pcbnew/classpcb.cpp
View file @
dda28ed6
This diff is collapsed.
Click to expand it.
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