Extending C.O.F.F.E.E. string functions



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 07/04/2003 at 07:58, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   7.303 
    Platform:   Windows  ;   
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    Hi,
    I'd like to know whether it's possible to extend C.O.F.F.E.E.'s default string functions in an object-oriented manner. I'm currently working on porting some javascript string manipulation code to C.O.F.F.E.E. and like to have an equivalent to Javascripts

        
        
        .indexOf()
    

    or

        
        
        substring()
    

    methods in order to reduce porting time.
    I aim to make the following coffee Statement possible:

        
        
        var mystring = "I am a String";
        
        
        
        
        if (mystring->indexOf("am") != -1)
        
        
        
        
        {
        
        
        
        
        // Code goes here
        
        
        
        
        }
        
        
        
    

    Does anyone know how to extend default C.O.F.F.E.E.  objects with custom methods and properties ?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 11/04/2003 at 12:26, xxxxxxxx wrote:

    That isn't possible. The closest thing would be to create an adapter class (http://c2.com/cgi/wiki?AdapterPattern) and use it whenever you create a string. However, since C.O.F.F.E.E. doesn't have any automatic conversion functions etc. the overhead would be painful.


Log in to reply