/* $Id$ */
/** @file
* IPRT - Unique String Spaces.
*/
/*
* Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
/*******************************************************************************
* Defined Constants And Macros *
*******************************************************************************/
/*
* AVL configuration.
*/
/*
* AVL Compare macros
*/
/*
* Include the code.
*/
#include "../table/avl_Base.cpp.h"
#include "../table/avl_Get.cpp.h"
#include "../table/avl_DoWithAll.cpp.h"
#include "../table/avl_Destroy.cpp.h"
/**
* Inserts a string into a unique string space.
*
* @returns true on success.
* @returns false if the string collided with an existing string.
* @param pStrSpace The space to insert it into.
* @param pStr The string node.
*/
{
if (!pMatch)
/* Check for clashes. */
return false;
return true;
}
/**
* Removes a string from a unique string space.
*
* @returns Pointer to the removed string node.
* @returns NULL if the string was not found in the string space.
* @param pStrSpace The space to insert it into.
* @param pszString The string to remove.
*/
{
if (!pCur)
return NULL;
/* find the right one. */
break;
if (pCur)
{
if (pPrev)
/* simple, it's in the linked list. */
else
{
/* in the tree. remove and reinsert list head. */
if (pInsert)
{
}
}
}
return pCur;
}
/**
* Gets a string from a unique string space.
*
* @returns Pointer to the string node.
* @returns NULL if the string was not found in the string space.
* @param pStrSpace The space to insert it into.
* @param pszString The string to get.
*/
{
if (!pCur)
return NULL;
/* Linear search. */
return pCur;
return NULL;
}
/**
* Gets a string from a unique string space.
*
* @returns Pointer to the string node.
* @returns NULL if the string was not found in the string space.
* @param pStrSpace The space to insert it into.
* @param pszString The string to get.
* @param cchMax The max string length to evaluate. Passing
* RTSTR_MAX is ok and makes it behave just like
* RTStrSpaceGet.
*/
{
if (!pCur)
return NULL;
/* Linear search. */
return pCur;
return NULL;
}
/**
* Enumerates the string space.
* The caller supplies a callback which will be called for each of
* the string nodes.
*
* @returns 0 or what ever non-zero return value pfnCallback returned
* when aborting the destruction.
* @param pStrSpace The space to insert it into.
* @param pfnCallback The callback.
* @param pvUser The user argument.
*/
RTDECL(int) RTStrSpaceEnumerate(PRTSTRSPACE pStrSpace, PFNRTSTRSPACECALLBACK pfnCallback, void *pvUser)
{
}
/**
* Destroys the string space.
* The caller supplies a callback which will be called for each of
* the string nodes in for freeing their memory and other resources.
*
* @returns 0 or what ever non-zero return value pfnCallback returned
* when aborting the destruction.
* @param pStrSpace The space to insert it into.
* @param pfnCallback The callback.
* @param pvUser The user argument.
*/
RTDECL(int) RTStrSpaceDestroy(PRTSTRSPACE pStrSpace, PFNRTSTRSPACECALLBACK pfnCallback, void *pvUser)
{
}