Closed
Bug 70870
Opened 24 years ago
Closed 16 years ago
nsBuffer - class for buffer-type operations
Categories
(Core :: XPCOM, enhancement)
Core
XPCOM
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: rbs, Assigned: scc)
References
Details
The foundation provides by the string classes is the most pervasive throughout
mozilla. As expected, these string classes are mainly used for string
operations, but they are often quite effective for buffer-type operations too.
This bug is a request for a more formal sub-class, nsBuffer, aimed at such
purposes. Essentially, nsBuffer is an array of (0-included) bytes which supports
string-like operations such as AppendByte(), ByteAt(), InsertByte(),
Insert(void* aData, PRInt32 aLength), etc. i.e., just the renamed versions of
string-like operations, and in fact they internally map to the underlying string
class from which nsBuffer is intended to be derived.
The primary motivation of this RFE is that it makes it clear to consumers
that they have full control of the "buffer", and that they can append different
sorts of "raw" data in their buffer, provided they cache away the starting
indices and lengths of the fragments. Thus if I declare, "nsBuffer buf", my
state of mind is that "buf" is conceptually an infinite buffer (thanks to the
hidden auto-growing capabilities of the string classes...). This has a very much
different effect in the mind, compared to saying "nsCString buf", and then going
on to set a length (to avoid the '0'-problem), and appending integers to it...
It is also a help to other developers who read the code because when they see
"nsBuffer buf", it would be immediately clear to them to that "buf" needs
special care.
Assignee | ||
Comment 2•24 years ago
|
||
I have just what you need :-) The buffer classes underlying all the string
implementations can do exactly what you want. They are defined in
"nsBufferHandle.h". Routines to manipulate them can be found in
"nsBufferHandleUtils.h". More to come, so I'll keep this bug open till I've
filled out the set to reasonable completion.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.1
Assignee | ||
Updated•24 years ago
|
Target Milestone: mozilla0.9.1 → mozilla1.1
Assignee | ||
Comment 3•23 years ago
|
||
re-targeting milestones, starting from a clean slate
Target Milestone: mozilla1.1 → ---
Comment 4•22 years ago
|
||
[RFE] is deprecated in favor of severity: enhancement. They have the same meaning.
Severity: normal → enhancement
Summary: [RFE] nsBuffer - class for buffer-type operations → nsBuffer - class for buffer-type operations
Comment 5•16 years ago
|
||
I think in the few places where we've wanted to build a buffer for a string class to use we've ended up going through the string API anyway. I don't see a big need for this.
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → WONTFIX
Updated•4 years ago
|
Component: String → XPCOM
You need to log in
before you can comment on or make changes to this bug.
Description
•