Re: [libxml++] node iterators



On Fri, 2003-02-07 at 22:26, Stefan Seefeld wrote:
> 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.

No. For instance, Attribute::get_value() copies. An accessor would be
like this:
attr.value() = "newvalue";

> 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 &);


No.

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

Or maybe a Foo that acts like a reference even when copied.

-- 
Murray Cumming
murray usa net
www.murrayc.com





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