Re: [libxml++] node iterators



Murray Cumming wrote:
On Fri, 2003-02-07 at 19:01, Stefan Seefeld wrote:

agreed. In fact, the more I think about suggestion 2) the more I like
it: the 'Node' class has a 'get_children()' and a 'get_attribute()'


children() and attributes() would be better, because they are accessors
rather than getters - If it was get_children() then I might expect to
have to use set_children() again after making changes. This is what we
do for gtkmm.

It's the first time I see this approach. 'get_something' usually is an
accessor, not a (copy-making) extractor.

The two cases I'v come across so far is:

Foo get_something();
void set_something(const Foo &);

and

Foo something();
void something(const Foo &);

The later is especially interesting as it complies with the CORBA IDL to C++ mapping for attributes.

Whatever the naming, never was any semantic implied as to whether it would return a copy or a reference, i.e. whether changes would apply
to the original or not. Thus I don't expect the naming 'children()' vs.
'get_children()' to make any difference in this respect. We have to
be clear in the docs that the returned objects are not copies, but
references.

In a nutshell, I'd suggest to either use 'Foo get_something()' or
'Foo something()' consistently (and exclusively).

Stefan





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]