/usr/include/sp/OutputByteStream.h is in libsp1-dev 1.3.4-1.2.1-47.3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | // Copyright (c) 1997 James Clark
// See the file COPYING for copying permission.
#ifndef OutputByteStream_INCLUDED
#define OutputByteStream_INCLUDED 1
#include "StringOf.h"
#include "Boolean.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API OutputByteStream {
public:
OutputByteStream();
virtual ~OutputByteStream();
virtual void flush() = 0;
void sputc(char c);
void sputn(const char *, size_t);
OutputByteStream &operator<<(char);
OutputByteStream &operator<<(unsigned char);
OutputByteStream &operator<<(const char *);
OutputByteStream &operator<<(int);
OutputByteStream &operator<<(unsigned);
OutputByteStream &operator<<(long);
OutputByteStream &operator<<(unsigned long);
OutputByteStream &operator<<(const String<char> &);
char *getBufferPtr() const;
size_t getBufferSize() const;
void usedBuffer(size_t);
virtual void flushBuf(char) = 0;
protected:
char *ptr_;
char *end_;
};
inline
char *OutputByteStream::getBufferPtr() const
{
return ptr_;
}
inline
size_t OutputByteStream::getBufferSize() const
{
return end_ - ptr_;
}
inline
void OutputByteStream::usedBuffer(size_t n)
{
ptr_ += n;
}
inline
void OutputByteStream::sputc(char c)
{
if (ptr_ < end_)
*ptr_++ = c;
else
flushBuf(c);
}
inline
OutputByteStream &OutputByteStream::operator<<(char c)
{
sputc(c);
return *this;
}
inline
OutputByteStream &OutputByteStream::operator<<(unsigned char c)
{
sputc(char(c));
return *this;
}
inline
OutputByteStream &OutputByteStream::operator<<(int n)
{
return *this << long(n);
}
inline
OutputByteStream &OutputByteStream::operator<<(unsigned n)
{
return *this << (unsigned long)n;
}
inline
OutputByteStream &OutputByteStream::operator<<(const String<char> &s)
{
sputn(s.data(), s.size());
return *this;
}
class SP_API StrOutputByteStream : public OutputByteStream {
public:
StrOutputByteStream();
void extractString(String<char> &);
protected:
StrOutputByteStream(const StrOutputByteStream &); // undefined
void operator=(const StrOutputByteStream &); // undefined
void flush();
void flushBuf(char);
String<char> buf_;
};
class SP_API FileOutputByteStream : public OutputByteStream {
public:
FileOutputByteStream();
FileOutputByteStream(int fd, Boolean closeFd = 1);
~FileOutputByteStream();
#ifdef SP_WIDE_SYSTEM
Boolean open(const wchar_t *);
#else
Boolean open(const char *);
#endif
Boolean attach(int fd, Boolean closeFd = 1);
Boolean close();
private:
FileOutputByteStream(const FileOutputByteStream &); // undefined
void operator=(const FileOutputByteStream &); // undefined
void flush();
void flushBuf(char);
String<char> buf_;
int fd_;
Boolean closeFd_;
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not OutputByteStream_INCLUDED */
|