~andrew-plumb/kicad/kicad

« back to all changes in this revision

Viewing changes to common/fp_lib_table.cpp

  • Committer: Dick Hollenbeck
  • Date: 2013-10-05 04:53:15 UTC
  • Revision ID: dick@softplc.com-20131005045315-4hevos19eag45zxc
Put FP_LIB_TABLE::Footprint*() functions on stage, but comment out lazy plugin lookup trick in FindRow() until these new API functions are used.

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
}
60
60
 
61
61
 
 
62
wxArrayString FP_LIB_TABLE::FootprintEnumerate( const wxString& aNickname )
 
63
{
 
64
    const ROW* row = FindRow( aNickname );
 
65
    wxASSERT( (PLUGIN*) row->plugin );
 
66
    return row->plugin->FootprintEnumerate( row->GetFullURI( true ), row->GetProperties() );
 
67
}
 
68
 
 
69
 
 
70
MODULE* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, const wxString& aFootprintName )
 
71
{
 
72
    const ROW* row = FindRow( aNickname );
 
73
    wxASSERT( (PLUGIN*) row->plugin );
 
74
    return row->plugin->FootprintLoad( row->GetFullURI( true ), aFootprintName, row->GetProperties() );
 
75
}
 
76
 
 
77
 
 
78
void FP_LIB_TABLE::FootprintSave( const wxString& aNickname, const MODULE* aFootprint )
 
79
{
 
80
    const ROW* row = FindRow( aNickname );
 
81
    wxASSERT( (PLUGIN*) row->plugin );
 
82
    return row->plugin->FootprintSave( row->GetFullURI( true ), aFootprint, row->GetProperties() );
 
83
}
 
84
 
 
85
 
 
86
void FP_LIB_TABLE::FootprintDelete( const wxString& aNickname, const wxString& aFootprintName )
 
87
{
 
88
    const ROW* row = FindRow( aNickname );
 
89
    wxASSERT( (PLUGIN*) row->plugin );
 
90
    return row->plugin->FootprintDelete( row->GetFullURI( true ), aFootprintName, row->GetProperties() );
 
91
}
 
92
 
 
93
 
 
94
bool FP_LIB_TABLE::IsFootprintLibWritable( const wxString& aNickname )
 
95
{
 
96
    const ROW* row = FindRow( aNickname );
 
97
    wxASSERT( (PLUGIN*) row->plugin );
 
98
    return row->plugin->IsFootprintLibWritable( row->GetFullURI( true ) );
 
99
}
 
100
 
 
101
 
62
102
void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR )
63
103
{
64
104
    /*
335
375
}
336
376
 
337
377
 
338
 
const FP_LIB_TABLE::ROW* FP_LIB_TABLE::findRow( const wxString& aNickName )
 
378
FP_LIB_TABLE::ROW* FP_LIB_TABLE::findRow( const wxString& aNickName ) const
339
379
{
340
 
    FP_LIB_TABLE* cur = this;
 
380
    FP_LIB_TABLE* cur = (FP_LIB_TABLE*) this;
341
381
 
342
382
    do
343
383
    {
412
452
const FP_LIB_TABLE::ROW* FP_LIB_TABLE::FindRow( const wxString& aLibraryNickName )
413
453
    throw( IO_ERROR )
414
454
{
415
 
    const ROW* row = findRow( aLibraryNickName );
 
455
    ROW* row = findRow( aLibraryNickName );
416
456
 
417
457
    if( !row )
418
458
    {
421
461
        THROW_IO_ERROR( msg );
422
462
    }
423
463
 
 
464
    /*  enable this when FP_LIB_TABLE::Footprint*() functions are put into use.
 
465
    if( !row->plugin )
 
466
        row->setPlugin( IO_MGR::PluginFind( row->type ) );
 
467
    */
 
468
 
424
469
    return row;
425
470
}
426
471
 
427
472
 
428
 
PLUGIN* FP_LIB_TABLE::PluginFind( const wxString& aLibraryNickName )
429
 
    throw( IO_ERROR )
430
 
{
431
 
    const ROW* row = FindRow( aLibraryNickName );
432
 
 
433
 
    // row will never be NULL here.
434
 
 
435
 
    PLUGIN* plugin = IO_MGR::PluginFind( row->type );
436
 
 
437
 
    return plugin;
438
 
}
439
 
 
440
 
 
441
473
const wxString FP_LIB_TABLE::ExpandSubstitutions( const wxString aString )
442
474
{
443
475
    // We reserve the right to do this another way, by providing our own member