]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - libs/stream/memstream.h
my own uncrustify run
[xonotic/netradiant.git] / libs / stream / memstream.h
index 3719eef8b17e4a54f7e05fe8f1afd4def6605a08..75bd23ad04deb0ffe9a108e4730ae6f1a544aef0 100644 (file)
@@ -1,25 +1,25 @@
 /*
-Copyright (C) 2001-2006, William Joseph.
-All Rights Reserved.
+   Copyright (C) 2001-2006, William Joseph.
+   All Rights Reserved.
 
-This file is part of GtkRadiant.
+   This file is part of GtkRadiant.
 
-GtkRadiant is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   GtkRadiant is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-GtkRadiant 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 General Public License for more details.
+   GtkRadiant 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 General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with GtkRadiant; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-*/
+   You should have received a copy of the GNU General Public License
+   along with GtkRadiant; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 
-#if !defined(INCLUDED_STREAM_MEMSTREAM_H)
+#if !defined( INCLUDED_STREAM_MEMSTREAM_H )
 #define INCLUDED_STREAM_MEMSTREAM_H
 
 #include "itextstream.h"
@@ -28,54 +28,47 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 class BufferOutputStream : public TextOutputStream
 {
-  std::vector<char> m_buffer;
+std::vector<char> m_buffer;
 public:
-  std::size_t write(const char* buffer, std::size_t length)
-  {
-    m_buffer.insert(m_buffer.end(), buffer, buffer+length);
-    return length;
-  }
-  const char* data() const
-  {
-    return &(*m_buffer.begin());
-  }
-  std::size_t size() const
-  {
-    return m_buffer.size();
-  }
-  void clear()
-  {
-    std::vector<char> empty;
-    std::swap(empty, m_buffer);
-  }
+std::size_t write( const char* buffer, std::size_t length ){
+       m_buffer.insert( m_buffer.end(), buffer, buffer + length );
+       return length;
+}
+const char* data() const {
+       return &( *m_buffer.begin() );
+}
+std::size_t size() const {
+       return m_buffer.size();
+}
+void clear(){
+       std::vector<char> empty;
+       std::swap( empty, m_buffer );
+}
 };
 
 template<typename T>
-inline BufferOutputStream& operator<<(BufferOutputStream& ostream, const T& t)
-{
-  return ostream_write(ostream, t);
+inline BufferOutputStream& operator<<( BufferOutputStream& ostream, const T& t ){
+       return ostream_write( ostream, t );
 }
 
 
 class BufferInputStream : public TextInputStream
 {
-  const char* m_read;
-  const char* m_end;
+const char* m_read;
+const char* m_end;
 public:
-  BufferInputStream(const char* buffer, std::size_t length)
-    : m_read(buffer), m_end(buffer + length)
-  {
-  }
-  std::size_t read(char* buffer, std::size_t length)
-  {
-    std::size_t count = std::min(std::size_t(m_end - m_read), length);
-    const char* end = m_read + count;
-    while(m_read != end)
-    {
-      *buffer++ = *m_read++;
-    }
-    return count;
-  }
+BufferInputStream( const char* buffer, std::size_t length )
+       : m_read( buffer ), m_end( buffer + length ){
+}
+std::size_t read( char* buffer, std::size_t length ){
+       std::size_t count = std::min( std::size_t( m_end - m_read ), length );
+       const char* end = m_read + count;
+       while ( m_read != end )
+       {
+               *buffer++ = *m_read++;
+       }
+       return count;
+}
 };
 
 #endif