/src/librevenge/src/lib/RVNGStringVector.cpp
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ |
2 | | /* librevenge |
3 | | * Version: MPL 2.0 / LGPLv2.1+ |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | * |
9 | | * Major Contributor(s): |
10 | | * Copyright (C) 2012 Fridrich Strba (fridrich.strba@bluewin.ch) |
11 | | * |
12 | | * For minor contributions see the git repository. |
13 | | * |
14 | | * Alternatively, the contents of this file may be used under the terms |
15 | | * of the GNU Lesser General Public License Version 2.1 or later |
16 | | * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are |
17 | | * applicable instead of those above. |
18 | | */ |
19 | | |
20 | | #include <librevenge/librevenge.h> |
21 | | |
22 | | #include <vector> |
23 | | |
24 | | namespace librevenge |
25 | | { |
26 | | |
27 | | class RVNGStringVectorImpl |
28 | | { |
29 | | public: |
30 | 32.2k | RVNGStringVectorImpl() : m_strings() {} |
31 | 32.2k | ~RVNGStringVectorImpl() {} |
32 | | std::vector<RVNGString> m_strings; |
33 | | }; |
34 | | |
35 | | RVNGStringVector::RVNGStringVector() |
36 | 32.2k | : m_pImpl(new RVNGStringVectorImpl()) |
37 | 32.2k | { |
38 | 32.2k | } |
39 | | |
40 | | RVNGStringVector::RVNGStringVector(const RVNGStringVector &vec) |
41 | 0 | : m_pImpl(new RVNGStringVectorImpl(*(vec.m_pImpl))) |
42 | 0 | { |
43 | 0 | } |
44 | | |
45 | | RVNGStringVector::~RVNGStringVector() |
46 | 32.2k | { |
47 | 32.2k | delete m_pImpl; |
48 | 32.2k | } |
49 | | |
50 | | RVNGStringVector &RVNGStringVector::operator=(const RVNGStringVector &vec) |
51 | 0 | { |
52 | | // Check for self-assignment |
53 | 0 | if (this == &vec) |
54 | 0 | return *this; |
55 | 0 | if (m_pImpl) |
56 | 0 | delete m_pImpl; |
57 | 0 | m_pImpl = new RVNGStringVectorImpl(*(vec.m_pImpl)); |
58 | 0 | return *this; |
59 | 0 | } |
60 | | |
61 | | unsigned RVNGStringVector::size() const |
62 | 0 | { |
63 | 0 | return (unsigned)(m_pImpl->m_strings.size()); |
64 | 0 | } |
65 | | |
66 | | bool RVNGStringVector::empty() const |
67 | 13.3k | { |
68 | 13.3k | return m_pImpl->m_strings.empty(); |
69 | 13.3k | } |
70 | | |
71 | | const RVNGString &RVNGStringVector::operator[](unsigned idx) const |
72 | 39.9k | { |
73 | 39.9k | return m_pImpl->m_strings[idx]; |
74 | 39.9k | } |
75 | | |
76 | | void RVNGStringVector::append(const RVNGString &str) |
77 | 13.3k | { |
78 | 13.3k | m_pImpl->m_strings.push_back(str); |
79 | 13.3k | } |
80 | | |
81 | | void RVNGStringVector::clear() |
82 | 0 | { |
83 | 0 | m_pImpl->m_strings.clear(); |
84 | 0 | } |
85 | | |
86 | | } |
87 | | |
88 | | /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ |