From 81916cdbda44f249eb8c895a041a80d6023050df Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Sat, 2 Nov 2013 23:25:00 -0400 Subject: [PATCH] Added initial implementation of Db. --- libglabels/CMakeLists.txt | 1 + libglabels/Category.h | 9 +- libglabels/Db.cpp | 548 ++++++++++++++++++++++++++++++++++++++ libglabels/Db.h | 121 +++++++++ libglabels/Paper.h | 4 +- libglabels/Template.h | 6 +- libglabels/Vendor.h | 4 +- 7 files changed, 683 insertions(+), 10 deletions(-) create mode 100644 libglabels/Db.cpp create mode 100644 libglabels/Db.h diff --git a/libglabels/CMakeLists.txt b/libglabels/CMakeLists.txt index 662875b..b04f35d 100644 --- a/libglabels/CMakeLists.txt +++ b/libglabels/CMakeLists.txt @@ -17,6 +17,7 @@ set (libglabels_sources FrameEllipse.cpp StrUtil.cpp Template.cpp + Db.cpp ) set (libglabels_qobject_headers diff --git a/libglabels/Category.h b/libglabels/Category.h index a648918..6653014 100644 --- a/libglabels/Category.h +++ b/libglabels/Category.h @@ -31,17 +31,16 @@ namespace libglabels class Category { public: - Category( const QString &id, const QString &value ) : mId(id), mValue(value) + Category( const QString &id, const QString &name ) : mId(id), mName(name) { } - inline QString id() const { return mId; } - - inline QString value() const { return mValue; } + inline const QString &id() const { return mId; } + inline const QString &name() const { return mName; } private: QString mId; - QString mValue; + QString mName; }; } diff --git a/libglabels/Db.cpp b/libglabels/Db.cpp new file mode 100644 index 0000000..a364b1a --- /dev/null +++ b/libglabels/Db.cpp @@ -0,0 +1,548 @@ +/* Db.cpp + * + * Copyright (C) 2013 Jim Evins + * + * This file is part of gLabels-qt. + * + * gLabels-qt 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 3 of the License, or + * (at your option) any later version. + * + * gLabels-qt 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 gLabels-qt. If not, see . + */ + +#include "Db.h" + +#include + + +namespace libglabels +{ + + std::list mPapers; + std::list mPaperIds; + std::list mPaperNames; + std::list mCategories; + std::list mCategoryIds; + std::list mCategoryNames; + std::list mVendors; + std::list mVendorNames; + std::list