1 // Copyright (c) 1994 James Clark
2 // See the file COPYING for copying permission.
3 #pragma ident	"%Z%%M%	%I%	%E% SMI"
4 
5 #ifndef LinkProcess_INCLUDED
6 #define LinkProcess_INCLUDED 1
7 #ifdef __GNUG__
8 #pragma interface
9 #endif
10 
11 #include "Lpd.h"
12 #include "IList.h"
13 #include "Link.h"
14 #include "Vector.h"
15 #include "Vector.h"
16 #include "Ptr.h"
17 
18 #ifdef SP_NAMESPACE
19 namespace SP_NAMESPACE {
20 #endif
21 
22 class Messenger;
23 
24 struct SP_API LinkProcessOpenElement : public Link {
25   LinkProcessOpenElement(const LinkSet *current, const SourceLinkRule &);
26   LinkProcessOpenElement(const LinkSet *current);
27   const LinkSet *current;
28   const LinkSet *restore;
29   const LinkSet *post;
30   Boolean postRestore;
31 };
32 
33 class SP_API LinkProcess {
34 public:
35   LinkProcess();
36   void init(const ConstPtr<ComplexLpd> &lpd);
37   Boolean startElement(const ElementType *,
38 		       const AttributeList &attributes,
39 		       const Location &location,
40 		       Messenger &,
41 		       const AttributeList *&linkAttributes,
42 		       const ResultElementSpec *&resultElementSpec);
43   void endElement();
44   void uselink(const LinkSet *linkSet,
45 	       Boolean restore,
46 	       const Lpd *);
47   virtual Boolean selectLinkRule(const Vector<const AttributeList *> &,
48 				 const Location &location,
49 				 size_t &selected);
50   size_t nImpliedLinkRules() const;
51   const ResultElementSpec &impliedLinkRule(size_t) const;
52   const StringC &name() const;
53   Boolean isExplicit() const;
54   void clear();
55   void swap(LinkProcess &);
56 private:
57   LinkProcess(const LinkProcess &); // undefined
58   void operator=(const LinkProcess &); // undefined
59 
60   IList<LinkProcessOpenElement> open_;
61   ConstPtr<ComplexLpd> lpd_;
62   Vector<ConstPtr<Lpd> > activeLpds_;
63   Vector<const AttributeList *> linkAttributes_;
64 };
65 
66 inline
name()67 const StringC &LinkProcess::name() const
68 {
69   return lpd_->name();
70 }
71 
72 inline
isExplicit()73 Boolean LinkProcess::isExplicit() const
74 {
75   return lpd_->type() == Lpd::explicitLink;
76 }
77 
78 #ifdef SP_NAMESPACE
79 }
80 #endif
81 
82 #endif /* not LinkProcess_INCLUDED */
83