summaryrefslogtreecommitdiffstats
path: root/quanta/parsers/dtd/dtd.h
blob: 723ee4b6db3c1f005661e745d1b92c243bbb41a3 (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
/***************************************************************************
                          dtdparser.cpp  -  description
                             -------------------
    begin                : Tue Jul 30 15:26:20 EEST 2002
    copyright            : (C) 2002 by Jason P. Hanley <jphanley@buffalo.edu>
                           (C) 2002, 2003 Andras Mantia <amantia@kde.org>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 DTD_H
#define DTD_H

//qt includes
#include <tqdict.h>

//app includes
#include "tqtag.h"

class KURL;

class DTD
{

public:
  DTD(const KURL &dtdURL, const TQString& dtepDir);
  ~DTD();

public:
  TQStringList getTags();
  AttributeList* getTagAttributes(TQString tag);
  TQStringList getTextCompletion(TQString tag);
  void printContents();
  void writeTagFiles();
  /** No descriptions */
  bool parseDTD();

private:
  bool parseDTD(const KURL& url);
  void parseDTDEntity(const TQString &line);
  void parseDTDElement(const TQString &line);
  void parseDTDAttlist(const TQString &line);
  void parseTagAttributeValues(const TQString &name, TQString *value);
  void parseDTDReplace(TQString *value);
  void stripSpaces(TQString *value);
  void removeComments(TQString &value);

  TQDict<TQString> entities;
  TQDict<TQString> elements;
  TQStringList tags;
  TQDict<AttributeList> tagAttributes;
  /** From where to load the DTD file. */
  KURL m_dtdURL;
  TQString m_dtepDir;
};

#endif