diff --git a/code/ryzom/common/src/game_share/xml_auto_ptr.cpp b/code/ryzom/common/src/game_share/xml_auto_ptr.cpp deleted file mode 100644 index 4fcdb9543..000000000 --- a/code/ryzom/common/src/game_share/xml_auto_ptr.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -/* - * Completely implemented in xml_auto_ptr.h - */ - -#include "stdpch.h" - -/* -#include "xml_auto_ptr.h" -#include - -//======================================= -void CXMLAutoPtr::destroy() -{ - if (_Value) - { - xmlFree(const_cast(_Value)); - _Value = NULL; - } -} - -//======================================= -CXMLAutoPtr::~CXMLAutoPtr() -{ - destroy(); -} - -//======================================= -CXMLAutoPtr &CXMLAutoPtr::operator = (const char *other) -{ - if (other == _Value) return *this; - destroy(); - _Value = other; - return *this; -} - -*/ diff --git a/code/ryzom/common/src/game_share/xml_auto_ptr.h b/code/ryzom/common/src/game_share/xml_auto_ptr.h deleted file mode 100644 index 36e67331b..000000000 --- a/code/ryzom/common/src/game_share/xml_auto_ptr.h +++ /dev/null @@ -1,81 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - - -#ifndef XML_AUTO_PTR_H -#define XML_AUTO_PTR_H - -#include - -/** Simple auto pointer for xml pointers - */ -class CXMLAutoPtr -{ -public: - CXMLAutoPtr(const char *value = NULL) : _Value(value) {} - CXMLAutoPtr(const unsigned char *value) : _Value((const char *) value) {} - ~CXMLAutoPtr() { destroy(); } - operator const char *() const { return _Value; } - operator bool() const { return _Value != NULL; } - operator std::string() const { return std::string(_Value); } - bool operator ! () const { return _Value == NULL; } - operator const unsigned char *() const { return (const unsigned char *) _Value; } - char operator * () const { nlassert(_Value); return *_Value; } - /// NB : This remove previous owned pointer with xmlFree - CXMLAutoPtr &operator = (const char *other) - { - if (other == _Value) return *this; - destroy(); - _Value = other; - return *this; - } - - CXMLAutoPtr &operator = (const unsigned char *other) - { - *this = (const char *) other; - return *this; - } - char *getDatas() const { return const_cast(_Value); } -////////////////////////////////////////////////// -private: - const char *_Value; -private: - void destroy() - { - if (_Value) - { - xmlFree(const_cast(_Value)); - _Value = NULL; - } - } - - // We'd rather avoid problems - CXMLAutoPtr(const CXMLAutoPtr &/* other */) - { - nlassert(0); - } - CXMLAutoPtr&operator = (const CXMLAutoPtr &/* other */) - { - nlassert(0); - return *this; - } -}; - - -#endif - -