string.cpp revision d020036eb167a2f97f5010276fda5daa3f4773b3
/* $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 (l1 == 0)
return false;
return false;
if (cs == CaseSensitive)
else
}
{
return false;
return false;
if (cs == CaseSensitive)
else
}
{
if (cs == CaseSensitive)
else
}
{
if (!isEmpty())
::RTStrToLower(m_psz);
return *this;
}
{
if (!isEmpty())
::RTStrToUpper(m_psz);
return *this;
}
void Utf8Str::stripTrailingSlash()
{
jolt();
}
void Utf8Str::stripFilename()
{
jolt();
}
{
jolt();
}
{
if (!m_psz)
return VERR_NO_DIGITS;
}
{
if (!m_psz)
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 */