Quantum GIS API Documentation  1.8
src/core/qgspythonrunner.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002     qgspythonrunner.cpp
00003     ---------------------
00004     begin                : May 2011
00005     copyright            : (C) 2011 by Martin Dobias
00006     email                : wonder.sk at gmail.com
00007  ***************************************************************************
00008  *                                                                         *
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; either version 2 of the License, or     *
00012  *   (at your option) any later version.                                   *
00013  *                                                                         *
00014  ***************************************************************************/
00015 #include "qgspythonrunner.h"
00016 #include "qgslogger.h"
00017 
00018 QgsPythonRunner* QgsPythonRunner::mInstance = NULL;
00019 
00021 // static methods
00022 
00023 bool QgsPythonRunner::isValid()
00024 {
00025   return mInstance != NULL;
00026 }
00027 
00028 bool QgsPythonRunner::run( QString command, QString messageOnError )
00029 {
00030   if ( mInstance )
00031   {
00032     return mInstance->runCommand( command, messageOnError );
00033   }
00034   else
00035   {
00036     QgsDebugMsg( "Unable to run Python command: runner not available!" );
00037     return false;
00038   }
00039 }
00040 
00041 void QgsPythonRunner::setInstance( QgsPythonRunner* runner )
00042 {
00043   delete mInstance;
00044   mInstance = runner;
00045 }
00046 
00048 // non-static methods
00049 
00050 QgsPythonRunner::QgsPythonRunner()
00051 {
00052 }
00053 
00054 QgsPythonRunner::~QgsPythonRunner()
00055 {
00056 
00057 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines