|
Revision 111, 1.4 kB
(checked in by mido, 17 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/validating/inheritance-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 | namespace validating |
|---|
| 13 | { |
|---|
| 14 | template <typename C> |
|---|
| 15 | bool inheritance_map<C>:: |
|---|
| 16 | check (const C* derived, const ro_string<C>& base) const |
|---|
| 17 | { |
|---|
| 18 | typename map::const_iterator i (map_.find (derived)); |
|---|
| 19 | |
|---|
| 20 | if (i != map_.end ()) |
|---|
| 21 | { |
|---|
| 22 | if (base == i->second) |
|---|
| 23 | return true; |
|---|
| 24 | else |
|---|
| 25 | return check (i->second, base); |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | return false; |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | // inheritance_map_init |
|---|
| 32 | // |
|---|
| 33 | template<typename C> |
|---|
| 34 | inheritance_map_init<C>:: |
|---|
| 35 | inheritance_map_init () |
|---|
| 36 | { |
|---|
| 37 | if (count == 0) |
|---|
| 38 | map = new inheritance_map<C>; |
|---|
| 39 | |
|---|
| 40 | ++count; |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | template<typename C> |
|---|
| 44 | inheritance_map_init<C>:: |
|---|
| 45 | ~inheritance_map_init () |
|---|
| 46 | { |
|---|
| 47 | if (--count == 0) |
|---|
| 48 | delete map; |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | // inheritance_map_entry |
|---|
| 52 | // |
|---|
| 53 | template<typename C> |
|---|
| 54 | inheritance_map_entry<C>:: |
|---|
| 55 | inheritance_map_entry (const C* derived, const C* base) |
|---|
| 56 | { |
|---|
| 57 | inheritance_map_instance<C> ().insert (derived, base); |
|---|
| 58 | } |
|---|
| 59 | } |
|---|
| 60 | } |
|---|
| 61 | } |
|---|
| 62 | } |
|---|