• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

kcachegrind

  • sources
  • kde-4.12
  • kdesdk
  • kcachegrind
  • libcore
loader.cpp
Go to the documentation of this file.
1 /* This file is part of KCachegrind.
2  Copyright (C) 2002 - 2010 Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
3 
4  KCachegrind is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public
6  License as published by the Free Software Foundation, version 2.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; see the file COPYING. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 
19 /*
20  * Base class for loaders of profiling data.
21  */
22 
23 #include "loader.h"
24 
25 #include "logger.h"
26 
28 
29 QList<Loader*> Loader::_loaderList;
30 
31 Loader::Loader(const QString& name, const QString& desc)
32 {
33  _name = name;
34  _description = desc;
35 
36  _logger = 0;
37 }
38 
39 Loader::~Loader()
40 {}
41 
42 bool Loader::canLoad(QIODevice*)
43 {
44  return false;
45 }
46 
47 int Loader::load(TraceData*, QIODevice*, const QString&)
48 {
49  return 0;
50 }
51 
52 Loader* Loader::matchingLoader(QIODevice* file)
53 {
54  foreach (Loader* l, _loaderList)
55  if (l->canLoad(file))
56  return l;
57 
58  return 0;
59 }
60 
61 Loader* Loader::loader(const QString& name)
62 {
63  foreach (Loader* l, _loaderList)
64  if (l->name() == name)
65  return l;
66 
67  return 0;
68 }
69 
70 // factories of available loaders
71 Loader* createCachegrindLoader();
72 
73 void Loader::initLoaders()
74 {
75  _loaderList.append(createCachegrindLoader());
76  //_loaderList.append(GProfLoader::createLoader());
77 }
78 
79 void Loader::deleteLoaders()
80 {
81  while (!_loaderList.isEmpty())
82  delete _loaderList.takeFirst();
83 }
84 
85 // notifications
86 
87 void Loader::setLogger(Logger* l)
88 {
89  _logger = l;
90 }
91 
92 void Loader::loadStart(const QString& filename)
93 {
94  if (_logger)
95  _logger->loadStart(filename);
96 }
97 
98 void Loader::loadProgress(int progress)
99 {
100  if (_logger)
101  _logger->loadProgress(progress);
102 }
103 
104 void Loader::loadError(int line, const QString& msg)
105 {
106  if (_logger)
107  _logger->loadError(line, msg);
108 }
109 
110 void Loader::loadWarning(int line, const QString& msg)
111 {
112  if (_logger)
113  _logger->loadWarning(line, msg);
114 }
115 
116 void Loader::loadFinished(const QString& msg)
117 {
118  if (_logger)
119  _logger->loadFinished(msg);
120 }
121 
Logger
Definition: logger.h:32
Logger::loadProgress
virtual void loadProgress(int progress)
Definition: logger.cpp:41
Logger::loadError
virtual void loadError(int line, const QString &msg)
Definition: logger.cpp:56
Loader::name
QString name() const
Definition: loader.h:70
Logger::loadStart
virtual void loadStart(const QString &filename)
Definition: logger.cpp:33
Loader::setLogger
void setLogger(Logger *)
Definition: loader.cpp:87
Loader::initLoaders
static void initLoaders()
Definition: loader.cpp:73
Loader::_logger
Logger * _logger
Definition: loader.h:85
Loader
To implement a new loader, inherit from the Loader class and and reimplement canLoad() and load()...
Definition: loader.h:51
Loader::canLoad
virtual bool canLoad(QIODevice *file)
Definition: loader.cpp:42
Logger::loadFinished
virtual void loadFinished(const QString &msg)
Definition: logger.cpp:62
createCachegrindLoader
Loader * createCachegrindLoader()
Definition: cachegrindloader.cpp:185
Loader::loadError
void loadError(int line, const QString &msg)
Definition: loader.cpp:104
Loader::loadWarning
void loadWarning(int line, const QString &msg)
Definition: loader.cpp:110
Loader::~Loader
virtual ~Loader()
Definition: loader.cpp:39
Logger::loadWarning
virtual void loadWarning(int line, const QString &msg)
Definition: logger.cpp:50
loader.h
Loader::loader
static Loader * loader(const QString &name)
Definition: loader.cpp:61
Loader::loadProgress
void loadProgress(int progress)
Definition: loader.cpp:98
Loader::loadFinished
void loadFinished(const QString &msg=QString::null)
Definition: loader.cpp:116
Loader::matchingLoader
static Loader * matchingLoader(QIODevice *file)
Definition: loader.cpp:52
logger.h
Loader::deleteLoaders
static void deleteLoaders()
Definition: loader.cpp:79
Loader::load
virtual int load(TraceData *, QIODevice *file, const QString &filename)
Definition: loader.cpp:47
TraceData
This class holds profiling data of multiple tracefiles generated with cachegrind on one command...
Definition: tracedata.h:1363
Loader::Loader
Loader(const QString &name, const QString &desc)
Definition: loader.cpp:31
Loader::loadStart
void loadStart(const QString &filename)
Definition: loader.cpp:92
QList
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:03:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kcachegrind

Skip menu "kcachegrind"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal