|
QGIS API Documentation
master-59fd5e0
|
00001 /*************************************************************************** 00002 qgsgpsconnectionregistry.cpp - description 00003 ---------------------------- 00004 begin : December 27th, 2009 00005 copyright : (C) 2009 by Marco Hugentobler 00006 email : marco at hugis dot net 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #include "qgsgpsconnectionregistry.h" 00019 #include "qgsgpsconnection.h" 00020 00021 QgsGPSConnectionRegistry* QgsGPSConnectionRegistry::mInstance = 0; 00022 00023 QgsGPSConnectionRegistry::QgsGPSConnectionRegistry() 00024 { 00025 00026 } 00027 00028 QgsGPSConnectionRegistry::~QgsGPSConnectionRegistry() 00029 { 00030 QSet<QgsGPSConnection*>::iterator it = mConnections.begin(); 00031 for ( ; it != mConnections.end(); ++it ) 00032 { 00033 delete *it; 00034 } 00035 } 00036 00037 QgsGPSConnectionRegistry* QgsGPSConnectionRegistry::instance() 00038 { 00039 if ( !mInstance ) 00040 { 00041 mInstance = new QgsGPSConnectionRegistry(); 00042 } 00043 return mInstance; 00044 } 00045 00046 void QgsGPSConnectionRegistry::registerConnection( QgsGPSConnection* c ) 00047 { 00048 mConnections.insert( c ); 00049 } 00050 00051 void QgsGPSConnectionRegistry::unregisterConnection( QgsGPSConnection* c ) 00052 { 00053 mConnections.remove( c ); 00054 } 00055 00056 QList< QgsGPSConnection* > QgsGPSConnectionRegistry::connectionList() const 00057 { 00058 return mConnections.toList(); 00059 }