aboutsummaryrefslogtreecommitdiff
path: root/libxsde/xsde/cxx/parser/map.ixx
blob: 8d504fe329d8252a9c1bf9f315849139521da69b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// file      : xsde/cxx/parser/map.ixx
// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

namespace xsde
{
  namespace cxx
  {
    namespace parser
    {
#ifndef XSDE_EXCEPTIONS
      inline parser_map_impl::error parser_map_impl::
      _error () const
      {
        return map_._error () ? error_no_memory : error_none;
      }
#endif

      inline parser_map_impl::
      parser_map_impl (size_t buckets)
          : map_ (buckets, sizeof (parser_base*)), resetting_ (false)
      {
      }

      inline void parser_map_impl::
      insert (parser_base& p)
      {
        parser_base* tmp = &p;
        map_.insert (p._dynamic_type (), &tmp);
      }

      inline parser_base* parser_map_impl::
      find (const char* type) const
      {
        const void* p = map_.find (type);
        return p ? *static_cast<parser_base* const*> (p) : 0;
      }
    }
  }
}