Closed Bug 269054 Opened 20 years ago Closed 11 years ago

Allow a nsString to be used as a nsDependentSubstring and vice-versa

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: bryner, Unassigned)

Details

See bug 268932 for details... we'd like to be able to use a single string member
to hold a DependentSubstring or a buffer that it owns.  There's no way to do
this currently without weird placement-new hacks to initialize the
nsDependentSubstring.
How about something like this:

  class nsTSubstring {
    void AssignDependent(const nsTSubstring& aStr);
  };

We may wish to create variations on this so that one does not need to construct
a Substring in order to call this method.

If we provide a method like this:

  class nsTSubstring {
    void AssignDependent(const char_type* aData, size_type aDataLen);
  };

then, the question becomes: is the data null-terminated?  And, perhaps we'd be
tempted to add a boolean parameter after aDataLen.  The first version avoids
this problem since the null-terminated'ness is inherited from aStr.  Hmm...
Assignee: darin → nobody
QA Contact: xpcom
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.