rippled
test
jtx
basic_prop.h
1
//------------------------------------------------------------------------------
2
/*
3
This file is part of rippled: https://github.com/ripple/rippled
4
Copyright (c) 2012, 2013 Ripple Labs Inc.
5
6
Permission to use, copy, modify, and/or distribute this software for any
7
purpose with or without fee is hereby granted, provided that the above
8
copyright notice and this permission notice appear in all copies.
9
10
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
*/
18
//==============================================================================
19
20
#ifndef RIPPLE_TEST_JTX_BASIC_PROP_H_INCLUDED
21
#define RIPPLE_TEST_JTX_BASIC_PROP_H_INCLUDED
22
23
namespace
ripple
{
24
namespace
test {
25
namespace
jtx {
26
27
struct
basic_prop
28
{
29
virtual
~basic_prop
() =
default
;
30
virtual
std::unique_ptr<basic_prop>
31
clone
()
const
= 0;
32
virtual
bool
33
assignable
(
basic_prop
const
*)
const
= 0;
34
};
35
36
template
<
class
T>
37
struct
prop_type
:
basic_prop
38
{
39
T
t
;
40
41
template
<
class
... Args>
42
prop_type
(Args&&... args) :
t
(
std
::forward<Args>(args)...)
43
{
44
}
45
46
std::unique_ptr<basic_prop>
47
clone
()
const override
48
{
49
return
std::make_unique<prop_type<T>>(
t
);
50
}
51
52
bool
53
assignable
(
basic_prop
const
* src)
const override
54
{
55
return
dynamic_cast<
prop_type<T>
const*
>
(src);
56
}
57
};
58
59
}
// namespace jtx
60
}
// namespace test
61
}
// namespace ripple
62
63
#endif
ripple::test::jtx::prop_type::assignable
bool assignable(basic_prop const *src) const override
Definition:
basic_prop.h:53
ripple::test::jtx::basic_prop::clone
virtual std::unique_ptr< basic_prop > clone() const =0
ripple::test::jtx::prop_type::t
T t
Definition:
basic_prop.h:39
ripple::test::jtx::prop_type::prop_type
prop_type(Args &&... args)
Definition:
basic_prop.h:42
ripple::test::jtx::prop_type
Definition:
basic_prop.h:37
ripple::test::jtx::basic_prop
Definition:
basic_prop.h:27
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition:
RCLCensorshipDetector.h:29
ripple::test::jtx::basic_prop::~basic_prop
virtual ~basic_prop()=default
std
STL namespace.
ripple::test::jtx::basic_prop::assignable
virtual bool assignable(basic_prop const *) const =0
std::unique_ptr
STL class.
ripple::test::jtx::prop_type::clone
std::unique_ptr< basic_prop > clone() const override
Definition:
basic_prop.h:47
Generated by
1.8.17