ryzom_game_share_move_xml_auto_ptr_implementation_to_header.patch

rti, 05/15/2010 03:47 pm

Download (1.6 kB)

b/code/ryzom/common/src/game_share/xml_auto_ptr.cpp Sat May 15 14:37:47 2010 +0200
15 15
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

17 17

18
/* 
19
 * completely implemented in xml_auto_ptr.h
20
 */
21
/* 
18 22

19 23
#include "stdpch.h"
20 24
#include "xml_auto_ptr.h"
......
45 49
	return *this;
46 50
}
47 51

52
*/
48 53

49 54

50 55

b/code/ryzom/common/src/game_share/xml_auto_ptr.h Sat May 15 14:37:47 2010 +0200
28 28
public:
29 29
	CXMLAutoPtr(const char *value = NULL) : _Value(value) {}
30 30
	CXMLAutoPtr(const unsigned char *value) : _Value((const char *) value) {}
31
	~CXMLAutoPtr();
31
	~CXMLAutoPtr() { destroy(); }
32 32
	operator const char *() const { return _Value; }
33 33
	operator bool() const { return _Value != NULL; }
34 34
	operator std::string() const { return std::string(_Value); }
......
36 36
	operator const unsigned char *() const { return (const unsigned char *)  _Value; }
37 37
	const char operator * ()  const { nlassert(_Value); return *_Value; }
38 38
	/// NB : This remove previous owned pointer with xmlFree
39
	CXMLAutoPtr &operator = (const char *other);
39
	CXMLAutoPtr &operator = (const char *other)
40
	{
41
		if (other == _Value) return *this;
42
		destroy();
43
		_Value = other;
44
		return *this;
45
	}
40 46
	CXMLAutoPtr &operator = (const unsigned char *other)
41 47
	{
42 48
		*this = (const char *) other;