Discussion:
wxCharBuffer missing release?
Alec Teal
2014-10-21 22:12:40 UTC
Permalink
http://docs.wxwidgets.org/3.0.2/classwx_char_buffer.html

This used to have a "release" method I'm sure of it, that'd give you the
internal pointer and make the class give up all claim to the data (ie
not delete it)

Where's it gone?

For the rare cases where you want to pull the data out for an unknown
amount of time (keeping the char buffer alive is not viable) can we do
it? Without copying?

Alec
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Vadim Zeitlin
2014-10-22 16:08:23 UTC
Permalink
On Tue, 21 Oct 2014 23:12:40 +0100 Alec Teal wrote:

AT> http://docs.wxwidgets.org/3.0.2/classwx_char_buffer.html
AT>
AT> This used to have a "release" method I'm sure of it, that'd give you the
AT> internal pointer and make the class give up all claim to the data (ie
AT> not delete it)
AT>
AT> Where's it gone?

It's in the base wxScopedCharBuffer class.

AT> For the rare cases where you want to pull the data out for an unknown
AT> amount of time (keeping the char buffer alive is not viable) can we do
AT> it? Without copying?

Yes, provided the buffer is the sole owner of the data.

Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
Alec Teal
2014-10-22 18:24:15 UTC
Permalink
AT> http://docs.wxwidgets.org/3.0.2/classwx_char_buffer.html
AT>
AT> This used to have a "release" method I'm sure of it, that'd give you the
AT> internal pointer and make the class give up all claim to the data (ie
AT> not delete it)
AT>
AT> Where's it gone?
It's in the base wxScopedCharBuffer class.
It really isn't, not any more at least:

(I did a find on the page before sending my first email)

Here's the list:

void reset
<http://docs.wxwidgets.org/3.0.2/classwx_scoped_char_type_buffer.html#ab9681b17d94b2bdd44b1845c79561bee>
()
Resets the buffer to NULL, freeing the data if necessary.
CharType
<http://docs.wxwidgets.org/3.0.2/classwx_scoped_char_type_buffer.html#af80c4ff48b92f8e01b6167ff0468e213>
* data
<http://docs.wxwidgets.org/3.0.2/classwx_scoped_char_type_buffer.html#a7cd7ba0ab32e9f63779f602c2bdfd9b8>
()
Returns pointer to the stored data.
const CharType
<http://docs.wxwidgets.org/3.0.2/classwx_scoped_char_type_buffer.html#af80c4ff48b92f8e01b6167ff0468e213>
* data
<http://docs.wxwidgets.org/3.0.2/classwx_scoped_char_type_buffer.html#a246f355f8c369f155f34834980f9b332>
() const
Returns const pointer to the stored data.
size_t length
<http://docs.wxwidgets.org/3.0.2/classwx_scoped_char_type_buffer.html#a6402a288ccf377622d973d65b90a8d50>
() const
Returns length of the string stored.
operator const CharType *
<http://docs.wxwidgets.org/3.0.2/classwx_scoped_char_type_buffer.html#ac99fcaf848d1a724e926373055573c6d>
() const
Implicit conversion to C string.
CharType
<http://docs.wxwidgets.org/3.0.2/classwx_scoped_char_type_buffer.html#af80c4ff48b92f8e01b6167ff0468e213>
operator[]
<http://docs.wxwidgets.org/3.0.2/classwx_scoped_char_type_buffer.html#a194bab9294740ccb17d78b2caa2ea671>
(size_t n) const
Random access to the stored C string.
AT> For the rare cases where you want to pull the data out for an unknown
AT> amount of time (keeping the char buffer alive is not viable) can we do
AT> it? Without copying?
Yes, provided the buffer is the sole owner of the data.
Regards,
VZ
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Vadim Zeitlin
2014-10-23 13:56:53 UTC
Permalink
[please don't cc me the messages posted to the list, thanks]

On Wed, 22 Oct 2014 19:24:15 +0100 Alec Teal wrote:

AT> On 22/10/14 17:08, Vadim Zeitlin wrote:
AT> > On Tue, 21 Oct 2014 23:12:40 +0100 Alec Teal wrote:
AT> >
AT> > AT> http://docs.wxwidgets.org/3.0.2/classwx_char_buffer.html
AT> > AT>
AT> > AT> This used to have a "release" method I'm sure of it, that'd give you the
AT> > AT> internal pointer and make the class give up all claim to the data (ie
AT> > AT> not delete it)
AT> > AT>
AT> > AT> Where's it gone?
AT> >
AT> > It's in the base wxScopedCharBuffer class.
AT> It really isn't, not any more at least:
AT>
AT> (I did a find on the page before sending my first email)

Sorry, I didn't realize you were speaking about the documentation, I
thought the problem was with not finding it in wxCharBuffer class itself.

I've documented it now, see http://trac.wxwidgets.org/changeset/78055

Thanks,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
Alec Teal
2014-10-23 14:03:22 UTC
Permalink
Post by Vadim Zeitlin
[please don't cc me the messages posted to the list, thanks]
Reply-all reflex, noted!
Post by Vadim Zeitlin
AT> >
AT> > AT> http://docs.wxwidgets.org/3.0.2/classwx_char_buffer.html
AT> > AT>
AT> > AT> This used to have a "release" method I'm sure of it, that'd give you the
AT> > AT> internal pointer and make the class give up all claim to the data (ie
AT> > AT> not delete it)
AT> > AT>
AT> > AT> Where's it gone?
AT> >
AT> > It's in the base wxScopedCharBuffer class.
AT>
AT> (I did a find on the page before sending my first email)
Sorry, I didn't realize you were speaking about the documentation, I
thought the problem was with not finding it in wxCharBuffer class itself.
I've documented it now, see http://trac.wxwidgets.org/changeset/78055
Sorry about that, I only have 2.8.x to hand and a friend asked me about
c strings, he's using 3.0.2 I think, and I wanted to check first!

Alec
Post by Vadim Zeitlin
Thanks,
VZ
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Loading...