C++ (Qt)QString LogItemChildren::test(){ QString moniker = gLogItemChildren.attributes().namedItem("value").nodeValue(); QDomElement nodes(gLogItemChildren.parentNode().parentNode().toElement()); int i = 0; while(i < nodes.childNodes().count()){ if (getMoniker(nodes.childNodes().item(i).toElement()).compare(moniker, Qt::CaseInsensitive) == 0) break; i++; } return getMoniker(nodes.childNodes().item(i).toElement());}
C++ (Qt)QString LogItemChildren::test(){ QString moniker = gLogItemChildren.attributes().namedItem("value").nodeValue(); QDomElement nodes(gLogItemChildren.parentNode().parentNode().toElement()); int i = 0; while(i < nodes.childNodes().count()){ if (getMoniker(nodes.childNodes().item(i).toElement()).compare(moniker, Qt::CaseInsensitive) == 0)// Произошло совпадение, выходим из цикла и.... break; i++; }// возвращаем строку из 5 элемента... return getMoniker(nodes.childNodes().item(5).toElement());}
<node> <childs> <child moniker="1"> </childs><prp moniker="0"/></node><node> <childs/> <prp moniker="1"/></node>
C++ (Qt)QString LogItemChildren::test(){ QString moniker = gLogItemChildren.attributes().namedItem("value").nodeValue(); qDebug() << moniker; QDomElement nodes(gLogItemChildren.parentNode().parentNode().toElement()); int i = 0; while(i < nodes.childNodes().count()){ QString v = getMoniker( nodes.childNodes().item(i).toElement() ); qDebug() << v if (v.compare(moniker, Qt::CaseInsensitive) == 0) return v; i++; } return QString();}
C++ (Qt)QDomElement nodes(gLogItemChildren.parentNode().parentNode().toElement());
C++ (Qt)QDomElement nodes(gLogItemChildren.parentNode().parentNode().parentNode().toElement());
C++ (Qt)class LogDescription;class LogSuite;class LogItem;class LogItemChildren;class LogMessages;class LogMessage; class LogMessage{public: LogMessage(); LogMessage(QDomElement aLogMessage); ~LogMessage(); QString getMessage();private: void setRelativePath(QString aPath);protected: QDomElement gLogMessage; QString gLogPath;friend class LogMessages;}; class LogMessages{public: LogMessages(); ~LogMessages(); int openFile(QString aFileName); int getMessagesCount(); QString getFileName(); QString getFilePath(); LogMessage getLogMessage(int aLogMessageIndex);protected: QString gLogPath; QString gLogFileName; QDomDocument * gLogMessagesDocument;}; class LogItemChildren{public: LogItemChildren(const QDomElement &aChildrenItem); ~LogItemChildren(); QString getRelativeFileName(); QString getChildrenMoniker(); LogItem getLogItem(); QString test();private: void setRelativePath(QString aPath);protected: QDomElement gLogItemChildren; QString gLogPath;friend class LogItem;}; class LogItem{public: LogItem(const QDomElement &aLogItem); ~LogItem(); QString getFileName(); QString getOwnerMoniker(); QString getName(); int getStatus(); QString getMoniker(); QString getTest(); QString getPersistentDataKey(); QString getProjectKey(); QString getRelativeFileName(); bool hasChildren(); int getChildrenCount(); LogItemChildren getChildren(int aChildrenindex); LogMessages getLogMessages();private: void setRelativePath(QString aPath);protected: QDomElement gLogItem; QString gLogPath;friend class LogSuite;friend class LogItemChildren;}; class LogSuite{public: LogSuite(); ~LogSuite(); int openFile(QString aFileName); void closeFile(); QString getFilePath(); QString getFileName(); int getTotalItemsCount(); LogItem getLogItem(int aItemIndex);protected: QString gLogPath; QString gLogFileName; QDomDocument * gLogSuiteDocument;};
C++ (Qt)class LogItem{public: LogItem(const QDomElement &aLogItem); ~LogItem(); QString getFileName(); QString getOwnerMoniker(); QString getName(); int getStatus(); QString getMoniker(); QString getTest(); QString getPersistentDataKey(); QString getProjectKey(); QString getRelativeFileName(); bool hasChildren(); int getChildrenCount(); LogItemChildren getChildren(int aChildrenindex); LogMessages * getLogMessages();private: void setRelativePath(QString aPath);protected: QDomElement gLogItem; QString gLogPath; LogMessages * gLogMessages;friend class LogSuite;friend class LogItemChildren;};
C++ (Qt)LogMessages * LogItem::getLogMessages(){ if (!gLogMessages){ gLogMessages->openFile(this->gLogPath + "/" + this->getFileName()); return gLogMessages; } else return gLogMessages;} LogItem::LogItem(const QDomElement &aLogItem):gLogItem(aLogItem){ this->gLogMessages = new LogMessages;} LogItem::~LogItem(){ delete gLogMessages;}
C++ (Qt)LogMessages * LogItem::getLogMessages(){ if (!gLogMessages){ gLogMessages->openFile(this->gLogPath + "/" + this->getFileName()); return gLogMessages; } else return gLogMessages;}