network-experiment/bmrshared/lib/flexible_value.cpp

44 lines
1.0 KiB
C++

// GNU Lesser General Public License v3.0
// Copyright (c) 2023 Bart Beumer <bart@4beumer.nl>
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License v3.0 as published by
// the Free Software Foundation.
//
#include "bmrshared/flexible_value.hpp"
using bmrshared::flexible_value;
flexible_value::flexible_value() = default;
flexible_value::flexible_value(const variant_type& value)
: m_data(value)
{
}
flexible_value::~flexible_value() = default;
flexible_value& flexible_value::operator=(const flexible_value& other) = default;
flexible_value& flexible_value::operator=(const flexible_value::variant_type& other)
{
m_data = other;
return *this;
}
const flexible_value::keyvalue_type& flexible_value::as_keyvalue() const
{
return as<keyvalue_type>();
}
flexible_value::keyvalue_type& flexible_value::as_keyvalue()
{
return as<keyvalue_type>();
}
const flexible_value::variant_type& flexible_value::as_variant() const
{
return m_data;
}