This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project. See the libstdc++ home page for more information.


[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

Re: basic_stringbuf functional




Hi Christof--
Nice to see this contribution. I've got a couple of questions for you.

I'm abstracting out _Streambuf_base, so that libio can be used with
other, possibly different, implementations from vendors that wish to
specialize for their OS. So the streambuf_base stuff is pending this
stuff settling down. . .

I'm in favor of just adding

typedef basic_string<_CharT, _Traits, _Alloc> string_type

as a typedef type for basic_stringbuf. I think it'll make a lot of
things less cumbersome. Similarly, what is currently _index_type could
probably just be _Alloc::size_type or typedefed as size_type from
this. (Although I'm not certain why you want to rip out all the
buffering code: could you please explain your motivations for doing
so?)

    // Constructors:
    explicit basic_stringbuf (ios_base::openmode __which = (ios_base::in
							  | ios_base::out))
      : basic_streambuf<_CharT,_Traits> (), _M_mode (__which),
        _M_writeindex(0), _M_readindex(0) { }
    
might as well init the string member (_M_str) as well
so that all the conditions of str() work

(I believe the next ctor has a typo, 

      {  str (__str); } 

should be:

      {  _M_str (__str); } 

In your implementation of seekoff you should just be able to use
ios_base::in and ios_base::out instead of the longer basic_ios<_CharT,
_traits>::in. Also, SUPPRESS_WARN is probably not the way to go on the
switch statements: ios_base::beg should be sufficient.

A quick request: can you please use diff -cp? Thanks. Also,
contributed testsuites that you are using to test the implementation
should go into testsuites/27. .

Unfortunately, at this time the copyright on libstdc++ is still in a
pretty fluid state: as shipped it is this strange beast called the
Cygnus license.When this becomes finalized, Cygnus has dedicated the
resources for an net-accessible cvs server (much like egcs), which
will make staying current and diffs against the current sources much
easier.

Because of the licensing ambiguity, copyright assignments are being
handled by Cygnus: I'll send you the requisite forms a bit later in the
week.

-Benjamin