From f0510d2f90467de8e8f260b47d79a9baaf9bef17 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 17 Sep 2009 07:15:29 +0200 Subject: Start tracking XSD with git --- libxsd/xsd/cxx/tree/facet.hxx | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 libxsd/xsd/cxx/tree/facet.hxx (limited to 'libxsd/xsd/cxx/tree/facet.hxx') diff --git a/libxsd/xsd/cxx/tree/facet.hxx b/libxsd/xsd/cxx/tree/facet.hxx new file mode 100644 index 0000000..e8f585b --- /dev/null +++ b/libxsd/xsd/cxx/tree/facet.hxx @@ -0,0 +1,43 @@ +// file : xsd/cxx/tree/facet.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_CXX_TREE_FACET_HXX +#define XSD_CXX_TREE_FACET_HXX + +namespace xsd +{ + namespace cxx + { + namespace tree + { + // We need to keep this type POD in order to be able to create a + // static array. + // + struct facet + { + enum id_type + { + none, + total_digits, + fraction_digits + }; + + id_type id; + unsigned long value; + + static const facet* + find (const facet* facets, facet::id_type id) + { + while (facets->id != id && facets->id != none) + ++facets; + + return facets->id != none ? facets : 0; + } + }; + } + } +} + +#endif // XSD_CXX_TREE_FACET_HXX -- cgit v1.1