[odb-users] Unable to map a member of a member via #pragma

Cezan Meyen cezanmeyen at gmail.com
Fri Apr 5 09:44:24 EDT 2019


Hello there,

I am currently implementing ODB in a existing program and therefore I am
unable to change the models. And it is working great so far but I am
currently  stuck on a single object member. I need in some way access to
the member or a member via the pragma's. I don’t know if this is possible
at all but I cannot find a way to map this member. I might be doing
something completly wrong. I some posted example code underneath here for
some context.

template<size_t max_length>
struct FixString
{
    public:
        sampleget();
        sampleSet();
    private
        char m_str[max_length + 1];

}
typedef FixString<24> name_string;



struct string_id
{
    public:
    FixString<24> uuid;
}
typedef string_id ID;


struct main
{
    name_string name;
    ID id;
}

//pragmas contained in a different file
#pragma db object(main)

#pragma db value(name_string)
#pragma db member(name_string::m_str) get(sampleget()) set(sampleSet())
// this works okay!

#pragma db value(ID)
#pragma db member(ID::uuid)                           //unable to map C++
type 'FixString<24>'   <--- expected error
#pragma db member(ID::uuid::m_str)                //unable to resolve type
name '::ID::uuid' in db pragma member
I can't seem to access m_str form ID which is necessary to define the get
and set.

Kind regards,
Cezan


More information about the odb-users mailing list