--- trunk/OOPSE-3.0/src/utils/Trim.hpp 2005/01/12 22:41:40 1930 +++ trunk/OOPSE-3.0/src/utils/Trim.hpp 2005/04/15 22:04:00 2204 @@ -1,4 +1,4 @@ - /* +/* * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. * * The University of Notre Dame grants you ("Licensee") a @@ -51,133 +51,133 @@ namespace oopse { */ namespace oopse { - /** - * Remove all leading spaces in-place. The supplied predicate is used to determine which - * characters are considered spaces - * @param str An input sequence - * @param IsSpace An unary predicate identifying spaces - */ - template - void trimLeftIf(std::string& str, Predict isSpace) { - std::string::iterator i = str.begin(); + /** + * Remove all leading spaces in-place. The supplied predicate is used to determine which + * characters are considered spaces + * @param str An input sequence + * @param IsSpace An unary predicate identifying spaces + */ + template + void trimLeftIf(std::string& str, Predict isSpace) { + std::string::iterator i = str.begin(); - for (; i != str.end(); ++i) { - if (!isSpace(*i)) { - break; - } - } - - str.erase(str.begin(), i); + for (; i != str.end(); ++i) { + if (!isSpace(*i)) { + break; + } } + + str.erase(str.begin(), i); + } - /** - * Remove all trailing spaces in-place. The supplied predicate is used to determine which - * characters are considered spaces - * @param str An input sequence - */ - template - void trimRightIf(std::string& str, Predict isSpace) { - std::string::iterator i = str.end(); + /** + * Remove all trailing spaces in-place. The supplied predicate is used to determine which + * characters are considered spaces + * @param str An input sequence + */ + template + void trimRightIf(std::string& str, Predict isSpace) { + std::string::iterator i = str.end(); - for (; i != str.begin();) { - if (!isSpace(*(--i))) { - ++i; - break; - } - } - - str.erase(i, str.end()); + for (; i != str.begin();) { + if (!isSpace(*(--i))) { + ++i; + break; + } } + + str.erase(i, str.end()); + } - /** - *Remove all leading and trailing spaces in-place. The supplied predicate is used to determine - * which characters are considered spaces - * @param str An input sequence - */ - template - void trimIf(std::string& str, Predict isSpace) { - trimLeftIf(str, isSpace); - trimRightIf(str, isSpace); - } + /** + *Remove all leading and trailing spaces in-place. The supplied predicate is used to determine + * which characters are considered spaces + * @param str An input sequence + */ + template + void trimIf(std::string& str, Predict isSpace) { + trimLeftIf(str, isSpace); + trimRightIf(str, isSpace); + } - /** - * Remove all leading spaces from the input. The supplied predicate is used to determine - * which characters are considered spaces - * @return A trimmed copy of the input - * @param input An input sequence - */ - template - std::string trimLeftCopyIf(const std::string& input, Predict isSpace) { - std::string result(input); - trimLeftIf(result, isSpace); - return result; - } + /** + * Remove all leading spaces from the input. The supplied predicate is used to determine + * which characters are considered spaces + * @return A trimmed copy of the input + * @param input An input sequence + */ + template + std::string trimLeftCopyIf(const std::string& input, Predict isSpace) { + std::string result(input); + trimLeftIf(result, isSpace); + return result; + } - /** - * Remove all trailing spaces from the input. The supplied predicate is used to determine - * which characters are considered spaces - * @return A trimmed copy of the input - * @param input An input sequence - */ - template - std::string trimRightCopyIf(const std::string& input, Predict isSpace) { - std::string result(input); - trimRightIf(result, isSpace); - return result; - } + /** + * Remove all trailing spaces from the input. The supplied predicate is used to determine + * which characters are considered spaces + * @return A trimmed copy of the input + * @param input An input sequence + */ + template + std::string trimRightCopyIf(const std::string& input, Predict isSpace) { + std::string result(input); + trimRightIf(result, isSpace); + return result; + } - /** - * Remove all leading and trailing spaces from the input. The supplied predicate is used to - * determine which characters are considered spaces - * @return A trimmed copy of the input - * @param input An input sequence - */ - template - std::string trimCopyIf(const std::string& input, Predict isSpace) { - std::string result(input); - trimIf(result, isSpace); - return result; - } + /** + * Remove all leading and trailing spaces from the input. The supplied predicate is used to + * determine which characters are considered spaces + * @return A trimmed copy of the input + * @param input An input sequence + */ + template + std::string trimCopyIf(const std::string& input, Predict isSpace) { + std::string result(input); + trimIf(result, isSpace); + return result; + } - /** - * Remove all leading spaces in-place. - * @param str An input sequence - */ - void trimLeft(std::string& str); + /** + * Remove all leading spaces in-place. + * @param str An input sequence + */ + void trimLeft(std::string& str); - /** - * Remove all trailing spaces in-place. - * @param str An input sequence - */ - void trimRight(std::string& str); + /** + * Remove all trailing spaces in-place. + * @param str An input sequence + */ + void trimRight(std::string& str); - /** - *Remove all leading and trailing spaces in-place - * @param str An input sequence - */ - void trim(std::string& str); + /** + *Remove all leading and trailing spaces in-place + * @param str An input sequence + */ + void trim(std::string& str); - /** - * Remove all leading spaces from the input. - * @return A trimmed copy of the input - * @param input An input sequence - */ - std::string trimLeftCopy(const std::string& input); + /** + * Remove all leading spaces from the input. + * @return A trimmed copy of the input + * @param input An input sequence + */ + std::string trimLeftCopy(const std::string& input); - /** - * Remove all trailing spaces from the input. - * @return A trimmed copy of the input - * @param input An input sequence - */ - std::string trimRightCopy(const std::string& input); + /** + * Remove all trailing spaces from the input. + * @return A trimmed copy of the input + * @param input An input sequence + */ + std::string trimRightCopy(const std::string& input); - /** - *Remove all leading and trailing spaces from the input. - * @return A trimmed copy of the input - * @param input An input sequence - */ - std::string trimCopy(const std::string& input); + /** + *Remove all leading and trailing spaces from the input. + * @return A trimmed copy of the input + * @param input An input sequence + */ + std::string trimCopy(const std::string& input); }//end namespace oopse #endif //UTILS_TRIM_HPP