~ubuntu-branches/ubuntu/lucid/libwpd/lucid

« back to all changes in this revision

Viewing changes to src/lib/WPXPropertyListVector.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Rene Engelhard
  • Date: 2007-06-15 13:28:41 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20070615132841-00nybwftc708w96n
Tags: 0.8.10-1
* New upstream release
* bump shlibs for libwpd-stream8c2a 

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
friend class WPXPropertyListVector;
34
34
public:
35
35
        WPXPropertyListVectorImpl(const std::vector<WPXPropertyList> &_vector) : m_vector(_vector) {}
36
 
        WPXPropertyListVectorImpl() {}
 
36
        WPXPropertyListVectorImpl() : m_vector() {}
37
37
        void append(const WPXPropertyList &elem) { m_vector.push_back(elem); }
38
38
        size_t count() const { return m_vector.size(); }
39
39
        std::vector<WPXPropertyList> m_vector;
42
42
class WPXPropertyListVectorIterImpl
43
43
{
44
44
public:
45
 
        WPXPropertyListVectorIterImpl(std::vector<WPXPropertyList> * vect) { 
46
 
                m_vector = vect; 
47
 
                m_iter = m_vector->begin(); 
48
 
                m_imaginaryFirst = false; 
49
 
        }
 
45
        WPXPropertyListVectorIterImpl(std::vector<WPXPropertyList> * vect) :
 
46
                m_vector(vect),
 
47
                m_iter(m_vector->begin()),
 
48
                m_imaginaryFirst(false) {}
50
49
        ~WPXPropertyListVectorIterImpl() {}
51
50
        void rewind() { 
52
51
                m_iter = m_vector->begin(); 
68
67
        const WPXPropertyList & operator()() const { return (*m_iter); }
69
68
 
70
69
private:
 
70
        WPXPropertyListVectorIterImpl(const WPXPropertyListVectorIterImpl&);
 
71
        WPXPropertyListVectorIterImpl& operator=(const WPXPropertyListVectorIterImpl&);
71
72
        std::vector<WPXPropertyList> * m_vector;
72
73
        std::vector<WPXPropertyList>::iterator m_iter;
73
74
        bool m_imaginaryFirst;
74
75
};
75
76
 
76
 
WPXPropertyListVector::WPXPropertyListVector(const WPXPropertyListVector &vect)
 
77
WPXPropertyListVector::WPXPropertyListVector(const WPXPropertyListVector &vect) :
 
78
        m_impl(new WPXPropertyListVectorImpl(static_cast<WPXPropertyListVectorImpl*>(vect.m_impl)->m_vector))
77
79
{
78
 
        WPXPropertyListVectorImpl *vectorImpl = static_cast<WPXPropertyListVectorImpl* >(vect.m_impl);
79
 
        m_impl = new WPXPropertyListVectorImpl(vectorImpl->m_vector);
80
80
}
81
81
 
82
 
WPXPropertyListVector::WPXPropertyListVector()
 
82
WPXPropertyListVector::WPXPropertyListVector() :
 
83
        m_impl(new WPXPropertyListVectorImpl)
83
84
{
84
 
        m_impl = new WPXPropertyListVectorImpl;
85
85
}
86
86
 
87
87
WPXPropertyListVector::~WPXPropertyListVector()
88
88
{
89
 
        delete m_impl;
 
89
        if (m_impl)
 
90
                delete m_impl;
90
91
}
91
92
 
92
93
void WPXPropertyListVector::append(const WPXPropertyList &elem)
99
100
        return m_impl->count();
100
101
}
101
102
 
102
 
WPXPropertyListVector::Iter::Iter(const WPXPropertyListVector &vect) 
 
103
WPXPropertyListVector::Iter::Iter(const WPXPropertyListVector &vect) :
 
104
        m_iterImpl(new WPXPropertyListVectorIterImpl(&(static_cast<WPXPropertyListVectorImpl* >(vect.m_impl)->m_vector)))
103
105
{
104
 
        WPXPropertyListVectorImpl *vectorImpl = static_cast<WPXPropertyListVectorImpl* >(vect.m_impl);
105
 
        m_iterImpl = new WPXPropertyListVectorIterImpl(&(vectorImpl->m_vector));
106
106
}
107
107
 
108
108
WPXPropertyListVector::Iter::~Iter()