rjp/rjp++/src/array.cpp
2020-03-03 17:56:36 -08:00

43 lines
1.1 KiB
C++

/**
rjp++
Copyright (C) 2020 rexy712
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <rjp.hpp>
#include <utility> //move
namespace rjp{
array::array(void):
value(rjp_new_array()){}
array::array(const value& val):
value(val)
{
if(rjp_value_type(m_value) != rjp_json_array)
rjp_set_array(m_value);
}
array::array(value&& val):
value(std::move(val))
{
if(rjp_value_type(m_value) != rjp_json_array)
rjp_set_array(m_value);
}
void array::destroy(value&& val){
rjp_free_element(m_value, val.raw());
}
}