U++ framework
Do not panic. Ask here before giving up.

Home » Developing U++ » UppHub » Anonymous delegates
Anonymous delegates [message #12261] Mon, 22 October 2007 16:21 Go to previous message
Factor is currently offline  Factor
Messages: 5
Registered: June 2007
Location: Hungary
Promising Member
I've written a simple header file with some macros and classes to implement a primitive form of anonymous delegates. It also contains some sort of foreach macro to use with UPP container classes.
I'll extend it in the future. Maybe somebody finds it usefull.

Example:

  DELEGATE(button, WhenAction,
    _this.Title("Title changed!");
  );

  DELEGATE1(button, WhenAction,
    String, s, "Parameter test",
    {
        PromptOK(s);
        _this.Title(s);
    });
  ...
  Vector<String> list;
  ...
  foreach(String v,list, PromptOK(v));

  String s;
  foreach(String v, list,
    s+=v;
    PromptOK(s);
  );


  • Attachment: delegates.h
    (Size: 4.73KB, Downloaded 520 times)
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: FontSel dialog
Next Topic: ChessBoard
Goto Forum:
  


Current Time: Sun Aug 02 17:00:52 GMT+2 2026

Total time taken to generate the page: 0.00632 seconds