mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 18:42:41 +01:00
double-conversion floating-point conversions
- using double-conversion library for floating-point numeric/string conversions - added string replace[InPlace], remove[InPlace] - reverted overwritten FileChannel purge age and count features - file size value checks in SMTPClient
This commit is contained in:
@@ -327,12 +327,23 @@ void FileChannel::setCompress(const std::string& compress)
|
||||
|
||||
void FileChannel::setPurgeAge(const std::string& age)
|
||||
{
|
||||
delete _pPurgeStrategy;
|
||||
_pPurgeStrategy = 0;
|
||||
_purgeAge = "none";
|
||||
|
||||
if (age.empty() || 0 == icompare(age, "none"))
|
||||
return;
|
||||
|
||||
std::string::const_iterator it = age.begin();
|
||||
std::string::const_iterator end = age.end();
|
||||
int n = 0;
|
||||
while (it != end && Ascii::isSpace(*it)) ++it;
|
||||
while (it != end && Ascii::isDigit(*it)) { n *= 10; n += *it++ - '0'; }
|
||||
if (0 == n)
|
||||
throw InvalidArgumentException("Zero is not valid purge age.");
|
||||
|
||||
while (it != end && Ascii::isSpace(*it)) ++it;
|
||||
|
||||
std::string unit;
|
||||
while (it != end && Ascii::isAlpha(*it)) unit += *it++;
|
||||
|
||||
@@ -349,8 +360,7 @@ void FileChannel::setPurgeAge(const std::string& age)
|
||||
factor = 30*Timespan::DAYS;
|
||||
else if (unit != "seconds")
|
||||
throw InvalidArgumentException("purgeAge", age);
|
||||
|
||||
delete _pPurgeStrategy;
|
||||
|
||||
_pPurgeStrategy = new PurgeByAgeStrategy(Timespan(factor*n));
|
||||
_purgeAge = age;
|
||||
}
|
||||
@@ -358,11 +368,20 @@ void FileChannel::setPurgeAge(const std::string& age)
|
||||
|
||||
void FileChannel::setPurgeCount(const std::string& count)
|
||||
{
|
||||
delete _pPurgeStrategy;
|
||||
_pPurgeStrategy = 0;
|
||||
_purgeAge = "none";
|
||||
|
||||
if (count.empty() || 0 == icompare(count, "none"))
|
||||
return;
|
||||
|
||||
std::string::const_iterator it = count.begin();
|
||||
std::string::const_iterator end = count.end();
|
||||
int n = 0;
|
||||
while (it != end && Ascii::isSpace(*it)) ++it;
|
||||
while (it != end && Ascii::isDigit(*it)) { n *= 10; n += *it++ - '0'; }
|
||||
if (0 == n)
|
||||
throw InvalidArgumentException("Zero is not valid purge count.");
|
||||
while (it != end && Ascii::isSpace(*it)) ++it;
|
||||
|
||||
delete _pPurgeStrategy;
|
||||
|
||||
Reference in New Issue
Block a user