File: dataoutputstream.h

package info (click to toggle)
dc-qt 0.2.0.alpha-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,948 kB
  • ctags: 5,361
  • sloc: cpp: 28,936; makefile: 19
file content (43 lines) | stat: -rw-r--r-- 839 bytes parent folder | download | duplicates (4)
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
#ifndef dataoutputstream_H__
#define dataoutputstream_H__

#include "outputbuffer.h"
#include "types.h"
#include <string>

namespace rpc {

  /**
   * Provides easy writing of primitive data type values.
   * 
   */
class DataOutputStream
{
 public:
  DataOutputStream(OutputBuffer* aBuffer) : out(aBuffer) {}

  /*! Writes a 32 bit signed integer */
  void writeInt(int32 i);

  /*! Writes a 8 bit signed byte */
  void writeByte(int8 b);

  /*! Writes a 16 bit signed short */
  void writeShort(int16 s);

  /*! Writes a 8 bit boolean value */
  void writeBool(bool b);

  /*! Writes a 64 bit signed integer */
  void writeLong(int64 l);

  /*! Writes a string. The string must be encoded using UTF-8, this method does not perform any conversion. */
  void writeUTF(const std::string& str);

 private:
  OutputBuffer* out;
};

}

#endif