1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #ifndef RUST_CRATE_MAP_H
12 #define RUST_CRATE_MAP_H
25 friend class cratemap;
26 const mod_entry *m_entries;
27 const cratemap* m_children[1];
33 const void *m_annihilate_fn;
34 const mod_entry* m_entries;
35 const cratemap* m_children[1];
37 inline int32_t version() const {
45 typedef const cratemap *const *iterator;
47 inline const void *annihilate_fn() const {
50 case 1: return m_annihilate_fn;
51 default: assert(false && "Unknown crate map version!");
52 return NULL; // Appease -Werror=return-type
56 inline const mod_entry *entries() const {
58 case 0: return reinterpret_cast<const cratemap_v0 *>(this)->m_entries;
59 case 1: return m_entries;
60 default: assert(false && "Unknown crate map version!");
61 return NULL; // Appease -Werror=return-type
65 inline const iterator begin() const {
68 return &reinterpret_cast<const cratemap_v0 *>(this)->
71 return &m_children[1];
72 default: assert(false && "Unknown crate map version!");
73 return NULL; // Appease -Werror=return-type
77 inline const iterator end() const {
85 void iter_module_map(const mod_entry* map,
86 void (*fn)(const mod_entry* entry, void *cookie),
89 void iter_crate_map(const cratemap* map,
90 void (*fn)(const mod_entry* entry, void *cookie),
97 // indent-tabs-mode: nil
99 // buffer-file-coding-system: utf-8-unix
103 #endif /* RUST_CRATE_MAP_H */