#include "kitaboardview.h"
#include "kita.h"
#include "libkita/board.h"
+#include "libkita/category.h"
KitaBoardView::KitaBoardView(QWidget *parent, const char *name)
QStringList lines = QStringList::split("\n", html);
QStringList::iterator it;
- /*
- QValueList< QPair<QString, Kita::Board> > board_list;
+
+ /*QPtrList<Kita::Category> categoryList;
{
- QString current_category;
+ Kita::Category* current_category = 0;
for(it = lines.begin(); it != lines.end(); ++it) {
- QString category = getCategory(*it);
- if( category != QString::null ) {
- current_category = category;
+ QString category_name = getCategory(*it);
+ if( category_name != QString::null ) {
+ current_category = new Kita::Category(category_name);
+ categoryList.append(current_category);
} else {
Kita::Board board = getBoard(*it);
if( isBoardUrl(board.url()) ) {
- board_list.append(QPair<QString, Kita::Board>(current_category, board));
+ current_category->append(board);
}
}
}
}
{
- QValueListIterator< QPair<QString, Kita::Board> > iterator;
- for(iterator = board_list.begin(); iterator != board_list.end(); ++iterator) {
- if((*iterator).first == QString::null) continue;
-
- qDebug("category:%s name:%s url:%s", (const char *)(*iterator).first.local8Bit(),
- (const char*)(*iterator).second.name().local8Bit(),
- (*iterator).second.url().prettyURL().latin1());
+ Kita::Category* category;
+ for(category = categoryList.first(); category; category = categoryList.next()) {
+ if(category->name() == QString::null) continue;
+
+ QValueList<Kita::Board> board_list = category->getBoardList();
+ QValueListIterator<Kita::Board> it2;
+ for(it2 = board_list.begin(); it2 != board_list.end(); ++it2) {
+ qDebug("category:%s name:%s url:%s", (const char *)category->name().local8Bit(),
+ (const char*)(*it2).name().local8Bit(),
+ (*it2).url().prettyURL().latin1());
+ }
}
}*/
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2003 by Hideki Ikemoto *
+ * ikemo@users.sourceforge.jp *
+ * *
+ * 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. *
+ ***************************************************************************/
+
+#include "category.h"
+
+using namespace Kita;
+
+Category::Category(QString& name) : m_name(name)
+{
+}
+
+Category::~Category()
+{
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2003 by Hideki Ikemoto *
+ * ikemo@users.sourceforge.jp *
+ * *
+ * 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. *
+ ***************************************************************************/
+
+#ifndef KITACATEGORY_H
+#define KITACATEGORY_H
+
+#include <qptrlist.h>
+
+#include "board.h"
+
+namespace Kita {
+
+/**
+@author Hideki Ikemoto
+*/
+class Category{
+ QString m_name;
+ QValueList<Board> m_boardList;
+public:
+ Category(QString& name);
+ ~Category();
+ void append(Board& board) { m_boardList.append(board); }
+ QValueList<Board>& getBoardList() { return m_boardList; }
+ QString name() { return m_name; }
+};
+
+};
+
+#endif