aboutsummaryrefslogtreecommitdiff
path: root/examples/cxx/hybrid/binary/custom/irawstream.hxx
blob: 7df4d8ad204aba0892f9ef577bf31da268ec6b00 (plain)
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
// file      : examples/cxx/hybrid/binary/custom/irawstream.hxx
// author    : Boris Kolpackov <boris@codesynthesis.com>
// copyright : not copyrighted - public domain

#ifndef IRAWSTREAM_HXX
#define IRAWSTREAM_HXX

#include <stddef.h>  // size_t

#include <string>

#include "exceptions.hxx"
#include "xml-schema.hxx"

class irawstream
{
public:
  explicit
  irawstream (const xml_schema::buffer&, size_t start = 0);

public:
  struct as_size
  {
    explicit as_size (size_t& s) : s_ (s) {}
    size_t& s_;
  };

public:
  void operator>> (bool&);
  void operator>> (signed char&);
  void operator>> (unsigned char&);
  void operator>> (short&);
  void operator>> (unsigned short&);
  void operator>> (int&);
  void operator>> (unsigned int&);
  void operator>> (long&);
  void operator>> (unsigned long&);

#ifdef XSDE_LONGLONG
  void operator>> (long long&);
  void operator>> (unsigned long long&);
#endif

  void operator>> (as_size&);
  void operator>> (float&);
  void operator>> (double&);

  void operator>> (std::string&);
  void operator>> (xml_schema::buffer&);

private:
  irawstream (const irawstream&);
  irawstream& operator= (const irawstream&);

public:
  const char*
  align (size_t alignment, size_t size);

private:
  const xml_schema::buffer& buf_;
  size_t pos_;
};

void operator>> (irawstream&, xml_schema::any_type&);
void operator>> (irawstream&, xml_schema::qname&);
void operator>> (irawstream&, xml_schema::time_zone&);
void operator>> (irawstream&, xml_schema::date&);
void operator>> (irawstream&, xml_schema::date_time&);
void operator>> (irawstream&, xml_schema::duration&);
void operator>> (irawstream&, xml_schema::gday&);
void operator>> (irawstream&, xml_schema::gmonth&);
void operator>> (irawstream&, xml_schema::gmonth_day&);
void operator>> (irawstream&, xml_schema::gyear&);
void operator>> (irawstream&, xml_schema::gyear_month&);
void operator>> (irawstream&, xml_schema::time&);

void operator>> (irawstream&, xml_schema::string_sequence&);

template <typename T>
void operator>> (irawstream&, xml_schema::pod_sequence<T>&);

template <typename T>
void operator>> (irawstream&, xml_schema::fix_sequence<T>&);

template <typename T>
void operator>> (irawstream&, xml_schema::var_sequence<T>&);

#include "irawstream.ixx"
#include "irawstream.txx"

#endif  // IRAWSTREAM_HXX