OTest2
A C++ testing framework
lib
tags.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2020 Ondrej Starek
3
*
4
* This file is part of OTest2
5
*
6
* OTest2 is free software: you can redistribute it and/or modify it under
7
* the terms of the GNU Lesser General Public License as published by
8
* the Free Software Foundation, either version 3 of the License,
9
* or (at your option) any later version.
10
*
11
* OTest2 is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14
* License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with OTest2. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#include <
tags.h
>
21
22
#include <algorithm>
23
#include <utility>
24
25
namespace
OTest2
{
26
27
Tags::Tags
() :
28
tags() {
29
30
}
31
32
Tags::Tags
(
33
std::initializer_list<std::string> initializer_) :
34
tags(initializer_) {
35
36
}
37
38
Tags::Tags
(
39
const
Tags
& other_) :
40
tags(other_.tags) {
41
42
}
43
44
Tags::Tags
(
45
Tags
&& other_) noexcept :
46
tags(std::move(other_.tags)) {
47
48
}
49
50
Tags::~Tags
() {
51
52
}
53
54
void
Tags::swap
(
55
Tags
& other_) noexcept {
56
tags.swap(other_.tags);
57
}
58
59
Tags
&
Tags::operator =
(
60
const
Tags
& other_) {
61
Tags
tmp_(other_);
62
swap
(tmp_);
63
return
*
this
;
64
}
65
66
Tags
&
Tags::operator =
(
67
Tags
&& other_) noexcept {
68
swap(other_);
69
return
*
this
;
70
}
71
72
void
Tags::appendTag
(
73
const
std::string& tag_) {
74
tags.push_back(tag_);
75
}
76
77
bool
Tags::findTag
(
78
const
std::string& tag_)
const
noexcept {
79
/* -- there should be maximally ones of tags -> there is no need
80
* to implement better searching. */
81
auto
iter_(std::find(tags.begin(), tags.end(), tag_));
82
return
iter_ != tags.end();
83
}
84
85
bool
Tags::isEmpty
() const noexcept {
86
return
tags.empty();
87
}
88
89
}
/* -- namespace OTest2 */
OTest2::Tags::isEmpty
bool isEmpty() const noexcept
Check if the list is empty.
Definition:
tags.cpp:85
tags.h
OTest2::Tags::swap
void swap(Tags &other_) noexcept
Swap contents.
Definition:
tags.cpp:54
OTest2::Tags::findTag
bool findTag(const std::string &tag_) const noexcept
Find a tag in the list.
Definition:
tags.cpp:77
OTest2::Tags::Tags
Tags()
Ctor - empty list of tags.
Definition:
tags.cpp:27
OTest2
Definition:
assertbean.h:25
OTest2::Tags::operator=
Tags & operator=(const Tags &other_)
Assignment.
Definition:
tags.cpp:59
OTest2::Tags::appendTag
void appendTag(const std::string &tag_)
Append new tag.
Definition:
tags.cpp:72
OTest2::Tags::~Tags
~Tags()
Dtor.
Definition:
tags.cpp:50
OTest2::Tags
List of tags assigned to a testing object.
Definition:
tags.h:32
Generated by
1.8.17