FreeStick  0.3
Cross Platform Open Sorce Joystick Lib
EEStream.h
Go to the documentation of this file.
1 /*
2 * EEStream.h
3 *
4 *
5 * Epee Engine
6 * Created by Alan Uthoff on 3/12/06.
7 Copyright (C) 2011
8 
9 This Code is free software; you can redistribute it and/or
10 modify it under the terms of the zlib/libpng License as published
11 by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
13 This software is provided 'as-is', without any express or implied warranty.
14 
15 In no event will the authors be held liable for any damages arising from the use of this software.
16 
17 Permission is granted to anyone to use this software for any purpose,
18 including commercial applications, and to alter it and redistribute
19 it freely, subject to the following restrictions:
20 
21 1. The origin of this software must not be misrepresented;
22 you must not claim that you wrote the original software.
23 If you use this software in a product, an acknowledgment
24 in the product documentation would be appreciated but is not required.
25 
26 2. Altered source versions must be plainly marked as such,
27 and must not be misrepresented as being the original software.
28 
29 3. This notice may not be removed or altered from any source distribution.
30 
31 
32 */
33 //TODO make EEStream An interface and create EESTDOStream
34 #ifndef EESTREAM_H
35 #define EESTREAM_H
36 #include <ostream>
37 #include <iostream>
38 #include <assert.h>
39 //This class does not take responsibility for freeing the ostream memory
40 class EEStream
41 {
42 public:
43  EEStream(std::ostream & _streamToUse);
44  EEStream();
45  EEStream(const EEStream & copyFrom);
46  virtual ~EEStream();
47  virtual EEStream & operator=(EEStream & copyFrom);
48  EEStream & operator<<(std::ostream & _data);
49  virtual std::ostream & operator<<(std::ostream & (*f) (std::ostream &));
50 
51  template <typename datatype>
52  inline EEStream & operator<<(const datatype _data)
53  {
54  if(m_EEOut)
55  {
56  (*m_EEOut)<<_data;
57  }
58  return *this;
59  }
60 
61 protected:
62  std::ostream * m_EEOut;
63 };
64 
65 inline std::ostream & EEAssert(std::ostream & _stream)
66 {
67  assert(false);
68  return _stream;
69 }
70 
71 
72 
73 #endif
virtual ~EEStream()
Definition: EEStream.cpp:51
virtual EEStream & operator=(EEStream &copyFrom)
Definition: EEStream.cpp:56
EEStream & operator<<(std::ostream &_data)
Definition: EEStream.cpp:62
EEStream()
Definition: EEStream.cpp:41
std::ostream & EEAssert(std::ostream &_stream)
Definition: EEStream.h:65
Definition: EEStream.h:40
EEStream & operator<<(const datatype _data)
Definition: EEStream.h:52
std::ostream * m_EEOut
Definition: EEStream.h:62