summaryrefslogtreecommitdiffstats
path: root/common/StringVector.cpp
blob: a4bf781095312cc72d75ac44b4215668b726dfc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#include "StringVector.hpp"

StringVector::StringVector() = default;

StringVector::StringVector(const std::vector<std::string>& vector) { _vector = vector; }

std::string StringVector::operator[](size_t index) const
{
    if (index >= _vector.size())
    {
        return std::string();
    }

    return _vector[index];
}

size_t StringVector::size() const { return _vector.size(); }

bool StringVector::empty() const { return _vector.empty(); }

std::vector<std::string>::const_iterator StringVector::begin() const { return _vector.begin(); }

std::vector<std::string>::iterator StringVector::begin() { return _vector.begin(); }

std::vector<std::string>::const_iterator StringVector::end() const { return _vector.end(); }

std::vector<std::string>::iterator StringVector::end() { return _vector.end(); }

std::vector<std::string>::iterator StringVector::erase(std::vector<std::string>::const_iterator it)
{
    return _vector.erase(it);
}

void StringVector::push_back(const std::string& string) { _vector.push_back(string); }

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */