summaryrefslogtreecommitdiff
path: root/apps/FaCE/CE_Screen_Output.h
blob: 9f29c9cf30f9a2e8abc2027044fce4fca6d5adb1 (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
/**
 *  @file    CE_Screen_Output.h
 *
 *  $Id$
 *
 *  @author Si Mong Park  <spark@ociweb.com>
 */
//=============================================================================

#ifndef CE_Screen_Output_h
#define CE_Screen_Output_h

#include <windows.h>

const wchar_t endl[] = L"\r\n";
const wchar_t tab[]  = L"\t";

/**
 * @class 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 CE_Screen_Output
{
public:
    /**
     * Default Ctor
     */
    CE_Screen_Output();

    /**
     * Default Dtor
     */
    virtual ~CE_Screen_Output();

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

    /**
     * Clears text screen.
     */
    void clear();

    /**
     * << 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.
     */
    CE_Screen_Output& operator << (wchar_t*);
    CE_Screen_Output& operator << (const wchar_t*);

    CE_Screen_Output& operator << (char* output);
    CE_Screen_Output& operator << (const char* output);

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

    CE_Screen_Output& operator << (unsigned short output);

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

    CE_Screen_Output& operator << (float output);

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

    CE_Screen_Output& operator << (FILE* pFile);

private:
    /**
     * Copy Ctor
     */
    CE_Screen_Output(CE_Screen_Output&);

    static HWND handler_;

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

#endif  // CE_Screen_Output_h