[Cmake-commits] [cmake-commits] hoffman committed fstream NONE 1.1 iosfwd NONE 1.1 iostream NONE 1.1 sstream NONE 1.1

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Apr 23 11:09:40 EDT 2009


Update of /cvsroot/CMake/CMake/VMSbuild/cmsys/ios
In directory public:/mounts/ram/cvs-serv24424/VMSbuild/cmsys/ios

Added Files:
	fstream iosfwd iostream sstream 
Log Message:
ENH: check in almost building VMS stuff with VMSBuild directory since the bootstrap script will not work on VMS


--- NEW FILE: iosfwd ---
/*=========================================================================

  Program:   KWSys - Kitware System Library
  Module:    $RCSfile: iosfwd,v $

  Copyright (c) Kitware, Inc., Insight Consortium.  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
#ifndef cmsys_ios_iosfwd
#define cmsys_ios_iosfwd

#include <cmsys/Configure.hxx>

#ifdef _MSC_VER
#pragma warning (push, 1)
#pragma warning (disable: 4702)
#endif

#if cmsys_IOS_USE_ANSI
# include <iosfwd>
#else
class fstream;
class ifstream;
class ios;
class istream;
class ofstream;
class ostream;
#endif

#if !cmsys_IOS_USE_SSTREAM
namespace cmsys_ios
{
  using cmsys_ios_namespace::fstream;
  using cmsys_ios_namespace::ifstream;
  using cmsys_ios_namespace::ios;
  using cmsys_ios_namespace::istream;
  using cmsys_ios_namespace::ofstream;
  using cmsys_ios_namespace::ostream;
}
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif

#endif

--- NEW FILE: iostream ---
/*=========================================================================

  Program:   KWSys - Kitware System Library
  Module:    $RCSfile: iostream,v $

  Copyright (c) Kitware, Inc., Insight Consortium.  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
#ifndef cmsys_ios_iostream
#define cmsys_ios_iostream

#include <cmsys/Configure.hxx>

#ifdef _MSC_VER
# pragma warning (push, 1)
# pragma warning (disable: 4702)
# pragma warning (disable: 4995) /* Old streams are deprecated.  */
#endif

#if cmsys_IOS_USE_ANSI
# include <iostream>
#else
# include <iostream.h>
#endif

// The HP implementation of iostream defines cin, cout, cerr, and clog
// as macros in order to do thread-private streams.
// See /opt/aCC/include/iostream/iostream.h for details.
// This block redefines the macros in a safe way that is also compatible
// with the HP definitions and the using declarations below.

#if !cmsys_IOS_USE_SSTREAM
# if defined(__HP_aCC) && (defined(HP_THREAD_SAFE) || defined(_THREAD_SAFE))
#  if defined(cin) && !defined(cmsys_IOS_HP_HACK_CIN)
#   define cmsys_IOS_HP_HACK_CIN
#   undef cin
#   define cin __tcin.ref()
#  endif
#  if defined(cout) && !defined(cmsys_IOS_HP_HACK_COUT)
#   define cmsys_IOS_HP_HACK_COUT
#   undef cout
#   define cout __tcout.ref()
#  endif
#  if defined(cerr) && !defined(cmsys_IOS_HP_HACK_CERR)
#   define cmsys_IOS_HP_HACK_CERR
#   undef cerr
#   define cerr __tcerr.ref()
#  endif
#  if defined(clog) && !defined(cmsys_IOS_HP_HACK_CLOG)
#   define cmsys_IOS_HP_HACK_CLOG
#   undef clog
#   define clog __tclog.ref()
#  endif
# endif
#endif

// If using our own sstream emulation code, put the standard
// streams in the same namespace.
#if !cmsys_IOS_USE_SSTREAM
namespace cmsys_ios
{
  typedef int streamsize;
  typedef int streamoff;
  using cmsys_ios_namespace::ostream;
  using cmsys_ios_namespace::istream;
  using cmsys_ios_namespace::ios;
  using cmsys_ios_namespace::endl;
  using cmsys_ios_namespace::flush;
# if defined(cmsys_IOS_HP_HACK_CIN)
  using cmsys_ios_namespace::__tcin;
# else
  using cmsys_ios_namespace::cin;
# endif
# if defined(cmsys_IOS_HP_HACK_COUT)
  using cmsys_ios_namespace::__tcout;
# else
  using cmsys_ios_namespace::cout;
# endif
# if defined(cmsys_IOS_HP_HACK_CERR)
  using cmsys_ios_namespace::__tcerr;
# else
  using cmsys_ios_namespace::cerr;
# endif
# if defined(cmsys_IOS_HP_HACK_CLOG)
  using cmsys_ios_namespace::__tclog;
# else
  using cmsys_ios_namespace::clog;
# endif
}
#endif

#ifdef _MSC_VER
# pragma warning(pop)
#endif

#endif

--- NEW FILE: sstream ---
/*=========================================================================

  Program:   KWSys - Kitware System Library
  Module:    $RCSfile: sstream,v $

  Copyright (c) Kitware, Inc., Insight Consortium.  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
#ifndef cmsys_ios_sstream
#define cmsys_ios_sstream

#include <cmsys/Configure.hxx>

/* Define this macro temporarily to keep the code readable.  */
#if !defined (KWSYS_NAMESPACE) && !cmsys_NAME_IS_KWSYS
# define kwsys_stl cmsys_stl
#endif

#if cmsys_IOS_USE_SSTREAM
# ifdef _MSC_VER
#  pragma warning (push, 1)
#  pragma warning (disable: 4702)
# endif
# include <sstream>
# ifdef _MSC_VER
#  pragma warning(pop)
# endif
#else
# ifdef _MSC_VER
#  pragma warning (push, 1)
#  pragma warning (disable: 4702)
#  pragma warning (disable: 4995) /* Old streams are deprecated.  */
# endif
# if cmsys_IOS_USE_ANSI
#  include <strstream>
# elif cmsys_IOS_USE_STRSTREAM_H
#  include <strstream.h>
# elif cmsys_IOS_USE_STRSTREA_H
#  include <strstrea.h>
# endif
# if cmsys_IOS_USE_ANSI
#  include <new> // Need placement operator new.
# else
#  include <new.h> // Need placement operator new.
# endif
# ifdef _MSC_VER
#  pragma warning(pop)
# endif

// Only have old std strstream classes.  Wrap them to look like new
// ostringstream and istringstream classes.

# include <cmsys/stl/string>

namespace cmsys_ios
{
using cmsys_ios_namespace::streambuf;
using cmsys_ios_namespace::ostream;
using cmsys_ios_namespace::istream;
using cmsys_ios_namespace::strstream;
using cmsys_ios_namespace::istrstream;
using cmsys_ios_namespace::ostrstream;
using cmsys_ios_namespace::ios;
using cmsys_ios_namespace::endl;
using cmsys_ios_namespace::ends;
using cmsys_ios_namespace::flush;

class stringstream_cleanup
{
public:
  stringstream_cleanup(strstream& str): m_StrStream(str) {}
  ~stringstream_cleanup() { m_StrStream.rdbuf()->freeze(0); }
  static void IgnoreUnusedVariable(const stringstream_cleanup&) {}
protected:
  strstream& m_StrStream;
private:
  void operator=(stringstream_cleanup const&);
};

class stringstream: public strstream
{
public:
  typedef strstream Superclass;
  stringstream() {}
  stringstream(const kwsys_stl::string& s) { *this << s.c_str(); }
  kwsys_stl::string str()
    {
    stringstream_cleanup cleanup(*this);
    stringstream_cleanup::IgnoreUnusedVariable(cleanup);
// Visual Studio 6 has a strstream::pcount, but this is not rdbuf()->pcount()
#if (cmsys_IOS_USE_STRSTREA_H) && defined(_MSC_VER) && (_MSC_VER == 1200)
    int count = this->pcount();
#elif defined(__WATCOMC__)
    int count = this->rdbuf()->out_waiting();
#else
    int count = this->rdbuf()->pcount();
#endif
    const char* ptr = this->Superclass::str();
    return kwsys_stl::string(ptr?ptr:"", count);
    }
  void str(const kwsys_stl::string& s)
    {
    this->~stringstream();
    new (this) stringstream(s);
    }
private:
  stringstream(const stringstream&);
  void operator=(const stringstream&);
};

class ostringstream_cleanup
{
public:
  ostringstream_cleanup(ostrstream& ostr): m_OStrStream(ostr) {}
  ~ostringstream_cleanup() { m_OStrStream.rdbuf()->freeze(0); }
  static void IgnoreUnusedVariable(const ostringstream_cleanup&) {}
protected:
  ostrstream& m_OStrStream;
private:
  void operator=(ostringstream_cleanup const&);
};

class ostringstream: public ostrstream
{
public:
  typedef ostrstream Superclass;
  ostringstream() {}
  ostringstream(const kwsys_stl::string& s) { *this << s.c_str(); }
  kwsys_stl::string str()
    {
    ostringstream_cleanup cleanup(*this);
    ostringstream_cleanup::IgnoreUnusedVariable(cleanup);
    int count = this->pcount();
    const char* ptr = this->Superclass::str();
    return kwsys_stl::string(ptr?ptr:"", count);
    }
  void str(const kwsys_stl::string& s)
    {
    this->~ostringstream();
    new (this) ostringstream(s);
    }
private:
  ostringstream(const ostringstream&);
  void operator=(const ostringstream&);
};

#if defined(_MSC_VER)
# pragma warning (push)
# pragma warning (disable: 4097) /* typedef-name used as synonym for class */
#endif
#if defined(__WATCOMC__)
// W728: class modifiers for 'A' conflict with class modifiers for 'B'
# pragma warning 728 10
#endif

class istringstream: private kwsys_stl::string, public istrstream
{
public:
  typedef kwsys_stl::string StdString;
  typedef istrstream IStrStream;
  istringstream(): StdString(),
                   IStrStream(const_cast<char*>(StdString::c_str())) {}
  istringstream(const kwsys_stl::string& s):
    StdString(s), IStrStream(const_cast<char*>(StdString::c_str())) {}
  kwsys_stl::string str() const { return *this; }
  void str(const kwsys_stl::string& s)
    {
    this->~istringstream();
    new (this) istringstream(s);
    }
  void clear(int flags)
    {
    this->IStrStream::clear(flags);
    }
private:
  istringstream(const istringstream&);
  void operator=(const istringstream&);
};

#if defined(__WATCOMC__)
# pragma warning 728 9
#endif
#if defined(_MSC_VER)
# pragma warning (pop)
#endif

} // namespace cmsys_ios

#endif

/* Undefine temporary macro.  */
#if !defined (KWSYS_NAMESPACE) && !cmsys_NAME_IS_KWSYS
# undef kwsys_stl
#endif

#endif

--- NEW FILE: fstream ---
/*=========================================================================

  Program:   KWSys - Kitware System Library
  Module:    $RCSfile: fstream,v $

  Copyright (c) Kitware, Inc., Insight Consortium.  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
#ifndef cmsys_ios_fstream
#define cmsys_ios_fstream

#include <cmsys/Configure.hxx>

#ifdef _MSC_VER
# pragma warning (push, 1)
# pragma warning (disable: 4702)
# pragma warning (disable: 4995) /* Old streams are deprecated.  */
#endif

#if cmsys_IOS_USE_ANSI
# include <fstream>
#else
# include <fstream.h>
#endif

#if !cmsys_IOS_USE_SSTREAM
namespace cmsys_ios
{
  using cmsys_ios_namespace::ostream;
  using cmsys_ios_namespace::istream;
  using cmsys_ios_namespace::ofstream;
  using cmsys_ios_namespace::ifstream;
  using cmsys_ios_namespace::ios;
  using cmsys_ios_namespace::endl;
  using cmsys_ios_namespace::flush;
}
#endif

#ifdef _MSC_VER
# pragma warning(pop)
#endif

#endif



More information about the Cmake-commits mailing list