Fixed meaning of parameter: clump -> clamp.

git-svn-id: http://yate.null.ro/svn/yate/trunk@4563 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2011-08-23 15:47:01 +00:00
parent 57bff41ad4
commit f04d08edb8
5 changed files with 12 additions and 13 deletions

View File

@ -78,10 +78,10 @@ const char* Configuration::getValue(const String& sect, const String& key, const
}
int Configuration::getIntValue(const String& sect, const String& key, int defvalue,
int minvalue, int maxvalue, bool clump) const
int minvalue, int maxvalue, bool clamp) const
{
const NamedString *s = getKey(sect,key);
return s ? s->toInteger(defvalue,0,minvalue,maxvalue,clump) : defvalue;
return s ? s->toInteger(defvalue,0,minvalue,maxvalue,clamp) : defvalue;
}
int Configuration::getIntValue(const String& sect, const String& key, const TokenDict* tokens, int defvalue) const

View File

@ -282,10 +282,10 @@ const char* NamedList::getValue(const String& name, const char* defvalue) const
}
int NamedList::getIntValue(const String& name, int defvalue, int minvalue, int maxvalue,
bool clump) const
bool clamp) const
{
const NamedString *s = getParam(name);
return s ? s->toInteger(defvalue,0,minvalue,maxvalue,clump) : defvalue;
return s ? s->toInteger(defvalue,0,minvalue,maxvalue,clamp) : defvalue;
}
int NamedList::getIntValue(const String& name, const TokenDict* tokens, int defvalue) const

View File

@ -22,7 +22,6 @@
#include "yateclass.h"
#include <limits.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
@ -418,7 +417,7 @@ String String::substr(int offs, int len) const
}
int String::toInteger(int defvalue, int base, int minvalue, int maxvalue,
bool clump) const
bool clamp) const
{
if (!m_string)
return defvalue;
@ -428,7 +427,7 @@ int String::toInteger(int defvalue, int base, int minvalue, int maxvalue,
return defvalue;
if (val >= minvalue && val <= maxvalue)
return val;
if (clump)
if (clamp)
return (val < minvalue) ? minvalue : maxvalue;
return defvalue;
}

View File

@ -1576,12 +1576,12 @@ public:
* @param base Numeration base, 0 to autodetect
* @param minvalue Minimum value allowed
* @param maxvalue Maximum value allowed
* @param clump Control the out of bound values: true to adjust to the nearest
* @param clamp Control the out of bound values: true to adjust to the nearest
* bound, false to return the default value
* @return The integer interpretation or defvalue.
*/
int toInteger(int defvalue = 0, int base = 0, int minvalue = INT_MIN,
int maxvalue = INT_MAX, bool clump = true) const;
int maxvalue = INT_MAX, bool clamp = true) const;
/**
* Convert the string to an integer value looking up first a token table.
@ -3607,12 +3607,12 @@ public:
* @param defvalue Default value to return if not found
* @param minvalue Minimum value allowed for the parameter
* @param maxvalue Maximum value allowed for the parameter
* @param clump Control the out of bound values: true to adjust to the nearest
* @param clamp Control the out of bound values: true to adjust to the nearest
* bound, false to return the default value
* @return The number contained in the named parameter or the default
*/
int getIntValue(const String& name, int defvalue = 0, int minvalue = INT_MIN,
int maxvalue = INT_MAX, bool clump = true) const;
int maxvalue = INT_MAX, bool clamp = true) const;
/**
* Retrieve the numeric value of a parameter trying first a table lookup.

View File

@ -107,12 +107,12 @@ public:
* @param defvalue Default value to return if not found
* @param minvalue Minimum value allowed for the parameter
* @param maxvalue Maximum value allowed for the parameter
* @param clump Control the out of bound values: true to adjust to the nearest
* @param clamp Control the out of bound values: true to adjust to the nearest
* bound, false to return the default value
* @return The number contained in the key or the default
*/
int getIntValue(const String& sect, const String& key, int defvalue = 0,
int minvalue = INT_MIN, int maxvalue = INT_MAX, bool clump = true) const;
int minvalue = INT_MIN, int maxvalue = INT_MAX, bool clamp = true) const;
/**
* Retrieve the numeric value of a key in a section trying first a table lookup.