82 lines
2.8 KiB
Plaintext
82 lines
2.8 KiB
Plaintext
/*
|
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
|
*
|
|
* Copyright (C) 2010-2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
|
* Copyright (C) 2010 Kicad Developers, see change_log.txt for contributors.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, you may find one here:
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
*/
|
|
|
|
#ifndef SCH_LIBS_H_
|
|
#define SCH_LIBS_H_
|
|
|
|
#include <sch_lib.h>
|
|
|
|
|
|
/**
|
|
* Class LIBS
|
|
* houses a handful of functions that manage all the RAM resident LIBs, and
|
|
* provide for a global part lookup function, GetPart(), which can be the basis
|
|
* of a cross LIB hyperlink.
|
|
*/
|
|
class LIBS
|
|
{
|
|
public:
|
|
|
|
/**
|
|
* Function GetPart
|
|
* finds and loads a PART, and parses it. As long as the part is
|
|
* accessible in any LIB_SOURCE, opened or not opened, this function
|
|
* will find it and load it into its containing LIB, even if that means
|
|
* having to load a new LIB as given in the library table.
|
|
*/
|
|
static PART* GetPart( const LPID& aLogicalPartID ) throw( IO_ERROR );
|
|
|
|
/**
|
|
* Function GetLib
|
|
* is first a lookup function and then if needed, a factory function.
|
|
* If aLogicalLibraryName has been opened, then return the already opened
|
|
* LIB. If not, then instantiate the library and fill the initial
|
|
* library PARTs (unparsed) and categories, and add it to LIB::libraries
|
|
* for future reference.
|
|
*/
|
|
static LIB* GetLib( const STRING& aLogicalLibraryName ) throw( IO_ERROR );
|
|
|
|
/**
|
|
* Function GetOpenedLibNames
|
|
* returns the logical library names of LIBs that are already opened.
|
|
* @see LPID::GetLogicalLibraries()
|
|
*/
|
|
static STRINGS GetOpendedLogicalLibNames();
|
|
|
|
/**
|
|
* Function CloseLibrary
|
|
* closes an open library @a aLibrary and removes it from class LIBS.
|
|
*/
|
|
static void CloseLibrary( LIB* aLibrary ) throw( IO_ERROR );
|
|
|
|
|
|
private:
|
|
|
|
/// collection of LIBs, searchable by logical name.
|
|
static std::map< STRING, LIB* > libraries; // owns the LIBs.
|
|
};
|
|
|
|
|
|
#endif // SCH_LIBS_H_
|