NameValuePairList erase method ...

4 views
Skip to first unread message

futnuh

unread,
Sep 13, 2010, 8:48:57 PM9/13/10
to Python Ogre Developers
I'm trying to remove a key from an existing NameValuePairList. I
believe python-ogre isn't exposing the erase method ...

In http://www.ogre3d.org/docs/api/html/OgreCommon_8h_source.html
00524 typedef map<String, String>::type NameValuePairList;

STL's map
http://www.cplusplus.com/reference/stl/map/erase/

>>> import ogre.renderer.OGRE as ogre
>>> nv = ogre.NameValuePairList()
>>> dir(nv)
['NameValuePairList_entry', '__class__', '__contains__',
'__delattr__', '__delitem__', '__dict__', '__doc__', '__format__',
'__getattribute__', '__getitem__', '__hash__', '__init__',
'__instance_size__', '__iter__', '__len__', '__module__', '__new__',
'__reduce__', '__reduce_ex__', '__repr__', '__setattr__',
'__setitem__', '__sizeof__', '__str__', '__subclasshook__',
'__weakref__', 'count', 'has_key', 'insert', 'keys']
>>> nv.erase
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NameValuePairList' object has no attribute 'erase'

Cheers,
Darran.

andy miller

unread,
Sep 14, 2010, 12:53:21 AM9/14/10
to python-ogre-developers
Probably a limitation of the boost implementation that I'd need to look at -- would be great if you could add it to the bug tracker on sourceforce...

In the mean time you might want to think about keeping a regular python dictionary as your 'master' and creating a NameValuePair based upon that dictionary each time you use it..  Not as efficient but should serve as a work around...

Regards
Andy 


--
You received this message because you are subscribed to the Google Groups "Python Ogre Developers" group.
To post to this group, send email to python-ogre...@googlegroups.com.
To unsubscribe from this group, send email to python-ogre-devel...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/python-ogre-developers?hl=en.


dermont

unread,
Sep 14, 2010, 1:15:35 AM9/14/10
to Python Ogre Developers
I thought NameValuePairList was already exposed as a python
dictionary, can you simply not remove a key by:

>>del nv['MyKey']

On Sep 14, 12:53 pm, andy miller <a...@kiwisoft.com> wrote:
> Probably a limitation of the boost implementation that I'd need to look at
> -- would be great if you could add it to the bug tracker on sourceforce...
>
> In the mean time you might want to think about keeping a regular python
> dictionary as your 'master' and creating a NameValuePair based upon that
> dictionary each time you use it..  Not as efficient but should serve as a
> work around...
>
> Regards
> Andy
>
> On Tue, Sep 14, 2010 at 8:48 AM, futnuh <dar...@edmstudio.com> wrote:
> > I'm trying to remove a key from an existing NameValuePairList.   I
> > believe python-ogre isn't exposing the erase method ...
>
> > Inhttp://www.ogre3d.org/docs/api/html/OgreCommon_8h_source.html
> > python-ogre-devel...@googlegroups.com<python-ogre-developers%2Bunsu...@googlegroups.com>
> > .

futnuh

unread,
Sep 14, 2010, 3:59:42 AM9/14/10
to Python Ogre Developers
Dermont's right, it's already a python dict (albeit restricted to
strings for both keys and values).
Reply all
Reply to author
Forward
0 new messages