7 #ifndef ATTRIBUTESOURCE_H
8 #define ATTRIBUTESOURCE_H
26 virtual AttributePtr createAttributeInstance(
const String& className);
31 AttributePtr attrImpl = createAttributeInstance(className);
32 return attrImpl ? attrImpl : newLucene<ATTR>();
76 String className(ATTR::_getClassName());
77 boost::shared_ptr<ATTR> attrImpl(boost::dynamic_pointer_cast<ATTR>(getAttribute(className)));
80 attrImpl = boost::dynamic_pointer_cast<ATTR>(factory->createInstance<ATTR>(className));
83 addAttribute(className, attrImpl);
89 void addAttribute(
const String& className,
AttributePtr attrImpl);
98 return getAttribute(ATTR::_getClassName());
102 template <
class ATTR>
105 String className(ATTR::_getClassName());
106 boost::shared_ptr<ATTR> attr(boost::dynamic_pointer_cast<ATTR>(getAttribute(className)));
108 boost::throw_exception(
IllegalArgumentException(L
"This AttributeSource does not have the attribute '" + className + L
"'."));
114 void clearAttributes();
132 virtual int32_t hashCode();
138 virtual String toString();
154 bool hasAttribute(
const String& className);
156 void computeCurrentState();
168 virtual AttributePtr createAttributeInstance(
const String& className);