[xsd-users] Customizing a type with a typedef

Boris Kolpackov boris at codesynthesis.com
Thu May 17 12:40:16 EDT 2007


Hi Ray,

Ray Lischner <rlischner at proteus-technologies.com> writes:

> I want to implement a custom type with a typedef, but I can't because
> Code Synthesis generates a forward class declaration.
>
> I want to implement CUnsignedByte, CUnsignedShort, CUnsignedInt,
> and CUnsignedLong. Naturally, I implemented a single template,
> CUnsigned<T>, and want to define the specific types as typedefs:
>
> typedef CUnsigned<uint8_t> CUnsignedByte;

You can do it like this:

--custom-type "CUnsignedByte=CUnsigned<uint8_t>"

This will result in

typedef CUnsigned<uint8_t> CUnsignedByte;

Instead of the forward declaration. All you need to do is to include
the header where the CUnsigned class template is defined (e.g., using
the --hxx-prologue option).

BTW, various ways to use the --custom-type option are covered in the
C++/Tree Mapping Customization Guide:


http://wiki.codesynthesis.com/Tree/Customization_guide


hth,
-boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070517/860a58a1/attachment.pgp


More information about the xsd-users mailing list