/*! \file pivaluetree_conversions.h
 * \ingroup Serialization
 * \brief
 * \~english PIValueTree conversions
 * \~russian Преобразования PIValueTree
*/
/*
	PIP - Platform Independent Primitives
	PIValueTree conversions
	Ivan Pelipenko peri4ko@yandex.ru

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU Lesser 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 Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef pivaluetree_conversions_H
#define pivaluetree_conversions_H

#include "pivaluetree.h"

class PIPropertyStorage;
class PIJSON;
class PIIODevice;

namespace PIValueTreeConversions {

	enum Option {
		WithAttributes = 0x1,
		WithComment    = 0x2,
		WithType       = 0x4,
		WithAll        = 0xFFFFFF,
		Default = WithAll
	};
	typedef PIFlags<Option> Options;

	PIP_EXPORT PIValueTree fromPropertyStorage(const PIPropertyStorage & ps);
	PIP_EXPORT PIValueTree fromVariantMap(const PIVariantMap & vm);
	PIP_EXPORT PIValueTree fromJSON(const PIJSON & json);
	PIP_EXPORT PIValueTree fromText(PIIODevice * device);
	PIP_EXPORT PIValueTree fromText(const PIString & str);
	PIP_EXPORT PIJSON toJSON(const PIValueTree & root, Options options = Default);
	PIP_EXPORT PIString toText(const PIValueTree & root, Options options = Default);

}

#endif
