Phasor  01.00.10.059
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HaloStreams.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../../Common/Streams.h"
4 #include <assert.h>
5 
6 namespace halo {
7  struct s_player;
8 
9  extern const std::wstring MSG_PREFIX;
10 
11  // Writes to the server console.
13  {
14  protected:
15  virtual bool Write(const std::wstring& str);
16 
17  public:
19  virtual ~CHaloPrintStream() {}
20 
21  virtual std::unique_ptr<COutStream> clone() const override
22  {
23  return std::unique_ptr<COutStream>(new CHaloPrintStream());
24  }
25  };
26 
28  {
29  private:
30  // Memory id of player at last known point.
31  // -1 unless stream has been cloned.
32  int memory_id;
33  // Hash of player at last known point
34  std::string hash;
35  protected:
36  const s_player& player;
37 
38  CPlayerBaseStream(const s_player& player, bool do_check);
40 
41  // Checks if the player is still valid
42  bool ValidatePlayer();
43 
44  public:
45  const s_player& GetPlayer() { return player; }
46  };
47 
48  // Writes console text to a specific player
50  {
51  private:
52  // used when cloning. forces checks to be made before each Write.
53  PlayerConsoleStream(const s_player& player, bool);
54 
55  protected:
56  virtual bool Write(const std::wstring& str) override;
57 
58  public:
59  PlayerConsoleStream(const s_player& player);
60 
61  virtual std::unique_ptr<COutStream> clone() const override
62  {
63  return std::unique_ptr<COutStream>(new PlayerConsoleStream(player,true));
64  }
65  };
66 
68  {
69  protected:
70  virtual bool Write(const std::wstring& str) override;
71 
72  // used when cloning. forces checks to be made before each Write.
73  PlayerChatStreamRaw(const s_player& player, bool);
74 
75  public:
76  PlayerChatStreamRaw(const s_player& player);
77 
78  virtual std::unique_ptr<COutStream> clone() const override
79  {
80  return std::unique_ptr<COutStream>(new PlayerChatStreamRaw(player,true));
81  }
82  };
83 
84 
86  {
87  private:
88  // used when cloning. forces checks to be made before each Write.
89  PlayerChatStream(const s_player& player, bool);
90 
91  protected:
92  virtual bool Write(const std::wstring& str) override;
93 
94  public:
95  PlayerChatStream(const s_player& player);
96 
97  virtual std::unique_ptr<COutStream> clone() const override
98  {
99  return std::unique_ptr<COutStream>(new PlayerChatStream(player,true));
100  }
101  };
102 
103 }
104