From: stephan b. <sg...@us...> - 2004-12-25 20:48:25
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1174/src/System Modified Files: PathFinder.cpp Log Message: Moved joinList() out of the class interface, into an internal helper func. Index: PathFinder.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/PathFinder.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- PathFinder.cpp 24 Dec 2004 01:39:30 -0000 1.2 +++ PathFinder.cpp 25 Dec 2004 20:48:13 -0000 1.3 @@ -51,13 +51,17 @@ this->pathseparator = sep; } - std::string PathFinder::joinList( const string_list & list, const std::string & separator ) const + /** + Internal helper function to collapse a list into a string. + */ + template <typename StringList> + std::string joinList( const StringList & list, const std::string & separator ) { std::string ret; unsigned long count = list.size(); unsigned long at = 0; - string_list::const_iterator it = list.begin(); - string_list::const_iterator et = list.end(); + typename StringList::const_iterator it = list.begin(); + typename StringList::const_iterator et = list.end(); for(; it != et; ++it ) { @@ -66,9 +70,10 @@ } return ret; } + string PathFinder::pathString() const { - return this->joinList( this->paths, this->pathseparator ); + return joinList( this->paths, this->pathseparator ); } const PathFinder::string_list & PathFinder::path() const @@ -78,7 +83,7 @@ string PathFinder::extensionsString() const { - return this->joinList( this->exts, this->pathseparator ); + return joinList( this->exts, this->pathseparator ); } const PathFinder::string_list & PathFinder::extensions() const |