Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / nsgmls / SdText.h
1 /* $XConsortium: SdText.h /main/1 1996/07/29 17:03:58 cde-hp $ */
2 // Copyright (c) 1995 James Clark
3 // See the file COPYING for copying permission.
4
5 #ifndef SdText_INCLUDED
6 #define SdText_INCLUDED 1
7
8 #ifdef __GNUG__
9 #pragma interface
10 #endif
11
12 #include "types.h"
13 #include "StringOf.h"
14 #include "Vector.h"
15 #include "Location.h"
16 #include <stddef.h>
17
18 #ifdef SP_NAMESPACE
19 namespace SP_NAMESPACE {
20 #endif
21
22 struct SP_API SdTextItem {
23   SdTextItem();
24   Location loc;
25   size_t index;
26 };
27
28 class SP_API SdText {
29 public:
30   SdText();
31   SdText(const Location &loc, Boolean lita);
32   void swap(SdText &);
33   void addChar(SyntaxChar, const Location &);
34   const String<SyntaxChar> &string() const;
35   Boolean lita() const;
36   Location endDelimLocation() const;
37 private:
38   Boolean lita_;
39   String<SyntaxChar> chars_;
40   Vector<SdTextItem> items_;
41   friend class SdTextIter;
42 };
43
44 class SP_API SdTextIter {
45 public:
46   SdTextIter(const SdText &);
47   Boolean next(const SyntaxChar *&, size_t &, Location &);
48 private:
49   const SdText *ptr_;
50   size_t itemIndex_;
51 };
52
53 inline
54 Boolean SdText::lita() const
55 {
56   return lita_;
57 }
58
59 inline
60 const String<SyntaxChar> &SdText::string() const
61 {
62   return chars_;
63 }
64
65 #ifdef SP_NAMESPACE
66 }
67 #endif
68
69 #endif /* not SdText_INCLUDED */