Creating Customized Mappings
HydraExpress enables you to customize the mapping of names, types and namespaces. HydraExpress’s default mapping settings, for example, map schema types string, date, and dateTime to the Standard C++ Library type std::string. You can customize this mapping so that these schema types instead map to your own C++ types.
To generate code that uses classes from SourcePro C++, simply use the
‑sourcePro command line option. SourcePro C++ contains classes that map naturally onto XML data types. For example, code generated with the
-sourcepro option maps the schema types
date and
dateTime to the classes
RWDate and
RWDateTime. SourcePro C++ classes allow HydraExpress to create a convenient type-safe data binding without requiring a customized mapping configuration file. For a complete list of the SourcePro C++ type mappings, see
Table 4.
To replace the mapping of all built-in schema types to your own C++ type, use the -datamap option at code generation, providing as an argument a configuration file containing a mappings element to identify the new mapping. Using the -datamap option results in an entirely new mapping of all schema types.
To customize the mapping of specific class names and types to your own C++ types, create a special HydraExpress project file containing the mappings element to specify the mapping, and then provide this file to the code generator at invocation. Alternatively, you may add the mappings element and its contents directly to an already-existing HydraExpress project file.