/*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2004-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
template <class T>
bool
-__x_parse_range(const std::string &str, T &start, T &end)
+__x_parse_range(const std::string &str, T &first, T &last)
{
std::vector<std::string> values;
tokenize(values, str, ':');
- T thestart, theend;
+ T thefirst, thelast;
if (values.size() != 2)
return false;
std::string s = values[0];
std::string e = values[1];
- if (!to_number(s, thestart))
+ if (!to_number(s, thefirst))
return false;
bool increment = (e[0] == '+');
if (increment)
e = e.substr(1);
- if (!to_number(e, theend))
+ if (!to_number(e, thelast))
return false;
if (increment)
- theend += thestart;
+ thelast += thefirst - 1;
- start = thestart;
- end = theend;
+ first = thefirst;
+ last = thelast;
return true;
}
#define RANGE_PARSE(type) \
template<> bool \
-__parse_range(const std::string &s, type &start, type &end) \
-{ return __x_parse_range(s, start, end); }
+__parse_range(const std::string &s, type &first, type &last) \
+{ return __x_parse_range(s, first, last); }
RANGE_PARSE(unsigned long long);
RANGE_PARSE(signed long long);