Data Types
Due to how windows handles memory access between
an application and dynamically loaded DLLs, there are a few custom data
types that are used in the API. These are used for common STL style
containers, for strings and lists.
Any text passed back from the API or events will
come in the form of a bzApiString. This is a class defined in the API
that behaves much like a std::string. The c_str() method can be used to
get the text out as a normal const char*. The class also supports many
assignment functions for setting it's contents.
A few API functions require lists of integers,
strings, or floats. For these functions the plugin will need to use the
bzAPIIntList, bzAPIFloatList, or bzAPIStringList classes. These classes
are similar to the std::vector. When a plugin needs to allocate one of
these lists, it must use the appropriate allocator function, to tell
the API to make a new list for the plugin to use. These functions are
bz_newIntList, bz_newFloatList, and bz_newStringList. These will return
a pointer to a new list for the plugin to use. When the plugin is
finished with the list, it needs to remove the list with a call to
bz_deleteIntList, bz_deleteFloatList, or bz_deleteStringList as
appropriate.
Sadly these are a little clunky but are required
to let bzfs allocate any memory it may free on windows. Hopefully
future releases of windows will remove this limitation.
The text based classes also include some utility functions such as replace all and tokenize |