projectmanager.cpp

来自「kscope」· C++ 代码 · 共 100 行

CPP
100
字号
/*************************************************************************** *   Copyright (C) 2007-2009 by Elad Lahav *   elad_lahav@users.sourceforge.net * *   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, write to the *   Free Software Foundation, Inc., *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. ***************************************************************************/#include "projectmanager.h"#include "exception.h"namespace KScope{namespace App{Core::ProjectBase* ProjectManager::proj_ = NULL;ProjectManagerSignals ProjectManager::signals_;const Core::ProjectBase* ProjectManager::project(){	if (proj_ == NULL)		throw new Core::Exception("No project is currently loaded");	return proj_;}Core::Engine& ProjectManager::engine(){	if (proj_ == NULL)		throw Core::Exception("No project is currently loaded");	Core::Engine* engine = proj_->engine();	if (engine == NULL)		throw new Core::Exception("No engine is available");	return *engine;}Core::Codebase& ProjectManager::codebase(){	if (proj_ == NULL)		throw new Core::Exception("No project is currently loaded");	Core::Codebase* cbase = proj_->codebase();	if (cbase == NULL)		throw new Core::Exception("No engine is available");	return *cbase;}const ProjectManagerSignals* ProjectManager::signalProxy(){	return &signals_;}void ProjectManager::close(){		if (!proj_)			return;		proj_->close();		delete proj_;		proj_ = NULL;		signals_.emitHasProject(false);}void ProjectManager::finishLoad(){	// Signal the availability of a project.	ProjectManager::signals_.emitHasProject(true);	// Does the database need to be rebuilt?	Core::Engine* engine = proj_->engine();	if (engine) {		if ((engine->status() == Core::Engine::Build)		     || (engine->status() == Core::Engine::Rebuild)) {			signals_.emitBuildProject();		}	}}} // namespace App} // namespace KScope

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?