1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/target/modalias/Modalias.h
12 #ifndef ZYPP_TARGET_MODALIAS_MODALIAS_H
13 #define ZYPP_TARGET_MODALIAS_MODALIAS_H
19 #include "zypp/base/PtrTypes.h"
20 #include "zypp/IdString.h"
22 ///////////////////////////////////////////////////////////////////
24 { /////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////
27 { /////////////////////////////////////////////////////////////////
29 ///////////////////////////////////////////////////////////////////
31 // CLASS NAME : Modalias
33 /** Hardware abstaction layer singleton.
37 friend std::ostream & operator<<( std::ostream & str, const Modalias & obj );
44 typedef std::vector<std::string> ModaliasList;
46 /** Singleton access. */
47 static Modalias & instance();
54 /** Checks if a device on the system matches a modalias pattern.
56 * Returns \c false if no matching device is found, and the modalias
57 * of the first matching device otherwise. (More than one device
58 * may match a given pattern.)
60 * On a system that has the following device,
62 * pci:v00008086d0000265Asv00008086sd00004556bc0Csc03i00
64 * the following query will return \c true:
66 * modalias_matches("pci:v00008086d0000265Asv*sd*bc*sc*i*")
69 bool query( IdString cap_r ) const
70 { return query( cap_r.c_str() ); }
72 bool query( const char * cap_r ) const;
74 bool query( const std::string & cap_r ) const
75 { return query( cap_r.c_str() ); }
77 /** List of modaliases found on system */
78 const ModaliasList & modaliasList() const;
80 /** Manually set list of modaliases to use */
81 void modaliasList( ModaliasList newlist_r );
84 /** Singleton ctor. */
87 /** Pointer to implementation */
88 RW_pointer<Impl> _pimpl;
90 ///////////////////////////////////////////////////////////////////
92 /** \relates Modalias Stream output */
93 std::ostream & operator<<( std::ostream & str, const Modalias & obj );
95 /////////////////////////////////////////////////////////////////
97 ///////////////////////////////////////////////////////////////////
98 /////////////////////////////////////////////////////////////////
100 ///////////////////////////////////////////////////////////////////
101 #endif // ZYPP_TARGET_MODALIAS_MODALIAS_H