Ubuntu TV Media Scanner
A centralized index for removable media content.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | List of all members
mediascanner::GenericProperty< PropertyType, ValueType > Class Template Reference

This class adds some utilities for property implementations. More...

#include <mediascanner/property.h>

+ Inheritance diagram for mediascanner::GenericProperty< PropertyType, ValueType >:

Classes

class  Private
 

Public Types

typedef ValueType value_type
 
- Public Types inherited from mediascanner::Property
enum  Boundary { Inclusive, Exclusive }
 Boundaries of a range query. More...
 
enum  MergeStrategy { MergeAppend, MergeReplace, MergePreserve }
 How to resolve merge conflicts for this property. More...
 
typedef boost::variant
< boost::blank, bool, int32_t,
uint64_t, double, Fraction,
DateTime, String
ValueBase
 
typedef std::pair< Property,
Property::Value
BoundValue
 A property value bound to an actual property. More...
 
typedef std::map< Property, ValueValueMap
 Maps properties to their actual values. More...
 
typedef std::set< PropertySet
 A set of distinct properties. More...
 
typedef std::function< bool(const
Property &property)> 
PropertyVisitor
 Functions of this kind are passed to the VisitAll() method. More...
 
typedef std::function< bool(GstDiscovererInfo
*info, GstDiscovererStreamInfo
*stream, ValueMap *item)> 
StreamInfoFunction
 Functions of this kind are merge the discoverer's stream information. More...
 

Public Member Functions

BoundValue bind_value (const ValueType &value) const
 
- Public Member Functions inherited from mediascanner::Property
 Property ()
 Constructs an unidentified property. More...
 
 Property (const Property &other)
 Constructs a copy of the other property. More...
 
 ~Property ()
 
String field_name () const
 Name of the Lucene++ field. More...
 
const MetadataKeymetadata_key () const
 Id of the Grilo metadata key. More...
 
Category category () const
 Category of the property. More...
 
std::set< std::string > origins () const
 Origins of this property. More...
 
bool is_null () const
 Checks if the property is undefined (null). More...
 
bool supports_full_text_search () const
 Checks if the property permits full text searches. More...
 
MergeStrategy merge_strategy () const
 How to resolve merge conflicts for this property. More...
 
bool MergeStreamInfo (GstDiscovererInfo *media, GstDiscovererStreamInfo *stream, ValueMap *properties) const
 Extracts property values from discoverer stream information. More...
 
LuceneFields MakeFields (const Value &value) const
 Turns a property value into Lucene++ fields. More...
 
Value TransformFields (const LuceneFields &fields) const
 Extracts property values of the Lucene++ fields. More...
 
Value TransformSingleField (Lucene::FieldablePtr field) const
 
Lucene::QueryPtr MakeTermQuery (const Value &value) const
 Constructs a Lucene term query for this property and value. More...
 
Lucene::QueryPtr MakeRangeQuery (const Value &lower_value, Boundary lower_boundary, const Value &upper_value, Boundary upper_boundary) const
 Constructs a Lucene term query for this property and value. More...
 
Lucene::QueryPtr MakeRangeQuery (const Value &lower_value, const Value &upper_value)
 Constructs a Lucene term query for this property and value. More...
 
template<typename T >
bool TransformTagValue (const GValue *input, Value *output) const
 Converts a tag value into a canonical property value. More...
 
bool TransformGriloValue (const GValue *input, Value *output) const
 Converts a tag value into a canonical property value. More...
 
bool TransformDBusVariant (GVariant *input, Value *output) const
 
GValueMakeGriloValue (const Value &value) const
 Turns a property value into a Grilo value. More...
 
bool operator== (const Property &other) const
 Checks if two properties are the same. More...
 
bool operator!= (const Property &other) const
 Checks if two properties are the different. More...
 
 operator const void * () const
 Safe boolean cast. The more natural operator bool() is problematic because it leads to unwanted implicit casts. More...
 
bool operator< (const Property &other) const
 Define sort order for usage in std::map. More...
 

Protected Types

typedef value_type(* MediaInfoGetter )(const GstDiscovererInfo *)
 
typedef value_type(* StreamInfoGetter )(const GstDiscovererStreamInfo *)
 
typedef value_type(* AudioInfoGetter )(const GstDiscovererAudioInfo *)
 
typedef value_type(* VideoInfoGetter )(const GstDiscovererVideoInfo *)
 
- Protected Types inherited from mediascanner::Property
typedef std::shared_ptr< PrivatePrivatePtr
 Shared pointer to internal property fields. More...
 

Protected Member Functions

 GenericProperty (Private *impl)
 
StreamInfoFunction bind_attr (MediaInfoGetter get_attribute)
 
StreamInfoFunction bind_attr (StreamInfoGetter get_attribute)
 
StreamInfoFunction bind_attr (AudioInfoGetter get_attribute)
 
StreamInfoFunction bind_attr (VideoInfoGetter get_attribute)
 
StreamInfoFunction bind_tag (const char *tag_name) const
 
- Protected Member Functions inherited from mediascanner::Property
 Property (PrivatePtr impl)
 Constructs a new property instance. More...
 
StreamInfoFunction bind_any (const StreamInfoFunction &first, const StreamInfoFunction &second) const
 
template<typename ValueType >
bool MergeAttribute (GstDiscovererInfo *media, GstDiscovererStreamInfo *stream, ValueType(*get_attribute)(const GstDiscovererInfo *), ValueMap *item) const
 
template<typename ValueType , typename InfoType >
bool MergeAttribute (GstDiscovererInfo *media, GstDiscovererStreamInfo *stream, ValueType(*get_attribute)(const InfoType *), ValueMap *item) const
 
template<typename ValueType >
bool MergeTag (GstDiscovererInfo *media, GstDiscovererStreamInfo *stream, const char *tag_name, ValueMap *item) const
 
template<typename ValueType >
StreamInfoFunction bind_attr (ValueType(*)(const GstDiscovererInfo *))
 
template<typename ValueType , typename InfoType >
StreamInfoFunction bind_attr (ValueType(*)(const InfoType *))
 
template<typename ValueType >
StreamInfoFunction bind_tag (const char *tag_name) const
 

Additional Inherited Members

- Static Public Member Functions inherited from mediascanner::Property
static Property FromFieldName (const String &name)
 Finds a property by its Lucene++ field name. More...
 
static Property FromMetadataKey (GrlKeyID key)
 Finds a property by its Grilo metadata key. More...
 
static void VisitAll (const PropertyVisitor &visit)
 Visits all property declarations known to the media scanner. More...
 
- Static Protected Member Functions inherited from mediascanner::Property
static MetadataKey define_boolean (const char *name, const char *nick, const char *blurb, bool default_value)
 
static MetadataKey define_datetime (const char *name, const char *nick, const char *blurb)
 
static MetadataKey define_string (const char *name, const char *nick, const char *blurb, const char *default_value=0)
 
static bool merge_nothing (const GstDiscovererInfo *, const GstDiscovererStreamInfo *, ValueMap *)
 
static bool MergeAny (GstDiscovererInfo *media, GstDiscovererStreamInfo *stream, const StreamInfoFunction &merge_first, const StreamInfoFunction &merge_second, ValueMap *item)
 

Detailed Description

template<typename PropertyType, typename ValueType>
class mediascanner::GenericProperty< PropertyType, ValueType >

This class adds some utilities for property implementations.

Member Typedef Documentation

template<typename PropertyType, typename ValueType>
typedef value_type(* mediascanner::GenericProperty< PropertyType, ValueType >::AudioInfoGetter)(const GstDiscovererAudioInfo *)
protected
template<typename PropertyType, typename ValueType>
typedef value_type(* mediascanner::GenericProperty< PropertyType, ValueType >::MediaInfoGetter)(const GstDiscovererInfo *)
protected
template<typename PropertyType, typename ValueType>
typedef value_type(* mediascanner::GenericProperty< PropertyType, ValueType >::StreamInfoGetter)(const GstDiscovererStreamInfo *)
protected
template<typename PropertyType, typename ValueType>
typedef ValueType mediascanner::GenericProperty< PropertyType, ValueType >::value_type
template<typename PropertyType, typename ValueType>
typedef value_type(* mediascanner::GenericProperty< PropertyType, ValueType >::VideoInfoGetter)(const GstDiscovererVideoInfo *)
protected

Constructor & Destructor Documentation

template<typename PropertyType, typename ValueType>
mediascanner::GenericProperty< PropertyType, ValueType >::GenericProperty ( Private impl)
inlineexplicitprotected

Member Function Documentation

template<typename PropertyType, typename ValueType>
StreamInfoFunction mediascanner::GenericProperty< PropertyType, ValueType >::bind_attr ( MediaInfoGetter  get_attribute)
inlineprotected
template<typename PropertyType, typename ValueType>
StreamInfoFunction mediascanner::GenericProperty< PropertyType, ValueType >::bind_attr ( StreamInfoGetter  get_attribute)
inlineprotected
template<typename PropertyType, typename ValueType>
StreamInfoFunction mediascanner::GenericProperty< PropertyType, ValueType >::bind_attr ( AudioInfoGetter  get_attribute)
inlineprotected
template<typename PropertyType, typename ValueType>
StreamInfoFunction mediascanner::GenericProperty< PropertyType, ValueType >::bind_attr ( VideoInfoGetter  get_attribute)
inlineprotected
template<typename PropertyType, typename ValueType>
StreamInfoFunction mediascanner::GenericProperty< PropertyType, ValueType >::bind_tag ( const char *  tag_name) const
inlineprotected
template<typename PropertyType, typename ValueType>
BoundValue mediascanner::GenericProperty< PropertyType, ValueType >::bind_value ( const ValueType &  value) const
inline