[odb-users] Building GOF Composite Pattern ODB-1.5.0

Dan Coffey dcoffey at netharmonix.com
Tue Aug 2 13:30:49 EDT 2011


Hi Boris,

I'm trying to build the GOF composite pattern.

Abstract Class          - Rdolls
Leaf Class                 - RdollsLeaf
#include"rdolls.h"
#pragmadbobject

   class  RdollsLeaf  :  public  Rdolls


Group Class               -RdollsGroup
#include"rdolls.h"

   class  Rdolls;

#pragmadbobject

   class  RdollsGroup  :  public  Rdolls

     RdollsGroup has one relationship to it's base class Rdolls  on line 
22:
     QMap<QString,Rdolls>contains;

If I change RdollsGroup's one relationship to it's base class Rdolls  on 
line 22:
    QMap<QString,QString>contains;
     then no errors are generated from odb ... processing.

It seems that when I try and use a class that I defined (RdollsGroup) 
then I have a problem.
How do I fix this so I can use a QMap<key, value> were either of both 
the key and value are locally defined?

Both Rdolls and RdollsLeaf are processed correctly by odb.
When I run the:
odb -d mysql --profile qt --profile boost --generate-query 
--generate-schema rdollsgroup.h

I get the following error:
rdollsgroup.h:22:25: error: unable to map C++ type '*::Rdolls*' used in 
data member 'contains' to a database type
rdollsgroup.h:22:25: info: use '#pragma db value_type' to specify the 
database type

Thanks,

Dan


More information about the odb-users mailing list