| 1 | #include<config.h> |
| 2 | |
| 3 | #include <apt-pkg/vendor.h> |
| 4 | #include <apt-pkg/configuration.h> |
| 5 | |
| 6 | #include <iostream> |
| 7 | #include <map> |
| 8 | #include <string> |
| 9 | #include <utility> |
| 10 | #include <vector> |
| 11 | |
| 12 | Vendor::Vendor(std::string VendorID, |
| 13 | std::string Origin, |
| 14 | std::vector<struct Vendor::Fingerprint *> *FingerprintList) |
| 15 | { |
| 16 | this->VendorID = VendorID; |
| 17 | this->Origin = Origin; |
| 18 | for (std::vector<struct Vendor::Fingerprint *>::iterator I = FingerprintList->begin(); |
| 19 | I != FingerprintList->end(); ++I) |
| 20 | { |
| 21 | if (_config->FindB("Debug::Vendor", false)) |
| 22 | std::cerr << "Vendor \"" << VendorID << "\": Mapping \"" |
| 23 | << (*I)->Print << "\" to \"" << (*I)->Description << '"' << std::endl; |
| 24 | Fingerprints[(*I)->Print] = (*I)->Description; |
| 25 | } |
| 26 | delete FingerprintList; |
| 27 | } |
| 28 | |
| 29 | const std::string Vendor::LookupFingerprint(std::string Print) const |
| 30 | { |
| 31 | std::map<std::string,std::string>::const_iterator Elt = Fingerprints.find(Print); |
| 32 | if (Elt == Fingerprints.end()) |
| 33 | return ""; |
| 34 | else |
| 35 | return (*Elt).second; |
| 36 | } |
| 37 | |
| 38 | APT_CONST bool Vendor::CheckDist(std::string /*Dist*/) |
| 39 | { |
| 40 | return true; |
| 41 | } |