string.cpp revision 3221ae1f7bf53d9cccdd578099f55f782dba1447
/* $Id$ */
/** @file
*
* MS COM / XPCOM Abstraction Layer:
* Smart string classes definition
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* 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.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
namespace com
{
/* static */
/* static */
const
{
const char *pszThis, *p;
)
return p - pszThis;
return npos;
}
const
{
if (n)
{
const char *psz;
{
// walk the UTF-8 characters until where the caller wants to start
while (*psz && i--)
return ret; // return empty string on bad encoding
if (n == npos)
// all the rest:
else
{
i = n;
while (*psz && i--)
return ret; // return empty string on bad encoding
}
}
}
return ret;
}
{
if (!str)
return VERR_NO_DIGITS;
}
{
if (!str)
return VERR_NO_DIGITS;
}
struct FormatData
{
char *cache;
};
{
if (!format)
return;
// assume an extra byte for a terminating zero
("The number of bytes formatted doesn't match: %d and %d!",
NOREF (n);
// finalize formatting
}
// static
{
{
// append to cache (always assume an extra byte for a terminating zero)
{
}
}
return cbChars;
}
} /* namespace com */