Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 587601 Details for
Bug 826397
QString Segfaults on appending string at line 274 in the QString Library
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
implementation file
node.cpp (text/x-c++src), 8.92 KB, created by
lukewolf101010
on 2012-05-30 06:36:16 UTC
(
hide
)
Description:
implementation file
Filename:
MIME Type:
Creator:
lukewolf101010
Created:
2012-05-30 06:36:16 UTC
Size:
8.92 KB
patch
obsolete
>#include "node.h" >#include <QStringList> >#include <QRegExp> >#include <Qt> >#include <QDebug> >namespace HBM >{ > node::nodeData node::previous; > QFile node::read; > QStack<int> node::nodeOrder; > int node::nodeDepth = 0; > int node::count =0; > QStack<node*> node::nodeAddress; > QList<node*> node::masterNodes; > > QString node::resourcePath = ":/Resources/"; > QDir node::sources(resourcePath); > //QDir node::sources(":/"); work on getting resources compiled into the binary later > QStringList node::files = node::sources.entryList ((QStringList)"*.hjt"); > QString node::filename = resourcePath + (QString) files.last(); > > node::nodeData::nodeData() > { > //In the File the node's depth starts at 0, so nodeDepth must be initialized to -1 > nodeDepth=-1; > address = NULL; > } > > node::node() > { > ismasterNode = false; > > current.nodeNumber = count; > current.address = this; > readNode(); > QString name = QString("Node: %1 Depth: %2").arg(current.nodeNumber).arg(current.nodeDepth); > setObjectName(name); > checkDepthStack(); > count++; > previous = current; > qDebug() << "MasterNode: " << ismasterNode; > } > node::~node() > { > > } > > bool node::atEnd() > { > if (read.atEnd() && files.isEmpty()) > { > return true; > } > else > { > return false; > } > } > > QString node::returnTitle() > {return current.title;} > int node::returnNodeDepth() > {return current.nodeDepth;} > QString node::returnText() > {return current.text;} > int node::returnNodeNumber() > {return current.nodeNumber;} > > int node::returnParentNumber() > { > if(!current.nodeNumber == 0) > { > node* ptr = (node*)this->parent(); > return ptr->current.nodeNumber; > } > return 0; > } > > QStack<int> node::returnChildrenNumbers() > { > QRegExp Search; > Search.setPattern(QString("Depth: %1").arg(current.nodeDepth+1)); > QList<node*> childrenNodes = this->findChildren<node*>(Search); > QStack<int> childrenNumbers; > foreach(node* ptr, childrenNodes) > { > qDebug() << endl << ptr->current.title; > qDebug() << ptr->objectName() << " " << endl << flush; > childrenNumbers.push(ptr->current.nodeNumber); > } > if(childrenNodes.isEmpty()) > { > qDebug() << "No Children\n" << flush; > } > > return childrenNumbers; > } > > QList<node*> node::returnChildren() > { > QRegExp Search; > Search.setPattern(QString("Depth: %1").arg(current.nodeDepth+1)); > QList<node*> childrenNodes = this->findChildren<node*>(Search); > return childrenNodes; > } > > int node::returnCount() > {return count;} > QList<node*> node::returnMasterNodes() > { > QList<node*> temp; > foreach(node* ptr, masterNodes) > { > qDebug() << "Master Node: " << ptr->returnTitle(); > temp += ptr; > } > > return temp; > } > > bool node::openFile() > { > read.setFileName(filename); > if (read.exists() == true) > { > if(read.open(QIODevice::ReadOnly)) > return true; > } > return false; > } > > void node::checkDepthStack() > { > if (current.nodeDepth == 0) > { > while(!nodeOrder.isEmpty()) > { > nodeOrder.pop(); > nodeAddress.pop(); > } > qDebug() << "First Node \n" << flush; > nodeOrder.push(current.nodeNumber); > nodeAddress.push(current.address); > qDebug() << "pushing 1\n"; > } > > else if (current.nodeDepth > previous.nodeDepth) > { > nodeDepth++; > nodeOrder.push(current.nodeNumber); > nodeAddress.push(current.address); > parent_node = previous.address; > setParent(parent_node); > qDebug() << "pushing 2\n"; > } > > else if (current.nodeDepth < previous.nodeDepth) > { > bool ok = false; > do > { > if (nodeOrder.size() == current.nodeDepth) > { > parent_node = nodeAddress.top(); > setParent(parent_node); > nodeOrder.push(current.nodeNumber); > nodeAddress.push(current.address); > > qDebug() <<"Parent Node Number: " << parent_node->current.nodeNumber; > qDebug() << "\npushing 3\n"; > ok = true; > } > else if (!nodeOrder.isEmpty()) > { > nodeDepth--; > nodeOrder.pop(); > nodeAddress.pop(); > qDebug() << "NoderOrder size = " << nodeOrder.size() << endl; > } > // should never happen > else if (nodeOrder.isEmpty()) > { > qDebug() << "Node Order is Empty\n" << flush; > ok = true; > } > > } while (!ok); > } > > else > { > nodeAddress.pop(); > nodeOrder.pop(); > > qDebug() << "NodeOrder at 4: " << nodeOrder.top() << endl; > > parent_node = nodeAddress.top(); > setParent(parent_node); > qDebug() << "Node at 4: " << parent_node->returnNodeNumber() << endl; > nodeAddress.push(this); > nodeOrder.push(current.nodeNumber); > > qDebug() <<"Parent Node Number: " << parent_node->current.nodeNumber; > qDebug() << "\npushing 4\n"; > > } > } > > > bool node::readNode() > { > > bool ok = false; > /* > * Checks if the file is at the end and if there are > * any more resource files to be had, if so they are loaded > */ > if (read.atEnd() && !files.isEmpty()) > { > files.removeLast(); > filename = resourcePath + files.last(); > read.close(); > openFile(); > } > else if(read.atEnd() && files.isEmpty()) > { > return false; > } > > do > { > readline(); > }while(!temp.contains("<node>") && !read.atEnd()); > > if (temp.contains("<node>")) > { > ok = true; > } > > if (ok) > { > readline(); > temp = tr(temp.toLatin1()); > > current.title = temp; > int indexSize = 30; > > if (current.title.length() > indexSize) > { > int index = indexSize; > bool ok = false; > while(current.title.at(index) != ' ') > { > index++; > if (index == current.title.length()) > { > break; > } > if (current.title.at(index) == ' ') > { > ok = true; > } > } > if(!ok) > { > index = indexSize; > while (current.title.at(index) != ' ') > { > index--; > } > } > current.title.insert(index,"\n"); > } > > readline(); > current.nodeDepth = temp.toInt(); > readline(); > > while(!temp.contains("<end node>")) > { > temp = tr(temp.toLatin1()); > /* > * <p> Tag allows the text to properly wrap > * and segments out paragraphs > */ > current.text +="<p>"; > > /* > * Checks for tabs and sets up those specific > * lines for preformatted text, might cause issues > * for lines that are too long however text that is > * tabbed in should probably not be too long. > */ > > if (temp.contains("\t")) > { > > temp.insert(0,"<pre>"); > temp.insert(temp.length(),"</pre>"); > current.text += temp; > } > else > { > current.text += temp; > } > > current.text += "</p>"; > > readline(); > } > if (current.text.contains("<master>")) > { > ismasterNode = true; > masterNodes.append(this); > } > if (current.text.contains("[This is not visible to the End User.]")) > { > current.text = "<br><br><center> <h1> Alien's Guide to the Galaxy</h1></center>"; > } > > > } > current.text.squeeze(); > return true; > } > > bool node::readline() > { > temp = read.readLine(); > return true; > } > > bool node::isMasterNode() > { > return ismasterNode; > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 826397
:
587599
|
587600
|
587601
|
587908
|
587909
|
587914
|
587916
|
587917
|
587918
|
587922