OTest2
A C++ testing framework
testmarkin.h
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 #ifndef OTest2__INCLUDE_OTEST2_TESTMARKIN_H_
21 #define OTest2__INCLUDE_OTEST2_TESTMARKIN_H_
22 
23 #include <cstdint>
24 #include <string>
25 
26 #include <otest2/testmarkptr.h>
27 
28 namespace OTest2 {
29 
30 class TestMarkFactory;
31 
35 class TestMarkIn {
36  public:
40  TestMarkIn();
41 
45  virtual ~TestMarkIn();
46 
47  /* -- avoid copying */
48  TestMarkIn(
49  const TestMarkIn&) = delete;
51  const TestMarkIn&) = delete;
52 
59  virtual std::string readTypeMark() = 0;
60 
67  virtual std::int64_t readInt() = 0;
68 
75  virtual long double readFloat() = 0;
76 
77 
84  virtual std::string readString() = 0;
85 
94  static TestMarkPtr deserialize(
95  TestMarkFactory& factory_,
96  TestMarkIn& deserializer_);
97 };
98 
99 } /* -- namespace OTest2 */
100 
101 #endif /* -- OTest2__INCLUDE_OTEST2_TESTMARKIN_H_ */
testmarkptr.h
OTest2::TestMarkIn::deserialize
static TestMarkPtr deserialize(TestMarkFactory &factory_, TestMarkIn &deserializer_)
Deserialize a testmark.
Definition: testmarkin.cpp:37
OTest2::TestMarkIn
A generic interface of a testmark deserializer.
Definition: testmarkin.h:35
OTest2::TestMarkIn::~TestMarkIn
virtual ~TestMarkIn()
Dtor.
Definition: testmarkin.cpp:33
OTest2::TestMarkIn::readFloat
virtual long double readFloat()=0
Parse float following in the stream.
OTest2::TestMarkPtr
std::shared_ptr< TestMark > TestMarkPtr
Definition: testmarkptr.h:26
OTest2::TestMarkIn::readInt
virtual std::int64_t readInt()=0
Parse integer following in the stream.
OTest2
Definition: assertbean.h:25
OTest2::TestMarkIn::TestMarkIn
TestMarkIn()
Ctor.
Definition: testmarkin.cpp:29
OTest2::TestMarkIn::readString
virtual std::string readString()=0
Parse string following in the stream.
OTest2::TestMarkIn::readTypeMark
virtual std::string readTypeMark()=0
Parse type mark following in the stream.
OTest2::TestMarkIn::operator=
TestMarkIn & operator=(const TestMarkIn &)=delete
OTest2::TestMarkFactory
A factory of testmark objects used for deserialization.
Definition: testmarkfactory.h:45