Confdump Agent
1.4.0
|
Abstracts walking a IEnumWbemClassObject. More...
#include <WbemServices.hpp>
Public Member Functions | |
WbemQueryIterator () | |
Construct a past-the-end iterator. | |
WbemQueryIterator (boost::shared_ptr< IEnumWbemClassObject > enumerator) | |
Construct a valid iterator. | |
~WbemQueryIterator () | |
Private Member Functions | |
bool | equal (const WbemQueryIterator &other) const |
operator== implementation, compares on the element_ . | |
void | increment () |
operator++ implementation, makes a Next() call on the underlying enumerator. | |
boost::shared_ptr < IWbemClassObject > | dereference () const |
operator* implementation | |
Private Attributes | |
boost::shared_ptr < IEnumWbemClassObject > | enumerator_ |
boost::shared_ptr < IWbemClassObject > | element_ |
Friends | |
class | boost::iterator_core_access |
class | node_iter |
Abstracts walking a IEnumWbemClassObject.
This is a STL-compatible forward-only wrapper around the COM IEnumWbemClassObject. The interface of this class is empty because boost::iterator_facade provides it (so just assume that it works like a pointer to a shared_ptr<IWbemClassObject> that you can increment and derefence).
These operations and the constructor can throw ComError and WmiError instances.
The primary use of this class is to support WbemServices::execQuery(), but anything that deals with IEnumWbemClassObject can benefit from it.
Typical usage:
shared_ptr<IEnumWbemClassObject> enumerator = ... boost::iterator_range<WbemQueryIterator> range( WbemQueryIterator( enumerator ), WbemQueryIterator() ); BOOST_FOREACH( shared_ptr<IWbemClassObject> object, range ) ...
The returned iterator_range object provides the begin() and end() accessors like on all STL-compatible containers (this makes it work with BOOST_FOREACH() too). These returned iterators are plain copies of the constructor arguments, respectively:
Definition at line 70 of file WbemServices.hpp.
Construct a past-the-end iterator.
Definition at line 38 of file WbemServices.cpp.
Confdump::System::Wmi::WbemQueryIterator::WbemQueryIterator | ( | boost::shared_ptr< IEnumWbemClassObject > | enumerator | ) | [explicit] |
Definition at line 48 of file WbemServices.cpp.
boost::shared_ptr<IWbemClassObject> Confdump::System::Wmi::WbemQueryIterator::dereference | ( | ) | const [inline, private] |
operator* implementation
Definition at line 104 of file WbemServices.hpp.
References element_.
bool Confdump::System::Wmi::WbemQueryIterator::equal | ( | const WbemQueryIterator & | other | ) | const [private] |
operator== implementation, compares on the element_ .
Definition at line 52 of file WbemServices.cpp.
References element_.
void Confdump::System::Wmi::WbemQueryIterator::increment | ( | ) | [private] |
operator++ implementation, makes a Next() call on the underlying enumerator.
Definition at line 57 of file WbemServices.cpp.
References element_, enumerator_, Confdump::System::Wmi::guardComObject(), and Confdump::System::Wmi::throwOnWmiError().
Referenced by WbemQueryIterator().
friend class boost::iterator_core_access [friend] |
Definition at line 85 of file WbemServices.hpp.
friend class node_iter [friend] |
Definition at line 86 of file WbemServices.hpp.
boost::shared_ptr<IWbemClassObject> Confdump::System::Wmi::WbemQueryIterator::element_ [private] |
Definition at line 107 of file WbemServices.hpp.
Referenced by dereference(), equal(), and increment().
boost::shared_ptr<IEnumWbemClassObject> Confdump::System::Wmi::WbemQueryIterator::enumerator_ [private] |
Definition at line 106 of file WbemServices.hpp.
Referenced by increment().