aboutsummaryrefslogtreecommitdiff
path: root/xsd-frontend/transformations/schema-per-type.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-09-16 18:14:00 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-09-16 18:14:00 +0200
commitbd6f1415823a473da4518769fc292c10330d821d (patch)
tree98bf0ab2565dfdfbef6fbba16e2c24cb442ee304 /xsd-frontend/transformations/schema-per-type.hxx
Start tracking libxsd-frontend with git
Diffstat (limited to 'xsd-frontend/transformations/schema-per-type.hxx')
-rw-r--r--xsd-frontend/transformations/schema-per-type.hxx55
1 files changed, 55 insertions, 0 deletions
diff --git a/xsd-frontend/transformations/schema-per-type.hxx b/xsd-frontend/transformations/schema-per-type.hxx
new file mode 100644
index 0000000..8be650d
--- /dev/null
+++ b/xsd-frontend/transformations/schema-per-type.hxx
@@ -0,0 +1,55 @@
+// file : xsd-frontend/transformations/schema-per-type.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2006-2009 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#ifndef XSD_FRONTEND_TRANSFORMATIONS_SCHEMA_PER_TYPE_HXX
+#define XSD_FRONTEND_TRANSFORMATIONS_SCHEMA_PER_TYPE_HXX
+
+#include <cult/types.hxx>
+#include <cult/containers/vector.hxx>
+
+#include <xsd-frontend/semantic-graph/elements.hxx> // Path
+#include <xsd-frontend/semantic-graph/schema.hxx>
+
+namespace XSDFrontend
+{
+ namespace Transformations
+ {
+ using namespace Cult::Types;
+
+ class TypeSchemaTranslator
+ {
+ public:
+ virtual
+ ~TypeSchemaTranslator ();
+
+ virtual WideString
+ translate (WideString const& ns, WideString const& name) = 0;
+ };
+
+ // This transformation restructures the semantic graph to have
+ // each type definition in a seperate schema file.
+ //
+ class SchemaPerType
+ {
+ public:
+ struct Failed {};
+
+ // If a type of an element or attribute has a context entry
+ // with the by_value_key key and it is true, then the schema
+ // for this type is included "strongly".
+ //
+ SchemaPerType (TypeSchemaTranslator&, Char const* by_value_key = 0);
+
+ Cult::Containers::Vector<SemanticGraph::Schema*>
+ transform (SemanticGraph::Schema&);
+
+ private:
+ Char const* by_value_key_;
+ TypeSchemaTranslator& trans_;
+ };
+ }
+}
+
+#endif // XSD_FRONTEND_TRANSFORMATIONS_SCHEMA_PER_TYPE_HXX