Git commit fd758f5f55285e37bbb52fa6f57c70372d9d6be0 by Jos=C3=A9 Manuel San= tamar=C3=ADa Lema. Committed on 10/07/2016 at 18:38. Pushed by joselema into branch 'master'. Add initial KreElement implementation. M +7 -0 src/CMakeLists.txt A +39 -0 src/dtos/kreelement.cpp [License: GPL (v2+)] A +34 -0 src/dtos/kreelement.h [License: GPL (v2+)] http://commits.kde.org/krecipes/fd758f5f55285e37bbb52fa6f57c70372d9d6be0 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1a8681f..694ccdf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,6 +19,12 @@ add_definitions (-DQT3_SUPPORT) add_definitions (-DQT3_SUPPORT_WARNINGS) #add_definitions (-DKRECIPES_DEPRECATED_WARNINGS) = +############### dtos ################# + +set(krecipesdtos_SRCS + dtos/kreelement.cpp + ) + ############# backends ############### = set(sqlite_SRCS backends/SQLite/literecipedb.cpp) @@ -288,6 +294,7 @@ set(validators_SRCS # (i.e. I want to save CPU time when compiling with test programs) = kde4_add_library(krecipescommon STATIC + ${krecipesdtos_SRCS} ${mysql_SRCS} ${postgresql_SRCS} ${sqlite_SRCS} ${krecipesdbs_SRCS} ${krecipesmodels_SRCS} ${krecipesimporters_SRCS} ${krecipesexporters_SRCS} diff --git a/src/dtos/kreelement.cpp b/src/dtos/kreelement.cpp new file mode 100644 index 0000000..e490dc6 --- /dev/null +++ b/src/dtos/kreelement.cpp @@ -0,0 +1,39 @@ +/*************************************************************************= ** +* Copyright =C2=A9 2016 Jos=C3=A9 Manuel Santamar=C3=ADa Lema * +* = * +* 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 "kreelement.h" + +KreElement::KreElement() +{ +} + +KreElement::KreElement( const QVariant & id, const QString & name ) : + m_id( id ), m_name( name ) +{ +} + +QVariant KreElement::id() const +{ + return m_id; +} + +void KreElement::setId( const QVariant & id ) +{ + m_id =3D id; +} + +QString KreElement::name() const +{ + return m_name; +} + +void KreElement::setName( const QString & name ) +{ + m_name =3D name; +} diff --git a/src/dtos/kreelement.h b/src/dtos/kreelement.h new file mode 100644 index 0000000..48818e2 --- /dev/null +++ b/src/dtos/kreelement.h @@ -0,0 +1,34 @@ +/*************************************************************************= ** +* Copyright =C2=A9 2016 Jos=C3=A9 Manuel Santamar=C3=ADa Lema * +* = * +* 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 KREELEMENT_H +#define KREELEMENT_H + +#include +#include + +class KreElement { + +public: + KreElement(); + KreElement( const QVariant & id, const QString & name ); + + QVariant id() const; + void setId( const QVariant & id ); + + QString name() const; + void setName( const QString & name ); + +protected: + QVariant m_id; + QString m_name; + +}; + +#endif