Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef OUTPUT_H
- #define OUTPUT_H
- #include <iostream>
- #include <sstream>
- #include <QString>
- class Output: public std::ostream
- {
- friend std::ostream& operator<<(std::ostream &out, const QString var);
- private:
- class StreamBuffer: public std::stringbuf
- {
- private:
- std::ostream &out;
- QString prefix;
- public:
- StreamBuffer(std::ostream& str, const QString &p);
- //Kada se pozove sync funkcija:
- //1) Ispisemo prefix, onda sadrzaj buffera
- //2) Resetiramo buffer
- //3) pozovemo flush stvarnog objekta koji koristimo za ispis
- virtual int sync();
- };
- //Ova klasa samo koristi specijalnu verziju buffera
- StreamBuffer buffer;
- public:
- Output(const QString &prefix);
- };
- #endif // OUTPUT_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement