PCTypeMap.cpp
Go to the documentation of this file.00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifdef _MSC_VER
00025 #include <windows_config.h>
00026 #else
00027 #include <config.h>
00028 #endif
00029
00030 #include <string>
00031 #include <map>
00032 #include "PCTypeMap.h"
00033
00034 #ifdef CHECK_MEMORY_LEAKS
00035 #include <foreign/nvwa/debug_new.h>
00036 #endif // CHECK_MEMORY_LEAKS
00037
00038
00039
00040
00041
00042 PCTypeMap::PCTypeMap() throw() {}
00043
00044
00045 PCTypeMap::~PCTypeMap() throw() {}
00046
00047
00048 bool
00049 PCTypeMap::add(const std::string &id, const std::string &newid,
00050 const std::string &color, const std::string &prefix,
00051 int layer, bool discard, bool allowFill) throw() {
00052 if (has(id)) {
00053 return false;
00054 }
00055 TypeDef td;
00056 td.id = newid;
00057 td.color = color;
00058 td.layer = layer;
00059 td.discard = discard;
00060 td.allowFill = allowFill;
00061 td.prefix = prefix;
00062 myTypes[id] = td;
00063 return true;
00064 }
00065
00066
00067 const PCTypeMap::TypeDef &
00068 PCTypeMap::get(const std::string &id) throw() {
00069 return myTypes.find(id)->second;
00070 }
00071
00072
00073 bool
00074 PCTypeMap::has(const std::string &id) throw() {
00075 return myTypes.find(id)!=myTypes.end();
00076 }
00077
00078
00079
00080
00081