KDevelop API Documentation

languages/java/debugger/framestackwidget.cpp

Go to the documentation of this file.
00001 /*************************************************************************** 00002 framestack.cpp - description 00003 ------------------- 00004 begin : Sun Aug 8 1999 00005 copyright : (C) 1999 by John Birch 00006 email : jbb@kdevelop.org 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 "framestackwidget.h" 00019 #include "jdbparser.h" 00020 00021 #include <klocale.h> 00022 00023 #include <qlistbox.h> 00024 #include <qstrlist.h> 00025 00026 #include <ctype.h> 00027 00028 00029 /***************************************************************************/ 00030 /***************************************************************************/ 00031 /***************************************************************************/ 00032 00033 namespace JAVADebugger 00034 { 00035 00036 FramestackWidget::FramestackWidget(QWidget *parent, const char *name) 00037 : QListBox(parent, name), 00038 currentFrame_(0), 00039 currentList_(0) 00040 { 00041 connect( this, SIGNAL(highlighted(int)), SLOT(slotHighlighted(int)) ); 00042 connect( this, SIGNAL(selected(int)), SLOT(slotHighlighted(int)) ); 00043 } 00044 00045 00046 /***************************************************************************/ 00047 00048 FramestackWidget::~FramestackWidget() 00049 { 00050 delete currentList_; 00051 } 00052 00053 /***************************************************************************/ 00054 00055 void FramestackWidget::slotHighlighted(int frame) 00056 { 00057 // always set this as the current frame and emit a signal 00058 // because this will display the source file if it's not visible 00059 // due to the user having opened a different file. 00060 currentFrame_ = frame; 00061 emit selectFrame(frame); 00062 } 00063 00064 /***************************************************************************/ 00065 00066 // someone (the vartree :-)) wants us to select this frame. 00067 void FramestackWidget::slotSelectFrame(int frame) 00068 { 00069 if (isSelected(frame)) 00070 slotHighlighted(frame); // force this when we're already selected 00071 else 00072 setCurrentItem(frame); 00073 } 00074 00075 /***************************************************************************/ 00076 00077 void FramestackWidget::clearList() { 00078 clear(); 00079 delete currentList_; 00080 currentList_ = new QStrList(true); // make deep copies of the data 00081 currentList_->setAutoDelete(true); // delete items when they are removed 00082 } 00083 00084 void FramestackWidget::addItem(QCString s) { 00085 currentList_->append(s); // This copies the string (deepcopies = true above) 00086 } 00087 00088 void FramestackWidget::parseJDBBacktraceList(char */*str*/) 00089 { 00090 } 00091 00092 void FramestackWidget::updateDone() 00093 { 00094 00095 insertStrList(currentList_); 00096 currentFrame_ = 0; 00097 } 00098 00099 /***************************************************************************/ 00100 00101 QCString FramestackWidget::getFrameParams(int frame) 00102 { 00103 if (!currentList_) { 00104 if (char *frameData = currentList_->at(frame)) { 00105 if (char *paramStart = strchr(frameData, '(')) { 00106 JDBParser parser; 00107 if (char *paramEnd = parser.skipDelim(paramStart, '(', ')')) { 00108 // allow for operator()(params) 00109 if (paramEnd == paramStart+2) { 00110 if (*(paramEnd+1) == '(') { 00111 paramStart = paramEnd+1; 00112 paramEnd = parser.skipDelim(paramStart, '(', ')'); 00113 if (!paramEnd) 00114 return QCString(); 00115 } 00116 } 00117 00118 // The parameters are contained _within_ the brackets. 00119 if (paramEnd-paramStart > 2) 00120 return QCString (paramStart+1, paramEnd-paramStart-1); 00121 } 00122 } 00123 } 00124 } 00125 00126 return QCString(); 00127 } 00128 00129 /***************************************************************************/ 00130 00131 QString FramestackWidget::getFrameName(int frame) 00132 { 00133 if (currentList_) { 00134 if (char *frameData = currentList_->at(frame)) { 00135 if (char *paramStart = strchr(frameData, '(')) { 00136 char *fnstart = paramStart-2; 00137 while (fnstart > frameData) { 00138 if (isspace(*fnstart)) 00139 break; 00140 fnstart--; 00141 } 00142 QString frameName(QString().sprintf("#%d %s(...)", frame, 00143 QCString(fnstart, paramStart-fnstart+1).data())); 00144 return frameName; 00145 } 00146 } 00147 } 00148 00149 return i18n("No stack"); 00150 } 00151 00152 /***************************************************************************/ 00153 /***************************************************************************/ 00154 /***************************************************************************/ 00155 00156 } 00157 00158 #include "framestackwidget.moc"
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Oct 19 08:01:42 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003