Skip to content

Question about 'decl_string' and 'partial_decl_string' #46

@ghost

Description

When trying to scan the bindings for a module (ns-3), I get an error with the tokens because it is None. Tracking down the error, I see the cast parser uses the partial declaration to normalize a name [normalize_name(alias.decl_type.partial_decl_string)]. However, the problem comes because the 'decl_string' and 'partial_decl_string' are different:

namespace ns3 {

struct GabA
{
  uint32_t m_varU {0};
  double m_varD {0.0};
};

struct GabD
{
  uint32_t m_varU {0};
  double m_varD {0.0};
};

typedef std::function<GabD & (const std::shared_ptr<GabA> &ga)> GabSharedFn;
typedef std::function<GabD & (const std::unique_ptr<GabA> &ga)> GabUniqueFn;
}

When the code is parsed, these are the decl_string and partial_decl_string for the two typedefs:

  1. GabSharedFn
partial_decl_string:'::std::function< ns3::GabD &(const std::shared_ptr< ns3::GabA > >'
decl_string:'::std::function<ns3::GabD &(const std::shared_ptr<ns3::GabA> &)>'
  1. GabUniqueFn
partial_decl_string:'::std::function< ns3::GabD &(const std::unique_ptr< ns3::GabA, std::default_delete< ns3::GabA > > >'
decl_string:'::std::function<ns3::GabD &(const std::unique_ptr<ns3::GabA, std::default_delete<ns3::GabA> > &)>'

As you can see, both partial declaration strings are missing &) and that is why I get the error. I had to hard-code this inside the typehandlers directory because I could not figure out where the classes are parsed (i.e., where partial_decl_string and decl_string are created). It seems to me that pygccxml takes care of that but I am not sure. Do you know where the partial_decl_string and decl_string are created?

I would appreciate your feedback.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions