<commit_before>// $Id$

// The libMesh Finite Element Library.
// Copyright (C) 2002-2008 <NAME>, <NAME>, <NAME>
  
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
  
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
  
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA



#ifndef __ostream_proxy_h__
#define __ostream_proxy_h__



// C++ includes
#include <iostream>

// Local Includes
// We don't use anything libMesh-specific here (yet)
// #include "libmesh_common.h"


namespace libMesh
{

// Forward Declarations



 // ------------------------------------------------------------
 // OStreamProxy class definition
 //
 // This class is intended to be reseatable like a pointer-to-ostream
 // for flexibility, but to look like a reference when used to produce
 // less awkward user code.
 //
 // It is up to the user to ensure that the target ostream 

 template <typename charT=char, typename traits=std::char_traits<charT> >
 class BasicOStreamProxy
 {
 public:
  /**
   * This class is going to be used to proxy for ostream, but other
   * character and traits types are possible
   */
  typedef std::basic_ostream<charT,traits> streamT;

  /**
   * This class is going to be used to proxy for ostream, but other
   * character and traits types are possible
   */
  typedef std::basic_streambuf<charT,traits> streambufT;

  /**
   * Default constructor.  Takes a reference to the \p target ostream
   * to which we pass output.  The user is responsible for ensuring
   * that this target exists for as long as the proxy does.
   */
  BasicOStreamProxy (streamT& target) : _target(&target) {}

  /**
   * Shallow copy constructor.  Output in the new object is passed to
   * the same target ostream as in the old object.  The user is
   * responsible for ensuring that this target exists for as long as
   * the proxies do.
   */
  BasicOStreamProxy (BasicOStreamProxy& old) : _target(old._target) {}

  /**
   * Default destructor.
   */
  ~BasicOStreamProxy () {}

  // 
  // Functions that get passed to the proxied target:
  //

  /**
   * Conversion to ostream&, for when we get passed to a function
   * requesting one.
   */
  operator streamT&() { return *_target; }

  /**
   * Conversion to const ostream&, for when we get passed to a
   * function requesting one.
   */<commit_msg>OStreamProxy: Added some more assignment operators<commit_after>// $Id$

// The libMesh Finite Element Library.
// Copyright (C) 2002-2008 <NAME>, <NAME>, <NAME>
  
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
  
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
  
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA



#ifndef __ostream_proxy_h__
#define __ostream_proxy_h__



// C++ includes
#include <iostream>

// Local Includes
// We don't use anything libMesh-specific here (yet)
// #include "libmesh_common.h"


namespace libMesh
{

// Forward Declarations



 // ------------------------------------------------------------
 // OStreamProxy class definition
 //
 // This class is intended to be reseatable like a pointer-to-ostream
 // for flexibility, but to look like a reference when used to produce
 // less awkward user code.
 //
 // It is up to the user to ensure that the target ostream 

 template <typename charT=char, typename traits=std::char_traits<charT> >
 class BasicOStreamProxy
 {
 public:
  /**
   * This class is going to be used to proxy for ostream, but other
   * character and traits types are possible
   */
  typedef std::basic_ostream<charT,traits> streamT;

  /**
   * This class is going to be used to proxy for ostream, but other
   * character and traits types are possible
   */
  typedef std::basic_streambuf<charT,traits> streambufT;

  /**
   * Default constructor.  Takes a reference to the \p target ostream
   * to which we pass output.  The user is responsible for ensuring
   * that this target exists for as long as the proxy does.
   */
  BasicOStreamProxy (streamT& target) : _target(&target) {}

  /**
   * Shallow copy constructor.  Output in the new object is passed to
   * the same target ostream as in the old object.  The user is
   * responsible for ensuring that this target exists for as long as
   * the proxies do.
   */
  BasicOStreamProxy (BasicOStreamProxy& old) : _target(old._target) {}

  /**
   * Reset the internal target to a new \p target output stream.
   */
  BasicOStreamProxy& operator= (streamT& target)
    { 
       _target = &target; 
       return *this;
    }

  /**
   * Reset the target to the same output stream as in \p old
   */
  BasicOStreamProxy& operator= (const BasicOStreamProxy& old)
    {
      _target = old._target;
      return *this;
    }

  /**
   * Default destructor.
   */
  ~BasicOStreamProxy () {}

  // 
  // Functions that get passed to the proxied target:
  //

  /**
   * Conversion to ostream&, for when we get passed to a function
   * requesting one.
   */
  operator streamT&() { return *_target; }

  /**
   * Conversion to const ostream&, for when we get passed to a
   * function requesting one.
   */
{'fraction_non_alphanumeric': 0.10316946959896507, 'fraction_numerical': 0.007761966364812419, 'mean_word_length': 2.8084975369458127, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1658262', 'n_tokens_mistral': 1776, 'n_tokens_neox': 1674, 'n_words': 773}