Lucene++ - a full-featured, c++ search engine
API Documentation
Go to the documentation of this file.
7 #ifndef ATTRIBUTESOURCE_H
8 #define ATTRIBUTESOURCE_H
29 AttributePtr attrImpl = createAttributeInstance(className);
30 return attrImpl ? attrImpl : newLucene<ATTR>();
72 String className(ATTR::_getClassName());
73 boost::shared_ptr<ATTR> attrImpl(boost::dynamic_pointer_cast<ATTR>(getAttribute(className)));
75 attrImpl = boost::dynamic_pointer_cast<ATTR>(factory->createInstance<ATTR>(className));
79 addAttribute(className, attrImpl);
93 return getAttribute(ATTR::_getClassName()).get() != NULL;
99 String className(ATTR::_getClassName());
100 boost::shared_ptr<ATTR> attr(boost::dynamic_pointer_cast<ATTR>(getAttribute(className)));
102 boost::throw_exception(
IllegalArgumentException(L
"This AttributeSource does not have the attribute '" + className + L
"'."));
virtual ~AttributeSourceState()
void computeCurrentState()
virtual ~AttributeFactory()
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Utility template class to handle collections that can be safely copied and shared.
Definition: Collection.h:17
boost::shared_ptr< ATTR > getAttribute()
Returns the instance of the passed in Attribute contained in this AttributeSource.
Definition: AttributeSource.h:98
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition: LuceneTypes.h:539
ExceptionTemplate< RuntimeException, LuceneException::IllegalArgument > IllegalArgumentException
Definition: LuceneException.h:73
void clearAttributes()
Resets all Attributes in this AttributeSource by calling AttributeImpl#clear() on each Attribute impl...
virtual int32_t hashCode()
Return hash code for this object.
bool hasAttribute()
Returns true, if this AttributeSource contains the passed-in Attribute.
Definition: AttributeSource.h:92
virtual bool equals(const LuceneObjectPtr &other)
Return whether two objects are equal.
AttributePtr createInstance(const String &className)
Definition: AttributeSource.h:28
boost::shared_ptr< AttributeSourceState > AttributeSourceStatePtr
Definition: LuceneTypes.h:521
An AttributeSource contains a list of different Attributes, and methods to add and get them....
Definition: AttributeSource.h:43
Definition: AttributeSource.h:14
Definition: AttributeSource.h:154
AttributeSource(const AttributeFactoryPtr &factory)
An AttributeSource using the supplied AttributeFactory for creating new Attribute instances.
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Return clone of this object.
bool hasAttribute(const String &className)
Returns true, if this AttributeSource contains the passed-in Attribute.
void restoreState(const AttributeSourceStatePtr &state)
Restores this state by copying the values of all attribute implementations that this state contains i...
This class holds the state of an AttributeSource.
Definition: AttributeSource.h:168
AttributeSourcePtr cloneAttributes()
Performs a clone of all AttributeImpl instances returned in a new AttributeSource instance....
Definition: AbstractAllTermDocs.h:12
Base class for all Lucene classes.
Definition: LuceneObject.h:31
AttributeFactoryPtr getAttributeFactory()
returns the used AttributeFactory.
virtual AttributePtr createAttributeInstance(const String &className)
returns an Attribute.
boost::shared_ptr< AttributeSource > AttributeSourcePtr
Definition: LuceneTypes.h:520
AttributeSourceStatePtr currentState
Definition: AttributeSource.h:62
AttributeFactoryPtr factory
Definition: AttributeSource.h:57
virtual String toString()
Returns a string representation of the object.
AttributeSource()
An AttributeSource using the default attribute factory DefaultAttributeFactory.
boost::shared_ptr< Attribute > AttributePtr
Definition: LuceneTypes.h:518
void addAttribute(const String &className, const AttributePtr &attrImpl)
Adds a custom Attribute instance.
AttributePtr getAttribute(const String &className)
The caller must pass in a className value. This method checks if an instance of that class is already...
Collection< AttributePtr > getAttributes()
Return a vector of attributes based on currentState.
static AttributeFactoryPtr DEFAULT_ATTRIBUTE_FACTORY()
This is the default factory that creates Attributes using the class name of the supplied Attribute in...
AttributeSource(const AttributeSourcePtr &input)
An AttributeSource that uses the same attributes as the supplied one.
MapStringAttribute attributes
Definition: AttributeSource.h:61
AttributePtr attribute
Definition: AttributeSource.h:172
bool hasAttributes()
Returns true if this AttributeSource has any attributes.
virtual ~DefaultAttributeFactory()
AttributeSourceStatePtr next
Definition: AttributeSource.h:176
AttributeSourceStatePtr captureState()
Captures the state of all Attributes. The return value can be passed to restoreState to restore the s...
boost::shared_ptr< AttributeFactory > AttributeFactoryPtr
Definition: LuceneTypes.h:519
virtual ~AttributeSource()
virtual AttributePtr createAttributeInstance(const String &className)
returns an Attribute.
boost::shared_ptr< ATTR > addAttribute()
This method first checks if an instance of that class is already in this AttributeSource and returns ...
Definition: AttributeSource.h:71
clucene.sourceforge.net