From: Darwin S. <dar...@ho...> - 2006-06-09 21:30:19
|
Hello, Thanks that works great. The naming convention for the namespaces is perfect. I have noticed something regarding enumerations declared inside a class in a namespace that I just wanted to check with you. I have the following declaration: namespace nsa { class MyClass { public: enum MyEnum { ENUMVAL1 = 10 }; }; } The corresponding entry for the enumeration in the .i file is: %enum nsa::MyClass::MyEnum %rename nsa_MyClass_ENUMVAL1 MyClass::ENUMVAL1 %endenum I could not put the 'nsa::' before 'MyClass::ENUMVAL1' because it results in a compile error saying that nsa::nsa isn't declared. Also when accessing this value within a lua script I use: wxluanstest.nsa_nsa_MyClass_ENUMVAL1 It works fine but I just wanted to check if I'm using this properly. I have attached the source again in case you want to try it out. Thanks again for all your time and help, Darwin Slattery From: "John Labenski" <jla...@gm...> To: djs...@us..., wxl...@li... Subject: Re: [Wxlua-users] multi-level C++ namespaces Date: Thu, 8 Jun 2006 23:10:26 -0400 On 6/8/06, Darwin Slattery <dar...@ho...> wrote: >Thanks for your reply. I think I'm just missing something small here. From >your suggestions it seems that what I'm trying to do is completely possible >in the .i file. Just to clarify one point in your last mail, I'm not >looking >to declare a class within another class declaration - I just want to write >bindings for classes that have been declared in mulit-level namespaces like >nsa::nsb::nsc. It was a very small fix, but in a few different places. In order to make it work you have to use the fully qualified namespace for both the %class and the constructor. The output will be nsa_nsb_MyClass which is reasonable enough, right? It's too much trouble to try to make nested lua "namespaces" like wx.nsa.nsb.MyClass. %class %delete %noclassinfo %encapsulate nsa::nsb::MyClass nsa::nsb::MyClass() %rename nsa_nsb_MyClassFromInt nsa::nsb::MyClass(int x) %constructor nsa_nsb_MyClassFromInt(int x) You use the %rename tag or %constructor tag for alternate constructors, but you must replace the :: with _. >Thank you for your offer of looking at the code. I definitely don't want to >cause any work for you or the team and any suggestions would be >appreciated. >The attached archive has the .i and MyClass header file and I've included a >main driver file and makefile. Thanks for the sample, it really helps and saves me a lot of time when I people give me a nice little sample to work with. The next snapshot will contain the fixed binding generator. Regards, John Labenski |