OpenCores
URL https://opencores.org/ocsvn/thor/thor/trunk

Subversion Repositories thor

[/] [thor/] [trunk/] [FT64v5/] [software/] [CC64/] [source/] [txtStream.h] - Blame information for rev 48

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 robfinch
#pragma once
2
#include <string.h>
3
#include <iostream>
4
#include <fstream>
5
#include <iomanip>
6
 
7
class txtoStream : public std::ofstream
8
{
9
        char buf[500];
10
public:
11
        int level;
12
public:
13
  txtoStream() : std::ofstream() {};
14
        void write(char *buf) { if (level) {
15
           std::ofstream::write(buf, strlen(buf));
16
       flush(); }};
17
        void printf(char *str) { if (level) write(str); };
18
        void printf(const char *str) { if (level) write((char *)str); };
19
        void printf(char *fmt, char *str);
20
        void printf(char *fmt, char *str, int n);
21
        void printf(char *fmt, char *str, char *str2);
22
        void printf(char *fmt, char *str, char *str2, int n);
23
        void printf(char *fmt, int n, char *str);
24
        void printf(char *fmt, int n);
25
        void printf(char *fmt, int n, int m);
26
        void printf(char *fmt, __int64 n);
27
        void putch(char ch) {
28
            if (level) {
29
             buf[0] = ch;
30
             buf[1] = '\0';
31
             buf[2] = '\0';
32
             buf[3] = '\0';
33
       std::ofstream::write(buf, 1);
34
       }};
35
        void puts(const char *);
36
};
37
 
38
// Make it easy to disable debugging output
39
// Mirror the txtoStream class with one that does nothing.
40
 
41
class txtoStreamNull
42
{
43
public:
44
  int level;
45
  void open(...);
46
  void close();
47
  void write(char *) { };
48
  void printf(...) { };
49
  void putch(char) { };
50
  void puts(const char *) {} ;
51
};
52
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.