summaryrefslogtreecommitdiffstats
path: root/lskat/lskatproc/KEMessage.h
blob: 0a1913ccbe5ccad26d1c99e8419d9f2a55661f58 (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
/***************************************************************************
                          KEMessage.h  -  description
                             -------------------
    begin                : Tue May 2 2000
    copyright            : (C) 2000 by Martin Heni
    email                : [email protected]
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#ifndef _KEMESSAGE_H_
#define _KEMESSAGE_H_

#include <string.h>
#include <qstring.h>
#include <qstrlist.h>
#include <qdict.h>
#include "KMessageEntry.h"

#define KEMESSAGE_HEAD QString(QCString("BEGIN_V1000"))
#define KEMESSAGE_TAIL QString(QCString("END_V1000"))
#define KEMESSAGE_CR   QString(QCString("\n"))
#define KEMESSAGE_SEP  QString(QCString(":::"))

class KEMessage
{
  private:
  QStrList keys;
  QDict<KMessageEntry> dict;

  protected:
  void AddEntry(QString key,KMessageEntry *entry);
  public:
  QStrList *QueryKeys();
  uint QueryNumberOfKeys();
  void AddDataType(QString key,int size,const char *data,KGM_TYPE type);
  void AddData(QString key,short data);
  void AddData(QString key,long data);
  void AddData(QString key,float data);
  void AddData(QString key,const char *data,int size=-1);
  bool GetData(QString key,short &s);
  bool GetData(QString key,long &l);
  bool GetData(QString key,float &f);
  bool GetData(QString key,char * &c,int &size);
  bool HasKey(QString key);
  void Remove(QString key);
  KGM_TYPE QueryType(QString key);
  QString ToString();
  QString EntryToString(char *key,KMessageEntry *entry);
  QString StringToEntry(QString str,KMessageEntry *entry);
  bool AddString(QString s);
  bool AddStringMsg(QString str);
  void RemoveAll();
  ~KEMessage();
  KEMessage();
  KEMessage(KEMessage &msg);
  KEMessage &operator=(KEMessage &msg);
};

#endif