00001 // catalogxref.h 00002 // 00003 // Copyright (C) 2001, Chris Laurel <claurel@shatters.net> 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU General Public License 00007 // as published by the Free Software Foundation; either version 2 00008 // of the License, or (at your option) any later version. 00009 00010 #ifndef _CATALOGXREF_H_ 00011 #define _CATALOGXREF_H_ 00012 00013 #include <vector> 00014 #include <string> 00015 #include <iostream> 00016 #include <celengine/star.h> 00017 00018 00019 class CatalogCrossReference 00020 { 00021 public: 00022 CatalogCrossReference(); 00023 ~CatalogCrossReference(); 00024 00025 std::string getPrefix() const; 00026 void setPrefix(const std::string&); 00027 00028 uint32 parse(const std::string&) const; 00029 Star* lookup(uint32) const; 00030 Star* lookup(const std::string&) const; 00031 00032 void addEntry(uint32 catalogNumber, Star* star); 00033 void sortEntries(); 00034 void reserve(size_t); 00035 00036 enum { 00037 InvalidCatalogNumber = 0xffffffff, 00038 }; 00039 00040 public: 00041 class Entry 00042 { 00043 public: 00044 uint32 catalogNumber; 00045 Star* star; 00046 }; 00047 00048 private: 00049 std::string prefix; 00050 std::vector<Entry> entries; 00051 }; 00052 00053 00054 class StarDatabase; 00055 00056 extern CatalogCrossReference* ReadCatalogCrossReference(std::istream&, 00057 const StarDatabase&); 00058 00059 #endif // _CATALOGXREF_H_
1.4.1