[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv...
From: |
Bastiaan Jacques |
Subject: |
Re: [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv... |
Date: |
Sat, 23 Sep 2006 23:42:21 +0200 |
User-agent: |
KMail/1.9.4 |
On Thursday 21 September 2006 15:54, Sandro Santilli wrote:
> CVSROOT: /sources/gnash
> Module name: gnash
> Changes by: Sandro Santilli <strk> 06/09/21 13:54:45
>
> Modified files:
> . : ChangeLog
> server : sprite_instance.cpp sprite_instance.h
>
> Log message:
> sprite_instance: public method and a lazily-allocated map for
> textfield variables; scan textfield variable names in both set_member
> and get_member; compiler warnings removed
>
[snip]
> {
> m_root->set_background_color(color);
> }
> +
> +/* public */
> +void
> +sprite_instance::set_textfield_variable(const std::string& name,
> + edit_text_character* ch)
> +{
> + assert(ch);
> +
> + // lazy allocation
> + if ( ! _text_variables.get() )
(1)
> + {
> + _text_variables.reset(new TextfieldMap);
> + }
> +
> + // TODO: should variable name be considered case-insensitive ?
> + _text_variables->operator[] (name) = ch;
> +}
> +
> +/* private */
> +edit_text_character*
> +sprite_instance::get_textfield_variable(const std::string& name)
> +{
> + // nothing allocated yet...
> + if ( _text_variables.get() == NULL ) return NULL;
Style nit: at (1) you check for NULL using !, and now you check by
comparing to NULL directly. Please consider using one of them (I prefer
the former) consistently.
> +
> + // TODO: should variable name be considered case-insensitive ?
> + TextfieldMap::iterator it = _text_variables->find(name);
> + if ( it == _text_variables->end() )
> + {
> + return NULL;
> + }
> + else
> + {
> + return it->second.get_ptr();
> + }
> +}
> +
> } // namespace gnash
>
[snip]
Bastiaan