[pan2: 31/268] added file upload struct
- From: Heinrich MÃller <henmull src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2: 31/268] added file upload struct
- Date: Mon, 2 Jan 2012 15:40:36 +0000 (UTC)
commit f50137f224548b539d718e22c3bb2918a3c3c405
Author: Heinrich MÃller <sphemuel stud informatik uni-erlangen de>
Date: Wed May 25 07:49:37 2011 +0200
added file upload struct
pan/data/file-queue.cc | 83 ++++++++++++++++++++++++++++++++++++
pan/data/file-queue.h | 109 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 192 insertions(+), 0 deletions(-)
---
diff --git a/pan/data/file-queue.cc b/pan/data/file-queue.cc
new file mode 100644
index 0000000..fd6c6e6
--- /dev/null
+++ b/pan/data/file-queue.cc
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * Pan - A Newsreader for Gtk+
+ * Copyright (C) 2002-2006 Charles Kerr <charles rebelbase com>
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include <algorithm>
+
+#include <config.h>
+#include <pan/data/article.h>
+#include <pan/data/data.h>
+#include <pan/data/xref.h>
+#include <pan/tasks/nntp.h>
+#include <pan/tasks/task.h>
+#include "file-queue.h"
+
+using namespace pan;
+
+FileQueue :: ~FileQueue ()
+{}
+
+FileQueue :: FileQueue() {}
+
+Article::PartState
+FileQueue :: get_part_state () const {
+ return COMPLETE;
+}
+
+void
+FileQueue :: add (const StringView & subject,
+ const StringView & author,
+ const StringView & filename,
+ const unsigned long byte_count,
+ const unsigned long line_count,
+ FileQueue::InsertType type)
+{
+ static FileData a;
+ a.subject = subject;
+ a.author = author;
+ a.filename = filename;
+ a.byte_count = byte_count;
+ a.line_count = line_count;
+ a.article.is_binary = true;
+ a.article.set_part_count (1); // decoder has to determine that later on
+// const FileData* new_article = &a;
+// type == FileQueue::END ?
+ _articles_v.push_back(a);
+// _articles_v.push_front(a);
+}
+
+//void
+//FileQueue :: delete_single(const FileData* s)
+//{
+// std::set<const FileData*>::iterator it = _articles_v.find(s);
+// _articles_v.erase(it);
+//}
+//
+//void
+//FileQueue :: delete_range(const Article* a, const Article* b)
+//{
+//
+// articles_it a_it = _articles_v.find(a);
+// articles_it b_it = _articles_v.find(b);
+// if (a==b ) delete_single(a);
+// _articles_v.erase ( a_it, b_it );
+//}
+
+
+
diff --git a/pan/data/file-queue.h b/pan/data/file-queue.h
new file mode 100644
index 0000000..1b8ab36
--- /dev/null
+++ b/pan/data/file-queue.h
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * Pan - A Newsreader for Gtk+
+ * Copyright (C) 2002-2006 Charles Kerr <charles rebelbase com>
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __FileQueue_h__
+#define __FileQueue_h__
+
+#include <pan/general/quark.h>
+#include <pan/general/sorted-vector.h>
+#include <pan/data/parts.h>
+#include <pan/data/article.h>
+#include <pan/data/xref.h>
+#include <pan/data-impl/memchunk.h>
+#include <string>
+#include <list>
+#include <map>
+
+/****
+*****
+****/
+
+namespace pan {
+
+ class FileQueue: public Article
+ {
+
+ public:
+ FileQueue();
+ virtual ~FileQueue ();
+
+ struct FileData
+ {
+ StringView subject;
+ StringView author;
+ StringView filename;
+ unsigned long byte_count;
+ unsigned long line_count;
+ Article article;
+ FileData() {}
+ };
+
+ typedef std::vector<FileData>::iterator articles_it;
+ typedef std::vector<FileData> articles_v;
+
+
+ articles_it end() { return _articles_v.end(); }
+ articles_it begin() { return _articles_v.begin(); }
+ FileData get_front() { return _articles_v[0]; }
+ FileData get_at(int i) { return _articles_v[(i<0 || i>_articles_v.size()) ? 0 : i]; }
+ bool empty() { return _articles_v.empty(); }
+
+ articles_v& v() { return _articles_v; }
+
+ public:
+ enum InsertType
+ { BEGIN, END };
+ // article
+ public:
+ PartState get_part_state () const;
+
+ //own
+ public:
+ void add (const StringView & subject,
+ const StringView & author,
+ const StringView & filename,
+ const unsigned long byte_count,
+ const unsigned long line_count,
+ FileQueue::InsertType type);
+
+ private:
+ articles_v _articles_v;
+ };
+}
+
+#endif
+
+// todo
+//void
+//TaskPane :: get_selected_tasks_foreach (GtkTreeModel *model, GtkTreePath *, GtkTreeIter *iter, gpointer list_g)
+//{
+// Task * task (0);
+// gtk_tree_model_get (model, iter, COL_TASK_POINTER, &task, -1);
+// static_cast<tasks_t*>(list_g)->push_back (task);
+//}
+//
+//tasks_t
+//TaskPane :: get_selected_tasks () const
+//{
+// tasks_t tasks;
+// GtkTreeView * view (GTK_TREE_VIEW (_view));
+// GtkTreeSelection * sel (gtk_tree_view_get_selection (view));
+// gtk_tree_selection_selected_foreach (sel, get_selected_tasks_foreach, &tasks);
+// return tasks;
+//}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]