source: SMSSender/lib/libdatatypes/src/interfaces/istreamable.h @ 71:415b45c71663

3.0
Last change on this file since 71:415b45c71663 was 71:415b45c71663, checked in by Sämy Zehnder <saemy.zehnder@…>, 12 years ago
  • Reorganized all the libraries. libinterfaces and libgateways are removed now and libdatatypes contains now all these files.
File size: 910 bytes
Line 
1/*
2 * istorable.h
3 *
4 *  Created on: May 2, 2009
5 *      Author: saemy
6 */
7
8#ifndef ISTREAMABLE_H_
9#define ISTREAMABLE_H_
10
11#include <QObject>
12
13#include <iostream>
14
15#include "iinterface.h"
16
17class IStreamable: public IInterface {
18    Q_INTERFACES(IInterface)
19
20public:
21    virtual void readFromStream(std::istream& stream)=0;
22    virtual void writeToStream(std::ostream& stream) const =0;
23
24    friend std::istream& operator>>(std::istream&, IStreamable&);
25    friend std::ostream& operator<<(std::ostream&, const IStreamable&);
26};
27
28Q_DECLARE_INTERFACE(IStreamable,
29                     "ch.gorrion.smssender.IStreamable/1.0")
30
31inline std::istream& operator>>(std::istream& in, IStreamable& storable){
32    storable.readFromStream(in);
33    return in;
34}
35
36inline std::ostream& operator<<(std::ostream& out, const IStreamable& storable){
37    storable.writeToStream(out);
38    return out;
39}
40
41#endif /* ISTREAMABLE_H_ */
Note: See TracBrowser for help on using the repository browser.