1
I started today programming using Qxorm for persistence layer for testing, and as I use the eclipse for all my projects, I immediately created a first test project importing into Eclipse.
But the classes created in the file .cpp
refer to the header files .h
so when imported in eclipse, where I am referencing the folder src and include source, it does not find headers.
Follow below image that shows directory structure to become clearer and then a couple of files from an entity:
File . h
/************************************************************************************************
** File created by QxEntityEditor 1.1.9 (2016/11/07 19:30) : please, do NOT modify this file ! **
************************************************************************************************/
#ifndef _TESTE_IEP_PORTAL_ALUNO_H_
#define _TESTE_IEP_PORTAL_ALUNO_H_
#ifdef _QX_NO_PRECOMPILED_HEADER
#ifndef Q_MOC_RUN
#include "../include/teste_precompiled_header.gen.h" // Need to include precompiled header for the generated moc file
#endif // Q_MOC_RUN
#endif // _QX_NO_PRECOMPILED_HEADER
namespace iep {
namespace portal {
class Professor;
} // namespace portal
} // namespace iep
namespace iep {
namespace portal {
class TESTE_EXPORT Aluno : public QObject, public qx::IxPersistable
{
Q_OBJECT
QX_REGISTER_FRIEND_CLASS(iep::portal::Aluno)
QX_PERSISTABLE_HPP(iep::portal::Aluno)
public:
typedef qx::QxCollection<long, boost::shared_ptr<iep::portal::Professor> > type_professores;
protected:
long m_id;
QString m_nome;
QString m_sobrenome;
QString m_email;
QString m_apelido;
type_professores m_professores;
public:
Aluno();
Aluno(const long & id);
virtual ~Aluno();
long getid() const;
QString getnome() const;
QString getsobrenome() const;
QString getemail() const;
QString getapelido() const;
type_professores getprofessores() const;
type_professores & professores();
const type_professores & professores() const;
void setid(const long & val);
void setnome(const QString & val);
void setsobrenome(const QString & val);
void setemail(const QString & val);
void setapelido(const QString & val);
void setprofessores(const type_professores & val);
type_professores getprofessores(bool bLoadFromDatabase, const QString & sAppendRelations = QString(), QSqlDatabase * pDatabase = NULL, QSqlError * pDaoError = NULL);
type_professores & professores(bool bLoadFromDatabase, const QString & sAppendRelations = QString(), QSqlDatabase * pDatabase = NULL, QSqlError * pDaoError = NULL);
public:
static QString relation_professores() { return "professores"; }
public:
static QString column_id() { return "id"; }
static QString column_nome() { return "nome"; }
static QString column_sobrenome() { return "sobrenome"; }
static QString column_email() { return "email"; }
static QString column_apelido() { return "apelido"; }
public:
static QString table_name() { return "Aluno"; }
};
typedef qx_shared_ptr<Aluno> Aluno_ptr;
typedef qx::QxCollection<long, Aluno_ptr> list_of_Aluno;
typedef qx_shared_ptr<list_of_Aluno> list_of_Aluno_ptr;
} // namespace portal
} // namespace iep
QX_REGISTER_COMPLEX_CLASS_NAME_HPP_TESTE(iep::portal::Aluno, QObject, 0, iep_portal_Aluno)
#include "../include/iep_portal_Professor.gen.h"
#include "../custom/include/iep_portal_Aluno.h"
#endif // _TESTE_IEP_PORTAL_ALUNO_H_
cpp file:
/************************************************************************************************
** File created by QxEntityEditor 1.1.9 (2016/11/07 19:30) : please, do NOT modify this file ! **
************************************************************************************************/
#include "../include/teste_precompiled_header.gen.h"
#include "../include/iep_portal_Aluno.gen.h"
#include "../include/iep_portal_Professor.gen.h"
#include <QxMemLeak.h>
QX_REGISTER_COMPLEX_CLASS_NAME_CPP_TESTE(iep::portal::Aluno, iep_portal_Aluno)
namespace qx {
template <>
void register_class(QxClass<iep::portal::Aluno> & t)
{
qx::IxDataMember * pData = NULL; Q_UNUSED(pData);
qx::IxSqlRelation * pRelation = NULL; Q_UNUSED(pRelation);
qx::IxFunction * pFct = NULL; Q_UNUSED(pFct);
qx::IxValidator * pValidator = NULL; Q_UNUSED(pValidator);
t.setName("Aluno");
pData = t.id(& iep::portal::Aluno::m_id, "id", 0);
pData = t.data(& iep::portal::Aluno::m_nome, "nome", 0, true, true);
pData = t.data(& iep::portal::Aluno::m_sobrenome, "sobrenome", 0, true, true);
pData = t.data(& iep::portal::Aluno::m_email, "email", 0, true, true);
pData = t.data(& iep::portal::Aluno::m_apelido, "apelido", 0, true, true);
pRelation = t.relationManyToMany(& iep::portal::Aluno::m_professores, "professores", "t_qxee_Professor_Aluno", "idprofessor", "idAluno", 0);
qx::QxValidatorX<iep::portal::Aluno> * pAllValidator = t.getAllValidator(); Q_UNUSED(pAllValidator);
}
} // namespace qx
namespace iep {
namespace portal {
QX_PERSISTABLE_CPP(Aluno)
Aluno::Aluno() : m_id(0) { ; }
Aluno::Aluno(const long & id) : m_id(id) { ; }
Aluno::~Aluno() { ; }
long Aluno::getid() const { return m_id; }
QString Aluno::getnome() const { return m_nome; }
QString Aluno::getsobrenome() const { return m_sobrenome; }
QString Aluno::getemail() const { return m_email; }
QString Aluno::getapelido() const { return m_apelido; }
Aluno::type_professores Aluno::getprofessores() const { return m_professores; }
Aluno::type_professores & Aluno::professores() { return m_professores; }
const Aluno::type_professores & Aluno::professores() const { return m_professores; }
void Aluno::setid(const long & val) { m_id = val; }
void Aluno::setnome(const QString & val) { m_nome = val; }
void Aluno::setsobrenome(const QString & val) { m_sobrenome = val; }
void Aluno::setemail(const QString & val) { m_email = val; }
void Aluno::setapelido(const QString & val) { m_apelido = val; }
void Aluno::setprofessores(const Aluno::type_professores & val) { m_professores = val; }
Aluno::type_professores Aluno::getprofessores(bool bLoadFromDatabase, const QString & sAppendRelations /* = QString() */, QSqlDatabase * pDatabase /* = NULL */, QSqlError * pDaoError /* = NULL */)
{
if (pDaoError) { (* pDaoError) = QSqlError(); }
if (! bLoadFromDatabase) { return getprofessores(); }
QString sRelation = "professores";
if (! sAppendRelations.isEmpty() && ! sAppendRelations.startsWith("->") && ! sAppendRelations.startsWith(">>")) { sRelation += "->" + sAppendRelations; }
else if (! sAppendRelations.isEmpty()) { sRelation += sAppendRelations; }
iep::portal::Aluno tmp;
tmp.m_id = this->m_id;
QSqlError daoError = qx::dao::fetch_by_id_with_relation(sRelation, tmp, pDatabase);
if (! daoError.isValid()) { this->m_professores = tmp.m_professores; }
if (pDaoError) { (* pDaoError) = daoError; }
return m_professores;
}
Aluno::type_professores & Aluno::professores(bool bLoadFromDatabase, const QString & sAppendRelations /* = QString() */, QSqlDatabase * pDatabase /* = NULL */, QSqlError * pDaoError /* = NULL */)
{
if (pDaoError) { (* pDaoError) = QSqlError(); }
if (! bLoadFromDatabase) { return professores(); }
QString sRelation = "professores";
if (! sAppendRelations.isEmpty() && ! sAppendRelations.startsWith("->") && ! sAppendRelations.startsWith(">>")) { sRelation += "->" + sAppendRelations; }
else if (! sAppendRelations.isEmpty()) { sRelation += sAppendRelations; }
iep::portal::Aluno tmp;
tmp.m_id = this->m_id;
QSqlError daoError = qx::dao::fetch_by_id_with_relation(sRelation, tmp, pDatabase);
if (! daoError.isValid()) { this->m_professores = tmp.m_professores; }
if (pDaoError) { (* pDaoError) = daoError; }
return m_professores;
}
} // namespace portal
} // namespace iep