File: replyparser.h

package info (click to toggle)
sinfo 0.0.48-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 3,332 kB
  • sloc: sh: 11,213; cpp: 6,722; makefile: 271; xml: 151; perl: 149
file content (44 lines) | stat: -rw-r--r-- 761 bytes parent folder | download | duplicates (3)
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
#ifndef _replyparser_h
#define _replyparser_h


#include <map>
#include <boost/shared_ptr.hpp>
#include "message.h"


// http://en.wikipedia.org/wiki/Composite_pattern
class ReplyParser
{
public:
  typedef boost::shared_ptr<ReplyParser> SPtr;

  virtual void parse(Message & replyMessage) = 0;
  virtual ~ReplyParser() {}
};


class CompositeReplyParser: public ReplyParser
{
private:
  struct ParsingEntry
  {
    int replyID;
    ReplyParser::SPtr sPtr;

    ParsingEntry(int replyID, ReplyParser::SPtr sPtr): replyID(replyID), sPtr(sPtr)
    {
    }
  };

  typedef std::map<int, ParsingEntry> mapType;
  mapType myMap;

public:
  void addReplyParser(int replyID, ReplyParser::SPtr sPtr);

  void parse(Message & replyMessage);
};


#endif // _replyparser_h