diff options
| author | Jörg Frings-Fürst <debian@jff.email> | 2024-03-06 10:24:11 +0100 | 
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff.email> | 2024-03-06 10:24:11 +0100 | 
| commit | 4538829ab86b5a1cd4e845e7eab165029c9d6d46 (patch) | |
| tree | bbadf39aed0610c8f8f7b41fefff47773b8ac205 /xsd/cxx/parser/characters-validation-source.cxx | |
| parent | 23d41842168ac1a1580111b9c5c73500ceee3d57 (diff) | |
| parent | aad5ad9bf0c02aa4e79bc6b7d6c934612fff4026 (diff) | |
Update upstream source from tag 'upstream/4.2.0'
Update to upstream version '4.2.0'
with Debian dir 1b38df7bbcf313223de3c50107ac0255090fe647
Diffstat (limited to 'xsd/cxx/parser/characters-validation-source.cxx')
| -rw-r--r-- | xsd/cxx/parser/characters-validation-source.cxx | 73 | 
1 files changed, 73 insertions, 0 deletions
diff --git a/xsd/cxx/parser/characters-validation-source.cxx b/xsd/cxx/parser/characters-validation-source.cxx new file mode 100644 index 0000000..749a4cc --- /dev/null +++ b/xsd/cxx/parser/characters-validation-source.cxx @@ -0,0 +1,73 @@ +// file      : xsd/cxx/parser/characters-validation-source.cxx +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <xsd/cxx/parser/characters-validation-source.hxx> + +#include <libxsd-frontend/semantic-graph.hxx> +#include <libxsd-frontend/traversal.hxx> + +namespace CXX +{ +  namespace Parser +  { +    namespace +    { +      // +      // +      struct Complex: Traversal::Complex, Context +      { +        Complex (Context& c) +            : Context (c) +        { +        } + +        virtual void +        traverse (Type& c) +        { +          if (!c.mixed_p ()) +            return; + +          String const& name (ename (c)); + +          os <<"// Character validation functions for " << name << "." << endl +             <<"//" << endl; + +            // _characters_impl +            // +          os << "bool " << name << "::" << endl +             << "_characters_impl (const " << string_type << "& s)" +             << "{" +             << "this->_any_characters (s);" +             << "return true;" +             << "}"; +        } +      }; +    } + +    void +    generate_characters_validation_source (Context& ctx) +    { +      //@@ Most of the time there is no mixed content type so +      //   we generate an empty namespace which looks ugly. Will +      //   need to implement smart namespace to handle this at +      //   some point. +      // +      Traversal::Schema schema; + +      Sources sources; +      Traversal::Names schema_names; + +      Namespace ns (ctx); +      Traversal::Names names; + +      schema >> sources >> schema; +      schema >> schema_names >> ns >> names; + +      Complex complex (ctx); + +      names >> complex; + +      schema.dispatch (ctx.schema_root); +    } +  } +}  | 
