00001 /****************************************************************************** 00002 * Copyright (C) 2015 by Ralf Kaestner * 00003 * ralf.kaestner@gmail.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the Lesser GNU General Public License as published by* 00007 * the Free Software Foundation; either version 3 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * Lesser GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the Lesser GNU General Public License * 00016 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 00017 ******************************************************************************/ 00018 00019 #ifndef RQT_MULTIPLOT_URL_ITEM_H 00020 #define RQT_MULTIPLOT_URL_ITEM_H 00021 00022 #include <QMap> 00023 #include <QModelIndex> 00024 00025 #include <rqt_multiplot/UrlScheme.h> 00026 00027 namespace rqt_multiplot { 00028 class UrlItem { 00029 public: 00030 enum Type { 00031 Scheme, 00032 Host, 00033 Path 00034 }; 00035 00036 UrlItem(UrlScheme* scheme = 0, Type type = Scheme, const QModelIndex& 00037 index = QModelIndex(), UrlItem* parent = 0); 00038 ~UrlItem(); 00039 00040 UrlItem* getParent() const; 00041 size_t getNumChildren() const; 00042 UrlItem* getChild(size_t row) const; 00043 int getRow() const; 00044 00045 void setScheme(UrlScheme* scheme); 00046 UrlScheme* getScheme() const; 00047 void setType(Type type); 00048 Type getType() const; 00049 void setIndex(const QModelIndex& index); 00050 const QModelIndex& getIndex() const; 00051 QModelIndex getIndex(Type type) const; 00052 00053 UrlItem* addChild(size_t row, Type type, const QModelIndex& index); 00054 00055 private: 00056 UrlItem* parent_; 00057 QMap<size_t, UrlItem*> children_; 00058 00059 UrlScheme* scheme_; 00060 Type type_; 00061 QModelIndex index_; 00062 }; 00063 }; 00064 00065 #endif