registryiterator.hh
Go to the documentation of this file.
00001 #ifndef TYPELIB_REGISTRYITERATOR_HH
00002 #define TYPELIB_REGISTRYITERATOR_HH
00003 
00004 #include "registry.hh"
00005 #include "typemodel.hh"
00006 #include "typename.hh"
00007 #include <boost/iterator/iterator_facade.hpp>
00008 
00009 namespace Typelib
00010 {
00011     class Registry;
00012 
00014     class RegistryIterator 
00015         : public boost::iterator_facade
00016             < RegistryIterator
00017             , Type const
00018             , boost::forward_traversal_tag >
00019     {
00020         friend class Registry;
00021 
00022     public:
00023         RegistryIterator(RegistryIterator const& other)
00024             : m_registry(other.m_registry), m_iter(other.m_iter) {}
00025 
00027         std::string getName() const { return m_iter->first; }
00029         std::string getBasename() const { return getTypename(m_iter->first); }
00031         std::string getNamespace() const { return Typelib::getNamespace(m_iter->first); }
00033         std::string getSource() const { return m_iter->second.source_id; }
00035         bool isAlias() const { return m_iter->first != m_iter->second.type->getName(); }
00037         Type const& aliased() const { return *m_iter->second.type; }
00040         bool isPersistent() const { return m_iter->second.persistent; }
00041 
00042         Registry const& getRegistry() const { return m_registry; }
00043 
00044         Type& get_() { return *m_iter->second.type; }
00045 
00046     private:
00047         typedef Registry::TypeMap::const_iterator BaseIter;
00048         Registry const& m_registry;
00049         BaseIter m_iter;
00050             
00051         explicit RegistryIterator(Registry const& registry, BaseIter init)
00052             : m_registry(registry), m_iter(init) {}
00053         friend class boost::iterator_core_access;
00054 
00055         bool equal(RegistryIterator const& other) const
00056         { return other.m_iter == m_iter; }
00057         void increment()
00058         { ++m_iter; }
00059         Type const& dereference() const
00060         { return *m_iter->second.type; }
00061     };
00062 }
00063 
00064 #endif
00065 


typelib
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Thu Jan 2 2014 11:38:41