2012-05-29 13:31:11 +00:00
|
|
|
// 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/>.
|
|
|
|
|
2013-03-26 12:56:16 +00:00
|
|
|
#include "stdmisc.h"
|
2012-05-29 13:31:11 +00:00
|
|
|
|
|
|
|
//////////////
|
|
|
|
// Includes //
|
|
|
|
//////////////
|
2013-02-14 15:53:06 +00:00
|
|
|
#include "nel/misc/cdb.h"
|
|
|
|
#include "nel/misc/cdb_branch.h"
|
|
|
|
#include "nel/misc/bit_mem_stream.h"
|
2012-05-29 13:31:11 +00:00
|
|
|
|
|
|
|
////////////////
|
|
|
|
// Namespaces //
|
|
|
|
////////////////
|
|
|
|
using namespace std;
|
|
|
|
|
2013-02-14 15:53:06 +00:00
|
|
|
namespace NLMISC{
|
2012-05-29 13:31:11 +00:00
|
|
|
|
|
|
|
CStringMapper *ICDBNode::_DBSM = NULL;
|
2013-02-14 15:53:06 +00:00
|
|
|
bool ICDBNode::verboseDatabase = false;
|
2012-05-29 13:31:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
std::string ICDBNode::getFullName()
|
|
|
|
{
|
|
|
|
CSString sTmp;
|
|
|
|
sTmp.reserve(256);
|
|
|
|
_buildFullName(sTmp);
|
|
|
|
return sTmp;
|
|
|
|
// CCDBNodeBranch *pParent = getParent();
|
|
|
|
// if (pParent == NULL)
|
|
|
|
// return _DBSM->localUnmap(_Name);
|
|
|
|
// CSString sTmp;
|
|
|
|
// _buildFullName(sTmp);
|
|
|
|
// sTmp << ":" << sTmp;
|
|
|
|
// return sTmp;
|
|
|
|
|
|
|
|
// // climb the parent hierarchie
|
|
|
|
// while (pParent->getParent() != NULL)
|
|
|
|
// pParent = pParent->getParent();
|
|
|
|
//
|
|
|
|
// // now build the full name in desc order
|
|
|
|
// while (p)
|
|
|
|
//
|
|
|
|
// while (pParent->getParent() != NULL)
|
|
|
|
// {
|
|
|
|
// sTmp = *pParent->getName()) << ":" << sTmp;
|
|
|
|
// pParent = pParent->getParent();
|
|
|
|
// }
|
|
|
|
// return sTmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ICDBNode::_buildFullName(CSString &fullName)
|
|
|
|
{
|
|
|
|
// we do not want to recurse up to the ROOT node - we stop 1 level down from the root
|
|
|
|
if (getParent() != NULL && getParent()->getParent() != NULL)
|
|
|
|
{
|
|
|
|
getParent()->_buildFullName(fullName);
|
|
|
|
fullName << ":" << _DBSM->localUnmap(_Name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
fullName = _DBSM->localUnmap(_Name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ICDBNode::releaseStringMapper()
|
|
|
|
{
|
|
|
|
if( _DBSM )
|
|
|
|
delete _DBSM;
|
|
|
|
_DBSM = NULL;
|
|
|
|
}
|
2013-02-14 15:53:06 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|