summaryrefslogtreecommitdiff
path: root/ACE/ace/CE_Screen_Output.h
blob: c97b0e90e2c9d2c7295980adf7eedddccac9b166 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// -*- C++ -*-

//=============================================================================
/**
 *  @file    CE_Screen_Output.h
 *
 *  $Id$
 *
 *  @author Si Mong Park  <spark@ociweb.com>
 */
//=============================================================================

#ifndef ACE_CE_SCREEN_OUTPUT_H
#define ACE_CE_SCREEN_OUTPUT_H

#include /**/ "ace/config-all.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#if defined (ACE_HAS_WINCE)

#include "ace/Log_Msg_Callback.h"
#include "ace/Log_Record.h"

namespace
{
  const ACE_TCHAR endl[] = ACE_LIB_TEXT("\r\n");
  const ACE_TCHAR tab[]  = ACE_LIB_TEXT("\t");
}

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

/**
 * @class ACE_CE_Screen_Output
 *
 * @brief Replacement of text output for Windows CE.
 *
 * This class allows standard text output to be displayed on
 * text window for Windows CE.  Generally, all ACE output will
 * go through under CE if and only if user uses WindozeCE
 * implementation by using main_ce instead of main.
 * Also, for the easier debugging purpose, object pointer of
 * this class can be gotten from ACE_Log_Msg::msg_callback()
 * and then can be used directly by user just like cout stream.
 */
class ACE_Export ACE_CE_Screen_Output : public ACE_Log_Msg_Callback
{
public:

  ACE_CE_Screen_Output (HWND hEdit);

  ACE_CE_Screen_Output (void);

  virtual ~ACE_CE_Screen_Output();

  /// Implementation of pure virtual function from ACE_Log_Msg_Callback.
  virtual void log (ACE_Log_Record &log_record);

  /// Interface to specify active window handle.
  void SetOutputWindow (HWND hWnd);

  void clear (void);

  /// Stream insertion operator that performs actual print out.
  /**
   * @note This is the only one operator that performs output.  All
   *       other perators convert the type and use this operator
   *       underneath.
   */
  ACE_CE_Screen_Output& operator << (ACE_TCHAR*);
  ACE_CE_Screen_Output& operator << (const ACE_TCHAR*);

  ACE_CE_Screen_Output& operator << (ACE_ANTI_TCHAR* output);
  ACE_CE_Screen_Output& operator << (const ACE_ANTI_TCHAR* output);

  ACE_CE_Screen_Output& operator << (char output);
  ACE_CE_Screen_Output& operator << (unsigned char output);

  ACE_CE_Screen_Output& operator << (unsigned short output);

  ACE_CE_Screen_Output& operator << (int output);
  ACE_CE_Screen_Output& operator << (unsigned int output);

  ACE_CE_Screen_Output& operator << (float output);

  ACE_CE_Screen_Output& operator << (long output);
  ACE_CE_Screen_Output& operator << (unsigned long output);

  ACE_CE_Screen_Output& operator << (FILE* pFile);

private:

  ACE_CE_Screen_Output (ACE_CE_Screen_Output&);

private:

  HWND handler_;

  /// FILE pointer that used to save output to file.  This class does
  /// not own the file handler pointer.
  FILE* pFile_;
};

ACE_END_VERSIONED_NAMESPACE_DECL

#endif  // ACE_HAS_WINCE
#endif  // ACE_CE_SCREEN_OUTPUT_H