Moved xml_auto_ptr from game_share to nel misc.

This commit is contained in:
dfighter 2012-02-08 01:58:15 +01:00
parent 976bbe7ad6
commit ef71add33f
68 changed files with 148 additions and 66 deletions

View file

@ -0,0 +1,81 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
#ifndef XML_AUTO_PTR_H
#define XML_AUTO_PTR_H
#include <string>
/** 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<char *>(_Value); }
//////////////////////////////////////////////////
private:
const char *_Value;
private:
void destroy()
{
if (_Value)
{
xmlFree(const_cast<char *>(_Value));
_Value = NULL;
}
}
// We'd rather avoid problems
CXMLAutoPtr(const CXMLAutoPtr &/* other */)
{
nlassert(0);
}
CXMLAutoPtr&operator = (const CXMLAutoPtr &/* other */)
{
nlassert(0);
return *this;
}
};
#endif

View file

@ -52,6 +52,7 @@
#include "nel/misc/stream.h"
#include "nel/misc/path.h"
#include "nel/misc/string_common.h"
//#include "nel/misc/xml_auto_ptr.h"
#ifdef NL_OS_WINDOWS
#define NOMINMAX

View file

@ -30,7 +30,7 @@
//////////////
#include "cdb_branch.h"
#include "cdb_leaf.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
//#include <iostream.h>
#include "interface_v3/interface_manager.h"

View file

@ -29,7 +29,7 @@
// Includes //
//////////////
#include "cdb_leaf.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
//#include <iostream.h>
#include "interface_v3/interface_manager.h"

View file

@ -23,7 +23,7 @@
#include <libxml/parser.h>
#include "nel/misc/types_nl.h"
#include "nel/misc/debug.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include <map>
extern bool game_exit;

View file

@ -19,7 +19,7 @@
#include "stdpch.h"
#include "ctrl_base.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "interface_manager.h"
using namespace NLMISC;

View file

@ -20,7 +20,7 @@
#include "ctrl_base_button.h"
#include "interface_manager.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "../time_client.h"
#include "lua_ihm.h"

View file

@ -21,7 +21,7 @@
#include "ctrl_button.h"
#include "interface_manager.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
// ----------------------------------------------------------------------------
using namespace std;

View file

@ -19,7 +19,7 @@
#include "stdpch.h"
#include "interface_manager.h"
#include "ctrl_col_pick.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
using namespace NLMISC;
using namespace std;

View file

@ -19,7 +19,7 @@
#include "stdpch.h"
#include "interface_manager.h"
#include "ctrl_scroll.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "group_menu.h"
#include "lua_ihm.h"

View file

@ -22,7 +22,7 @@
#include "ctrl_text_button.h"
#include "interface_manager.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "view_text.h"
#include "view_text_id.h"
#include "group_container.h"

View file

@ -21,7 +21,7 @@
#include "ctrl_tooltip.h"
#include "interface_manager.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
// ----------------------------------------------------------------------------
using namespace std;

View file

@ -43,7 +43,7 @@
#include "sbrick_manager.h"
#include "sphrase_manager.h"
#include "../client_sheets/sphrase_sheet.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "lua_ihm.h"
#include "../r2/editor.h"

View file

@ -19,7 +19,7 @@
#include "stdpch.h"
#include "dbgroup_combo_box.h"
#include "group_menu.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "interface_manager.h"
#include "ctrl_button.h"
#include "action_handler.h"

View file

@ -20,7 +20,7 @@
#include "dbgroup_list_sheet_text.h"
#include "group_container.h"
#include "interface_manager.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "../sheet_manager.h"
#include "ctrl_button.h"
#include "view_text.h"

View file

@ -17,7 +17,7 @@
#include "stdpch.h"
#include "dbgroup_list_sheet_text_brick_composition.h"
#include "../client_sheets/sbrick_sheet.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "../string_manager_client.h"
#include "sbrick_manager.h"

View file

@ -19,7 +19,7 @@
#include "stdpch.h"
#include "dbgroup_list_sheet_text_share.h"
#include "../client_sheets/sbrick_sheet.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "interface_manager.h"
#include "view_bitmap.h"
#include "ctrl_text_button.h"

View file

@ -20,7 +20,7 @@
#include "dbgroup_list_sheet_trade.h"
#include "interface_manager.h"
#include "inventory_manager.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "../sheet_manager.h"
#include "ctrl_button.h"
#include "view_text.h"

View file

@ -21,7 +21,7 @@
#include "dbview_bar.h"
#include "interface_manager.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
using namespace std;

View file

@ -21,7 +21,7 @@
#include "dbview_bar3.h"
#include "interface_manager.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
using namespace std;
using namespace NL3D;

View file

@ -20,7 +20,7 @@
#include "dbview_digit.h"
#include "interface_manager.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
using namespace std;
using namespace NL3D;

View file

@ -20,7 +20,7 @@
#include "dbview_number.h"
#include "interface_manager.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
using namespace std;
using namespace NL3D;

View file

@ -21,7 +21,7 @@
#include "dbview_quantity.h"
#include "interface_manager.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
using namespace std;
using namespace NL3D;

View file

@ -23,7 +23,7 @@
#include "interface_element.h"
//#include "game_share/jobs.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
using namespace std;

View file

@ -18,7 +18,7 @@
#include "stdpch.h"
//
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
//
#include "group_compas.h"
#include "interface_3d_scene.h"

View file

@ -22,7 +22,7 @@
#include "group_container.h"
#include "interface_manager.h"
#include "interface_options.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "action_handler.h"
#include "../time_client.h"
#include "group_editbox.h"

View file

@ -23,7 +23,7 @@
#include "input_handler_manager.h"
#include "nel/misc/command.h"
#include "view_text.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "interface_options.h"
#include "dbctrl_sheet.h"
#include "group_container.h"

View file

@ -21,7 +21,7 @@
#include "group_frame.h"
#include "interface_manager.h"
#include "interface_element.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
using namespace std;
using namespace NLMISC;

View file

@ -22,7 +22,7 @@
#include "stdpch.h"
#include "group_html_cs.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "../client_cfg.h"
// used for login cookie to be sent to the web server

View file

@ -22,7 +22,7 @@
#include "stdpch.h"
#include "group_html_forum.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "../client_cfg.h"
#include "../user_entity.h"
#include "guild_manager.h"

View file

@ -22,7 +22,7 @@
#include "stdpch.h"
#include "group_html_mail.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "../client_cfg.h"
#include "../user_entity.h"
#include "interface_manager.h"

View file

@ -22,7 +22,7 @@
#include "stdpch.h"
#include "group_html_qcm.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "../client_cfg.h"
#include "interface_manager.h"
#include "../user_entity.h"

View file

@ -17,7 +17,7 @@
#include "stdpch.h"
#include "group_html_webig.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "../client_cfg.h"
#include "../user_entity.h"
#include "interface_manager.h"

View file

@ -24,7 +24,7 @@
#include "group_in_scene.h"
#include "interface_manager.h"
#include "view_renderer.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
using namespace std;
using namespace NLMISC;

View file

@ -29,7 +29,7 @@
#include "lua_ihm.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
using namespace std;
using namespace NLMISC;

View file

@ -38,7 +38,7 @@
#include "../global.h"
#include "ctrl_quad.h"
//
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "game_share/mission_desc.h"
#include "game_share/inventories.h"
#include "game_share/animal_type.h"

View file

@ -21,7 +21,7 @@
#include "interface_manager.h"
#include "interface_expr.h"
#include "group_menu.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "view_bitmap.h"
#include "action_handler.h" // Just for getAllParams
#include "lua_ihm.h"

View file

@ -21,7 +21,7 @@
#include "group_modal.h"
#include "interface_manager.h"
#include "interface_element.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
using namespace std;

View file

@ -30,7 +30,7 @@
#include "nel/misc/i_xml.h"
#include "nel/misc/i18n.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
using namespace std;
using namespace NLMISC;

View file

@ -26,7 +26,7 @@
#include "game_share/skills.h"
#include "game_share/brick_families.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "skill_manager.h"
#include "sbrick_manager.h"

View file

@ -27,7 +27,7 @@
#include "../libwww.h"
#include "interface_manager.h"
#include "action_handler.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "../client_cfg.h"

View file

@ -29,7 +29,7 @@
#include "dbview_bar.h"
#include "game_share/skills.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "skill_manager.h"
#include "nel/misc/i_xml.h"

View file

@ -19,7 +19,7 @@
#include "stdpch.h"
#include "group_tab.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "../time_client.h"
#include "interface_manager.h"

View file

@ -29,7 +29,7 @@
#include "nel/misc/i_xml.h"
#include "nel/misc/i18n.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
using namespace std;
using namespace NLMISC;

View file

@ -30,7 +30,7 @@
#include "nel/misc/i_xml.h"
#include "nel/misc/i18n.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
using namespace std;
using namespace NLMISC;

View file

@ -22,7 +22,7 @@
#include "nel/misc/file.h"
#include "nel/misc/game_device_events.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "input_handler_manager.h"
#include "interface_manager.h"

View file

@ -29,7 +29,7 @@
#include "nel/3d/u_particle_system_instance.h"
#include "nel/3d/u_animation_set.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "action_handler.h"
#include "lua_ihm.h"

View file

@ -22,7 +22,7 @@
#include "interface_anim.h"
#include "interface_manager.h"
#include "interface_expr.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "action_handler.h"
#include "../time_client.h"

View file

@ -25,7 +25,7 @@
#include "group_modal.h"
#include "../client_cfg.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
//
using namespace std;

View file

@ -24,7 +24,7 @@
#include "group_container.h"
#include "../misc.h"
#include "interface_link.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "lua_ihm.h"
#include "nel/misc/mem_stream.h"
//

View file

@ -20,7 +20,7 @@
#include "interface_group.h"
#include "interface_manager.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "group_container.h"
#include "group_editbox.h"
#include "group_scrolltext.h"

View file

@ -21,7 +21,7 @@
#include "nel/misc/types_nl.h"
#include "interface_manager.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
/**

View file

@ -22,7 +22,7 @@
#include "interface_options.h"
#include "interface_manager.h"
#include "group_menu.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "../net_manager.h"
#include "../sheet_manager.h"
#include "../entity_animation_manager.h"

View file

@ -27,7 +27,7 @@
#include "nel/misc/factory.h"
#include "nel/misc/big_file.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "interface_parser.h"
#include "interface_observer.h"

View file

@ -20,7 +20,7 @@
#include "skill_manager.h"
#include "interface_manager.h"
#include "game_share/skills.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "game_share/character_title.h"
#include "game_share/fame.h"
#include "../sheet_manager.h"

View file

@ -22,7 +22,7 @@
#include "view_bitmap.h"
#include "interface_manager.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "group_container.h"
// ----------------------------------------------------------------------------

View file

@ -20,7 +20,7 @@
#include "view_bitmap_combo.h"
#include "interface_manager.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
using namespace NLMISC;

View file

@ -19,7 +19,7 @@
#include "view_bitmap_faber_mp.h"
#include "interface_manager.h"
#include "../sheet_manager.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
extern CSheetManager SheetMngr;

View file

@ -28,7 +28,7 @@
#include "group_html.h"
#include "group_map.h"
//
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
//
#include "group_container.h"
#include "interface_3d_scene.h"

View file

@ -22,7 +22,7 @@
#include "view_radar.h"
#include "interface_manager.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "group_container.h"
#include "../npc_icon.h"
#include "nel/misc/fast_floor.h"

View file

@ -26,7 +26,7 @@
#include "group_container.h" // CCtrlResizer
#include "ctrl_tooltip.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "lua_ihm.h"
#include "lua_ihm.h"

View file

@ -23,7 +23,7 @@
#include "../string_manager_client.h"
#include "action_handler_misc.h"
//
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
//
#include "nel/misc/i18n.h"

View file

@ -22,7 +22,7 @@
#include "interface_manager.h"
#include "../string_manager_client.h"
#include "view_text_id.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include "../client_cfg.h"
#include "nel/misc/algo.h"

View file

@ -22,7 +22,7 @@
#include "../string_manager_client.h"
#include "../user_entity.h"
#include "../entities.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
using namespace STRING_MANAGER;

View file

@ -20,7 +20,7 @@
#include "generic_xml_msg_mngr.h"
#include "nel/misc/file.h"
#include "xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
using namespace std;
using namespace NLMISC;

View file

@ -32,7 +32,7 @@
#include "nel/misc/o_xml.h"
#include "nel/misc/i_xml.h"
#include "nel/misc/algo.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"

View file

@ -30,7 +30,7 @@
//////////////
#include "player_manager/cdb_branch.h"
#include "player_manager/cdb_leaf.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include <libxml/parser.h>
////////////////

View file

@ -29,7 +29,7 @@
// Includes //
//////////////
#include "player_manager/cdb_leaf.h"
#include "game_share/xml_auto_ptr.h"
#include "nel/misc/xml_auto_ptr.h"
#include <libxml/parser.h>