本文整理汇总了C++中LIB_PART::GetLib方法的典型用法代码示例。如果您正苦于以下问题:C++ LIB_PART::GetLib方法的具体用法?C++ LIB_PART::GetLib怎么用?C++ LIB_PART::GetLib使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LIB_PART
的用法示例。
在下文中一共展示了LIB_PART::GetLib方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeComponents
XNODE* NETLIST_EXPORTER_GENERIC::makeComponents()
{
XNODE* xcomps = node( wxT( "components" ) );
wxString timeStamp;
// some strings we need many times, but don't want to construct more
// than once for performance. These are used within loops so the
// enclosing wxString constructor would fire on each loop iteration if
// they were in a nested scope.
// these are actually constructor invocations, not assignments as it appears:
wxString sFields = wxT( "fields" );
wxString sField = wxT( "field" );
wxString sComponent = wxT( "comp" ); // use "part" ?
wxString sName = wxT( "name" );
wxString sRef = wxT( "ref" );
wxString sPins = wxT( "pins" );
wxString sPin = wxT( "pin" );
wxString sValue = wxT( "value" );
wxString sSheetPath = wxT( "sheetpath" );
wxString sFootprint = wxT( "footprint" );
wxString sDatasheet = wxT( "datasheet" );
wxString sTStamp = wxT( "tstamp" );
wxString sTStamps = wxT( "tstamps" );
wxString sTSFmt = wxT( "%8.8lX" ); // comp->m_TimeStamp
wxString sLibSource = wxT( "libsource" );
wxString sLibPart = wxT( "libpart" );
wxString sLib = wxT( "lib" );
wxString sPart = wxT( "part" );
wxString sNames = wxT( "names" );
m_ReferencesAlreadyFound.Clear();
SCH_SHEET_LIST sheetList( g_RootSheet );
// Output is xml, so there is no reason to remove spaces from the field values.
// And XML element names need not be translated to various languages.
for( unsigned i = 0; i < sheetList.size(); i++ )
{
for( EDA_ITEM* schItem = sheetList[i].LastDrawList(); schItem; schItem = schItem->Next() )
{
SCH_COMPONENT* comp = findNextComponentAndCreatePinList( schItem, &sheetList[i] );
if( !comp )
break; // No component left
schItem = comp;
XNODE* xcomp; // current component being constructed
// Output the component's elements in order of expected access frequency.
// This may not always look best, but it will allow faster execution
// under XSL processing systems which do sequential searching within
// an element.
xcomps->AddChild( xcomp = node( sComponent ) );
xcomp->AddAttribute( sRef, comp->GetRef( &sheetList[i] ) );
xcomp->AddChild( node( sValue, comp->GetField( VALUE )->GetText() ) );
if( !comp->GetField( FOOTPRINT )->IsVoid() )
xcomp->AddChild( node( sFootprint, comp->GetField( FOOTPRINT )->GetText() ) );
if( !comp->GetField( DATASHEET )->IsVoid() )
xcomp->AddChild( node( sDatasheet, comp->GetField( DATASHEET )->GetText() ) );
// Export all user defined fields within the component,
// which start at field index MANDATORY_FIELDS. Only output the <fields>
// container element if there are any <field>s.
if( comp->GetFieldCount() > MANDATORY_FIELDS )
{
XNODE* xfields;
xcomp->AddChild( xfields = node( sFields ) );
for( int fldNdx = MANDATORY_FIELDS; fldNdx < comp->GetFieldCount(); ++fldNdx )
{
SCH_FIELD* f = comp->GetField( fldNdx );
// only output a field if non empty and not just "~"
if( !f->IsVoid() )
{
XNODE* xfield;
xfields->AddChild( xfield = node( sField, f->GetText() ) );
xfield->AddAttribute( sName, f->GetName() );
}
}
}
XNODE* xlibsource;
xcomp->AddChild( xlibsource = node( sLibSource ) );
// "logical" library name, which is in anticipation of a better search
// algorithm for parts based on "logical_lib.part" and where logical_lib
// is merely the library name minus path and extension.
LIB_PART* part = m_libs->FindLibPart( comp->GetLibId() );
if( part )
xlibsource->AddAttribute( sLib, part->GetLib()->GetLogicalName() );
// We only want the symbol name, not the full LIB_ID.
//.........这里部分代码省略.........
示例2: makeLibParts
XNODE* NETLIST_EXPORTER_GENERIC::makeLibParts()
{
XNODE* xlibparts = node( wxT( "libparts" ) ); // auto_ptr
wxString sLibpart = wxT( "libpart" );
wxString sLib = wxT( "lib" );
wxString sPart = wxT( "part" );
wxString sAliases = wxT( "aliases" );
wxString sAlias = wxT( "alias" );
wxString sPins = wxT( "pins" ); // key for library component pins list
wxString sPin = wxT( "pin" ); // key for one library component pin descr
wxString sPinNum = wxT( "num" ); // key for one library component pin num
wxString sPinName = wxT( "name" ); // key for one library component pin name
wxString sPinType = wxT( "type" ); // key for one library component pin electrical type
wxString sName = wxT( "name" );
wxString sField = wxT( "field" );
wxString sFields = wxT( "fields" );
wxString sDescr = wxT( "description" );
wxString sDocs = wxT( "docs" );
wxString sFprints = wxT( "footprints" );
wxString sFp = wxT( "fp" );
LIB_PINS pinList;
LIB_FIELDS fieldList;
m_Libraries.clear();
for( std::set<LIB_PART*>::iterator it = m_LibParts.begin(); it!=m_LibParts.end(); ++it )
{
LIB_PART* lcomp = *it;
PART_LIB* library = lcomp->GetLib();
m_Libraries.insert( library ); // inserts component's library if unique
XNODE* xlibpart;
xlibparts->AddChild( xlibpart = node( sLibpart ) );
xlibpart->AddAttribute( sLib, library->GetLogicalName() );
xlibpart->AddAttribute( sPart, lcomp->GetName() );
if( lcomp->GetAliasCount() )
{
wxArrayString aliases = lcomp->GetAliasNames( false );
if( aliases.GetCount() )
{
XNODE* xaliases = node( sAliases );
xlibpart->AddChild( xaliases );
for( unsigned i=0; i<aliases.GetCount(); ++i )
{
xaliases->AddChild( node( sAlias, aliases[i] ) );
}
}
}
//----- show the important properties -------------------------
if( !lcomp->GetAlias( 0 )->GetDescription().IsEmpty() )
xlibpart->AddChild( node( sDescr, lcomp->GetAlias( 0 )->GetDescription() ) );
if( !lcomp->GetAlias( 0 )->GetDocFileName().IsEmpty() )
xlibpart->AddChild( node( sDocs, lcomp->GetAlias( 0 )->GetDocFileName() ) );
// Write the footprint list
if( lcomp->GetFootPrints().GetCount() )
{
XNODE* xfootprints;
xlibpart->AddChild( xfootprints = node( sFprints ) );
for( unsigned i=0; i<lcomp->GetFootPrints().GetCount(); ++i )
{
xfootprints->AddChild( node( sFp, lcomp->GetFootPrints()[i] ) );
}
}
//----- show the fields here ----------------------------------
fieldList.clear();
lcomp->GetFields( fieldList );
XNODE* xfields;
xlibpart->AddChild( xfields = node( sFields ) );
for( unsigned i=0; i<fieldList.size(); ++i )
{
if( !fieldList[i].GetText().IsEmpty() )
{
XNODE* xfield;
xfields->AddChild( xfield = node( sField, fieldList[i].GetText() ) );
xfield->AddAttribute( sName, fieldList[i].GetName(false) );
}
}
//----- show the pins here ------------------------------------
pinList.clear();
lcomp->GetPins( pinList, 0, 0 );
/* we must erase redundant Pins references in pinList
* These redundant pins exist because some pins
* are found more than one time when a component has
* multiple parts per package or has 2 representations (DeMorgan conversion)
* For instance, a 74ls00 has DeMorgan conversion, with different pin shapes,
* and therefore each pin appears 2 times in the list.
* Common pins (VCC, GND) can also be found more than once.
*/
//.........这里部分代码省略.........