ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> cpp-sig
cpp-sig
[C++-sig] Re: (return_self_policy / return_arg): Keywors
by David Abrahams other posts by this author
Jun 30 2003 4:25AM messages near this date
[C++-sig] Re: (return_self_policy / return_arg): Keywors | [C++-sig] Re: (return_self_policy / return_arg): Keywors
Nikolay Mladenov <nickm@[...].com>  writes:

>  This is how I use it:

Reformatting to avoid "endline layout" (google for it):

/////the.cpp////
    class_<FileDialog, FileDialogPyX, boost::noncopyable> (
        "FileDialog", python::no_init
    )
        .def(
             init<
                 const char *
               , const char *
               , const char *
               , const char *
               , const char *
             > (
                 args(
                     arg("title") = (const char *)0
                   , arg("prompt") = (const char *)0
                   , arg("extension") = (const char *)0
                   , arg("directory") = (const char *)0
                   , arg("file") = (const char *)0
                  )
               )
          )
          .def(
               init<
                   optional<
                       const char *
                     , const char *
                     , const char *
                     , const char *
                     , const char *
                   >  
               > ()
          )

/////the.py////

	fd1 = FileDialog()
	fd2 = FileDialog("Title")
	fd2 = FileDialog(title="Title")
	fd2 = FileDialog("Title", extension='.py', prompt='Select your script')

OK, I don't understand this.  Isn't the 2nd constructor redundant?
Why are you using no_init?  Doesn't this stuff work for regular
functions and member functions, too?

...and shouldn't we get rid of the need to write the outer
"args(...)"?

I suggest you write the documentation which would explain all this,
but posting informally is fine if you try to ensure that I don't have
to ask you lots more questions in order to understand it ;-)

> > Nit: the coding style should be made consistent with the rest of the
> > library.  These don't really fit:
> > 
> > >                     std::size_t j = nargs, k = nargs, size=PyTuple_GET_SIZE(f->m_arg_na
mes.ptr());
> > 
> > >                         }else ++k;
> > 
> 
>  I will look into this. If you mean that some new line are missing,
>  consider it fixed.

Also that you used commas between variable declarations, K&R braces
within functions, no spaces around '?', '<', '> ', ...

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com


_______________________________________________
C++-sig mailing list
C++-sig@[...].org
http://mail.python.org/mailman/listinfo/c++-sig
Thread:
Nikolay Mladenov
David Abrahams
David Abrahams
Joel de Guzman
David Abrahams
Nikolay Mladenov
David Abrahams
Nikolay Mladenov
David Abrahams
Nikolay Mladenov
Nikolay Mladenov
David Abrahams
David Abrahams
Nikolay Mladenov
Nikolay Mladenov
David Abrahams
Nikolay Mladenov
David Abrahams
Nikolay Mladenov
David Abrahams
Nikolay Mladenov
David Abrahams
Nikolay Mladenov
David Abrahams
Nikolay Mladenov
David Abrahams

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved