libmsn 4.2.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

/home/salem/libmsn/tags/libmsn-4.2/msn/sstream_fix.h

    00001 /*
    00002  * This file is one big nasty kludge because the older
    00003  * libstdc++ libraries (before v3) have the old strstream
    00004  * but I want to use the new, and much improved sstream.
    00005  * - Barnaby
    00006  *
    00007  * Copyright (C) 2001 Barnaby Gray <barnaby@beedesign.co.uk>
    00008  *
    00009  * This library is free software; you can redistribute it and/or
    00010  * modify it under the terms of the GNU Lesser General Public
    00011  * License as published by the Free Software Foundation; either
    00012  * version 2.1 of the License, or (at your option) any later version.
    00013  *
    00014  * This library is distributed in the hope that it will be useful,
    00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00017  * Lesser General Public License for more details.
    00018  *
    00019  * You should have received a copy of the GNU Lesser General Public
    00020  * License along with this library; if not, write to the Free Software
    00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
    00022  *
    00023  */
    00024
    00025 #ifdef HAVE_CONFIG_H
    00026 # include <config.h>
    00027 #endif
    00028
    00029 #ifdef HAVE_SSTREAM
    00030 # include <sstream>
    00031 #elif HAVE_STRSTREAM
    00032 # define USE_STRSTREAM_WRAPPERS
    00033 #else
    00034 # error "No sstream/strstream implementation"
    00035 #endif
    00036
    00037 #if defined(USE_STRSTREAM_WRAPPERS) && !defined(SSTREAM_FIX_H)
    00038 #define SSTREAM_FIX_H
    00039
    00040 #include <string>
    00041 #include <strstream>
    00042
    00043 #include "libmsn_export.h"
    00044
    00045 namespace std
    00046 {
    00047
    00048   /*
    00049    * Only limited functionality from ostringstream
    00050    * is implemented
    00051    */
    00052   class ostringstream : public ostrstream {
    00053    public:
    00054     string str() {
    00055       char *cstr = ostrstream::str();
    00056       freeze(0);
    00057       if (cstr == 0) return string();
    00058       return string(cstr,pcount());
    00059     }
    00060   };
    00061
    00062   /*
    00063    * Only limited functionality from istringstream
    00064    * is implemented
    00065    */
    00066   class istringstream : public istrstream {
    00067    public:
    00068     istringstream(const string& str)
    00069       : istrstream(str.c_str()) { }
    00070   };
    00071
    00072 }
    00073
    00074 #endif

All Classes Namespaces Functions Variables Enumerations Enumerator