|
Revision 111, 1.0 kB
(checked in by mido, 18 years ago)
|
|
pridana knihovna XSD (a jeji chlebodarkyne XERCES), v ramci Win32 zprovoznen priklad tests/test_xsd_hello.cxx
|
| Line | |
|---|
| 1 | // file : xsd/cxx/parser/map.txx |
|---|
| 2 | // author : Boris Kolpackov <boris@codesynthesis.com> |
|---|
| 3 | // copyright : Copyright (c) 2005-2008 Code Synthesis Tools CC |
|---|
| 4 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file |
|---|
| 5 | |
|---|
| 6 | namespace xsd |
|---|
| 7 | { |
|---|
| 8 | namespace cxx |
|---|
| 9 | { |
|---|
| 10 | namespace parser |
|---|
| 11 | { |
|---|
| 12 | // parser_map |
|---|
| 13 | // |
|---|
| 14 | template <typename C> |
|---|
| 15 | parser_map<C>:: |
|---|
| 16 | ~parser_map () |
|---|
| 17 | { |
|---|
| 18 | } |
|---|
| 19 | |
|---|
| 20 | // parser_map_impl |
|---|
| 21 | // |
|---|
| 22 | template <typename C> |
|---|
| 23 | parser_map_impl<C>:: |
|---|
| 24 | ~parser_map_impl () |
|---|
| 25 | { |
|---|
| 26 | delete map_; |
|---|
| 27 | } |
|---|
| 28 | |
|---|
| 29 | template <typename C> |
|---|
| 30 | void parser_map_impl<C>:: |
|---|
| 31 | insert (const C* type, parser_base<C>& parser) |
|---|
| 32 | { |
|---|
| 33 | if (map_ == 0) |
|---|
| 34 | map_ = new map; |
|---|
| 35 | |
|---|
| 36 | (*map_)[type] = &parser; |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | template <typename C> |
|---|
| 40 | parser_base<C>* parser_map_impl<C>:: |
|---|
| 41 | find (const ro_string<C>& type) |
|---|
| 42 | { |
|---|
| 43 | if (map_ == 0) |
|---|
| 44 | return 0; |
|---|
| 45 | |
|---|
| 46 | typename map::const_iterator i (map_->find (type)); |
|---|
| 47 | |
|---|
| 48 | return i != map_->end () ? i->second : 0; |
|---|
| 49 | } |
|---|
| 50 | } |
|---|
| 51 | } |
|---|
| 52 | } |
|---|