summaryrefslogtreecommitdiff
path: root/xsd/examples/cxx/parser/multiroot/protocol.hxx
blob: f0761404d2f80154a6180a334583cef8cb390c9e (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
// file      : examples/cxx/parser/multiroot/protocol.hxx
// author    : Boris Kolpackov <boris@codesynthesis.com>
// copyright : not copyrighted - public domain

#ifndef PROTOCOL_HXX
#define PROTOCOL_HXX

namespace protocol
{
  class request
  {
  public:
    virtual
    ~request ()
    {
    }

    unsigned int
    account () const
    {
      return account_;
    }

  protected:
    request (unsigned int account)
        : account_ (account)
    {
    }

  private:
    unsigned int account_;
  };

  class balance: public request
  {
  public:
    balance (unsigned int account)
        : request (account)
    {
    }
  };

  class withdraw: public request
  {
  public:
    withdraw (unsigned int account, unsigned int amount)
        : request (account), amount_ (amount)
    {
    }

    unsigned int
    amount () const
    {
      return amount_;
    }

  private:
    unsigned int amount_;
  };
}

#endif // PROTOCOL_HXX