aboutsummaryrefslogtreecommitdiff
path: root/libxsd-frontend/semantic-graph/element.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-12-15 22:23:46 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-02-25 13:39:56 +0300
commit949a9f572341b6cd07690f0b78b1b1941d320055 (patch)
treea4b9a32fb5a4cd6a46a17718cc854697df49c920 /libxsd-frontend/semantic-graph/element.hxx
parent061b59ec50c40e8757c5e9237f45a2c7ade36d62 (diff)
Switch to build2
Diffstat (limited to 'libxsd-frontend/semantic-graph/element.hxx')
-rw-r--r--libxsd-frontend/semantic-graph/element.hxx93
1 files changed, 93 insertions, 0 deletions
diff --git a/libxsd-frontend/semantic-graph/element.hxx b/libxsd-frontend/semantic-graph/element.hxx
new file mode 100644
index 0000000..ff5a863
--- /dev/null
+++ b/libxsd-frontend/semantic-graph/element.hxx
@@ -0,0 +1,93 @@
+// file : libxsd-frontend/semantic-graph/element.hxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#ifndef LIBXSD_FRONTEND_SEMANTIC_GRAPH_ELEMENT_HXX
+#define LIBXSD_FRONTEND_SEMANTIC_GRAPH_ELEMENT_HXX
+
+#include <libxsd-frontend/semantic-graph/elements.hxx>
+#include <libxsd-frontend/semantic-graph/particle.hxx>
+
+namespace XSDFrontend
+{
+ namespace SemanticGraph
+ {
+ class Element;
+
+ class Substitutes: public virtual Edge
+ {
+ public:
+ Element&
+ substitution () const
+ {
+ return *substitution_;
+ }
+
+ Element&
+ root () const
+ {
+ return *root_;
+ }
+
+ public:
+ void
+ set_left_node (Element& n)
+ {
+ substitution_ = &n;
+ }
+
+ void
+ set_right_node (Element& n)
+ {
+ root_ = &n;
+ }
+
+ private:
+ Element* root_;
+ Element* substitution_;
+ };
+
+
+ class Element: public virtual Member,
+ public virtual Particle
+ {
+ public:
+ bool
+ substitutes_p () const
+ {
+ return substitutes_ != 0;
+ }
+
+ Substitutes&
+ substitutes () const
+ {
+ assert (substitutes_ != 0);
+ return *substitutes_;
+ }
+
+ public:
+ Element (Path const& file,
+ unsigned long line,
+ unsigned long column,
+ bool global,
+ bool qualified);
+
+ void
+ add_edge_left (Substitutes& e)
+ {
+ substitutes_ = &e;
+ }
+
+ void
+ add_edge_right (Substitutes&) {}
+
+ using Member::add_edge_left;
+ using Member::add_edge_right;
+ using Particle::add_edge_right;
+
+ private:
+ Substitutes* substitutes_;
+ };
+ }
+}
+
+#endif // LIBXSD_FRONTEND_SEMANTIC_GRAPH_ELEMENT_HXX