maxon::String in classic API



  • While converting a plugin to R20 I was replacing all String occurrences with maxon::String.
    However, I encountered some issue when compiling.
    Maybe I am just not understanding the conversion process correctly?
    As such, I didn't add tags for "bug report", "issue", "API" ... feel free to add the required once.

    As far as I am aware I am still using the classic API for most of the plugin structure, but am using the MAXON API for the new datastructures.
    maxon::BasseArray::Append, for instance, requires the use of the new error system, etc ...

    According to

    Using new Data Types
    
    The MAXON API introduces new data types and replaces or extends classic data types:
    
        The new maxon::String class is the base class of the classic String class. To declare a string literal as a maxon::String one can use the "_s" qualifier. The classic API has been refactured to use maxon::String wherever possible. ...
    
    

    From reading the last sentence, I was assuming converting to maxon::String was the way to go.
    However, the SNHookClass (and thus derived classes) still seem to work with the legacy String

    0_1545139739941_maxonstring snhookclass.png

    Should I refrain from using maxon::String here and use the legacy String instead?



  • You probably have declared the String as const String& instead of const maxon::String& in the parent class SNHookClass.
    Hope it helped you.



  • Well, that is what I mean.
    The documentation says the classic API has been refactored, but the SNHookClass apparently isn't.



  • Well I guess that is because the cinema.framework still contains the classic c4d API as mentioned on the Maxon documentation.


  • Global Moderator

    Hello,

    if you implement a function of a sub-class, the function signature must match the function declaration in the base class. So if the base class is using String, you must use String in your implementation.

    As the documentation says, maxon::String was used wherever possible. Not everywhere.

    best wishes,
    Sebastian



  • Thanks for the confirmation SNHookClass still using the legacy String.