Panda3D
Loading...
Searching...
No Matches
androidLogStream.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file androidLogStream.h
10 * @author rdb
11 * @date 2013-01-12
12 */
13
14#ifndef ANDROIDLOGSTREAM_H
15#define ANDROIDLOGSTREAM_H
16
17#ifdef ANDROID
18
19#include "dtoolbase.h"
20#include "notifySeverity.h"
21
22#include <string>
23#include <iostream>
24
25/**
26 * This is a type of ostream that writes each line to the Android log.
27 */
28class AndroidLogStream : public std::ostream {
29private:
30 class AndroidLogStreamBuf : public std::streambuf {
31 public:
32 AndroidLogStreamBuf(int priority);
33 virtual ~AndroidLogStreamBuf();
34
35 protected:
36 virtual int overflow(int c);
37 virtual int sync();
38
39 private:
40 void write_char(char c);
41
42 int _priority;
43 std::string _tag;
44 std::string _data;
45 };
46
47 AndroidLogStream(int priority);
48
49public:
50 virtual ~AndroidLogStream();
51 static std::ostream &out(NotifySeverity severity);
52};
53
54#endif // ANDROID
55
56#endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.