Matching.cpp revision a97f26ece82a85f69a131fb74b057774c85db9c8
/** @file
*
* Definition of template classes that provide simple API to
* do matching between values and value filters constructed from strings.
*/
/*
* 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.
*/
#include "Matching.h"
#include "Logging.h"
#include <stdlib.h>
#include <errno.h>
namespace matching
{
// static
{
// initially null and valid
that->mErrorPosition = 0;
return;
do
{
if (delim == '-')
{
{
break;
}
else
}
// skip spaces around numbers
while (e > s && aFilter[e] == ' ') --e;
++e;
return;
}
if (err >= 4)
{
}
}
// static
{
int vrc = 0;
if (aIsSigned)
else
AssertReturn(endptr, 0);
// return parsed if not able to parse to the end
return parsed;
// return aStart if out if range
if (vrc == VWRN_NUMBER_TOO_BIG ||
(aIsSigned &&
(!aIsSigned &&
return aStart;
return parsed;
}
{
mNull = false;
mValid = true;
mErrorPosition = 0;
{
mValueAny = true;
mValue = false;
}
else
{
mValueAny = false;
mValue = true;
else
mValue = false;
else
mValid = false;
}
}
{
/// @todo (dmik) parse "rx:<regexp>" string
// begins with "rx:". These limits are for exact matching only!
// empty or null string means any match (see #isMatch() below),
{
{
return;
}
{
return;
}
}
mNull = false;
mValid = true;
mErrorPosition = 0;
}
{
/// @todo (dmik) do regexp matching
// empty or null mSimple matches any match
return
}
} /* namespace matching */
/* vi: set tabstop=4 shiftwidth=4 expandtab: */