return ConfigItem::Ptr();
}
-bool ConfigItem::HasObject(const String& type, const String& name)
-{
- std::pair<String, String> key = std::make_pair(type, name);
- ConfigItem::ItemMap::iterator it;
-
- {
- boost::mutex::scoped_lock lock(m_Mutex);
-
- it = m_Items.find(key);
- }
-
- return (it != m_Items.end());
-}
-
void ConfigItem::ValidateItem(void)
{
if (m_Validated)
static ConfigItem::Ptr GetObject(const String& type,
const String& name);
- static bool HasObject(const String& type, const String& name);
void ValidateItem(void);
bool TypeRule::MatchValue(const Value& value, String *hint) const
{
+ ConfigItem::Ptr item;
+
if (value.IsEmpty())
return true;
if (!value.IsScalar())
return false;
- if (!ConfigItem::HasObject(m_NameType, value)) {
+ item = ConfigItem::GetObject(m_NameType, value);
+
+ if (!item) {
*hint = "Object '" + value + "' of type '" + m_NameType + "' does not exist.";
return false;
}
+ if (item->IsAbstract()) {
+ *hint = "Object '" + value + "' of type '" + m_NameType + "' must not be a template.";
+ return false;
+ }
+
return true;
default: