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 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); 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 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, int NamedList::getIntValue(const String& name, int defvalue, int minvalue, int maxvalue,
bool clump) const bool clamp) const
{ {
const NamedString *s = getParam(name); 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 int NamedList::getIntValue(const String& name, const TokenDict* tokens, int defvalue) const

View File

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

View File

@ -1576,12 +1576,12 @@ public:
* @param base Numeration base, 0 to autodetect * @param base Numeration base, 0 to autodetect
* @param minvalue Minimum value allowed * @param minvalue Minimum value allowed
* @param maxvalue Maximum 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 * bound, false to return the default value
* @return The integer interpretation or defvalue. * @return The integer interpretation or defvalue.
*/ */
int toInteger(int defvalue = 0, int base = 0, int minvalue = INT_MIN, 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. * 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 defvalue Default value to return if not found
* @param minvalue Minimum value allowed for the parameter * @param minvalue Minimum value allowed for the parameter
* @param maxvalue Maximum 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 * bound, false to return the default value
* @return The number contained in the named parameter or the default * @return The number contained in the named parameter or the default
*/ */
int getIntValue(const String& name, int defvalue = 0, int minvalue = INT_MIN, 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. * 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 defvalue Default value to return if not found
* @param minvalue Minimum value allowed for the parameter * @param minvalue Minimum value allowed for the parameter
* @param maxvalue Maximum 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 * bound, false to return the default value
* @return The number contained in the key or the default * @return The number contained in the key or the default
*/ */
int getIntValue(const String& sect, const String& key, int defvalue = 0, 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. * Retrieve the numeric value of a key in a section trying first a table lookup.