Contents
TwCopyStdStringToClientFunc (function)
Description
This function is related to variables of type TW_TYPE_STDSTRING (ie. of type
This function is required because memory allocated by a dynamic library (like AntTweakBar) cannot be resized or deleted by its client application (your program) and vice versa. Thus the provided function is called by AntTweakBar to avoid bad memory handling between the two modules. If it is not provided, all variables of type
In the other way, if your application needs to copy a C++ ParametercopyStdStringToClient
The function that will be called by AntTweakBar to copy a It can be defined like this: void TW_CALL CopyStdStringToClient(std::string& destinationClientString, const std::string& sourceLibraryString) { // Copy the content of souceString handled by the AntTweakBar library to destinationClientString handled by your application destinationClientString = sourceLibraryString; } Example
An example of adding a std::string s = "a STL string"; TwBar *bar = TwNewBar("TweakBar"); TwCopyStdStringToClientFunc(CopyStdStringToClient); // CopyStdStringToClient implementation is given above // ... TwAddVarRW(bar, "s", TW_TYPE_STDSTRING, &s, "");
See TwCopyStdStringToLibrary for an example that uses See alsoTW_TYPE_STDSTRING, TwAddVarRW, TwAddVarRO, TwAddVarCB, TwCopyStdStringToLibrary, string variable examples |