| 4491 | } |
| 4492 | |
| 4493 | void Config::addLook(const ConstLookRcPtr & look) |
| 4494 | { |
| 4495 | const std::string name = look->getName(); |
| 4496 | if(name.empty()) |
| 4497 | throw Exception("Cannot addLook with an empty name."); |
| 4498 | |
| 4499 | const std::string namelower = StringUtils::Lower(name); |
| 4500 | |
| 4501 | // If the look exists, replace it |
| 4502 | for(unsigned int i=0; i<getImpl()->m_looksList.size(); ++i) |
| 4503 | { |
| 4504 | if(StringUtils::Lower(getImpl()->m_looksList[i]->getName()) == namelower) |
| 4505 | { |
| 4506 | getImpl()->m_looksList[i] = look->createEditableCopy(); |
| 4507 | |
| 4508 | AutoMutex lock(getImpl()->m_cacheidMutex); |
| 4509 | getImpl()->resetCacheIDs(); |
| 4510 | |
| 4511 | return; |
| 4512 | } |
| 4513 | } |
| 4514 | |
| 4515 | // Otherwise, add it |
| 4516 | getImpl()->m_looksList.push_back(look->createEditableCopy()); |
| 4517 | |
| 4518 | AutoMutex lock(getImpl()->m_cacheidMutex); |
| 4519 | getImpl()->resetCacheIDs(); |
| 4520 | } |
| 4521 | |
| 4522 | void Config::clearLooks() |
| 4523 | { |