blob: 9f2a188f6809068b23717a5567e5eb1f68216928 [file] [log] [blame]
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +00001//
2// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7#include "InfoSink.h"
8
9#ifdef _WIN32
10 #include <windows.h>
11#endif
12
13void TInfoSinkBase::append(const char *s)
14{
15 if (outputStream & EString) {
16 checkMem(strlen(s));
17 sink.append(s);
18 }
19
20#ifdef _WIN32
21 if (outputStream & EDebugger)
22 OutputDebugString(s);
23#endif
24
25 if (outputStream & EStdOut)
26 fprintf(stdout, "%s", s);
27}
28
29void TInfoSinkBase::append(int count, char c)
30{
31 if (outputStream & EString) {
32 checkMem(count);
33 sink.append(count, c);
34 }
35
36#ifdef _WIN32
37 if (outputStream & EDebugger) {
38 char str[2];
39 str[0] = c;
40 str[1] = '\0';
41 OutputDebugString(str);
42 }
43#endif
44
45 if (outputStream & EStdOut)
46 fprintf(stdout, "%c", c);
47}
48
49void TInfoSinkBase::append(const TPersistString& t)
50{
51 if (outputStream & EString) {
52 checkMem(t.size());
53 sink.append(t);
54 }
55
56#ifdef _WIN32
57 if (outputStream & EDebugger)
58 OutputDebugString(t.c_str());
59#endif
60
61 if (outputStream & EStdOut)
62 fprintf(stdout, "%s", t.c_str());
63}
64
65void TInfoSinkBase::append(const TString& t)
66{
67 if (outputStream & EString) {
68 checkMem(t.size());
69 sink.append(t.c_str());
70 }
71
72#ifdef _WIN32
73 if (outputStream & EDebugger)
74 OutputDebugString(t.c_str());
75#endif
76
77 if (outputStream & EStdOut)
78 fprintf(stdout, "%s", t.c_str());
79}