From: <bo...@us...> - 2003-09-05 07:42:03
|
Update of /cvsroot/libfunutil/libfunutil/lib/funUtil In directory sc8-pr-cvs1:/tmp/cvs-serv7192 Modified Files: ClassLoader.cpp ClassLoader.h Log Message: restore return values of APIs which were changed to support simultaneous QString/std::string methods. Index: ClassLoader.cpp =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/lib/funUtil/ClassLoader.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- ClassLoader.cpp 28 Aug 2003 11:54:36 -0000 1.32 +++ ClassLoader.cpp 5 Sep 2003 07:41:58 -0000 1.33 @@ -367,23 +367,24 @@ } #if FUN_API_QSTRING -void +QStringList ClassLoader::getTranslations(QStringList &list) { - if (classTrans_q.isEmpty()) return; + if (classTrans_q.isEmpty()) return list; QAsciiDictIterator<void> it(classTrans_q); for ( ; it.current(); ++it) { list.append(it.currentKey()); } + return list; } #endif #if FUN_API_STD_STRING -void +string_list_type ClassLoader::getTranslations(string_list_type &list) { #if FUN_UTIL_WITH_QT - if (classTrans_q.isEmpty()) return; + if (classTrans_q.isEmpty()) return list; QAsciiDictIterator<void> it(classTrans_q); for ( ; it.current(); ++it) { @@ -397,6 +398,7 @@ list.push_back( (*it).first ); } #endif + return list; } #endif @@ -593,7 +595,7 @@ #if FUN_API_QSTRING // This is cosmetic, and has no effect on ClassLoader's operation. -void +QStringList ClassLoader::getClassNames(QStringList &list, bool openFiles) { if (openFiles) NOT_DONE("getClassNames(true) ignores openFiles!"); @@ -604,7 +606,7 @@ if (stat(path_q, &sb) == -1) { NOT_DONE("getClassNames() doesn't handle stat failure! (\"" << strerror(errno) << "\")"); - return; + return list; } // If we don't have a buffered list, or we do but the directory // has been modified since we buffered it, we need to re-scan the @@ -619,7 +621,7 @@ if (dp == NULL) { NOT_DONE("boo hoo hoo, need to handle opendir(\"" << path_q << "\") failure"); - return; + return list; } QRegExp re("\\.so$"); QString filename; @@ -678,17 +680,16 @@ // got our list, and can proceed to the cash register. if (getClassNamesBuf_q) list += *getClassNamesBuf_q; + return list; } #endif #if FUN_API_STD_STRING // This is cosmetic, and has no effect on ClassLoader's operation. -void +string_list_type ClassLoader::getClassNames(string_list_type &list, bool openFiles) { #if FUN_UTIL_WITH_QT - QStringList qlist; - getClassNames(qlist, openFiles); - listToList(qlist, list); + listToList(getClassNames(QStringList(), openFiles), list); #else if (openFiles) NOT_DONE("getClassNames(true) ignores openFiles!"); if (next != NULL) next->getClassNames(list, openFiles); @@ -698,7 +699,7 @@ if (stat(path_s.c_str(), &sb) == -1) { NOT_DONE("getClassNames() doesn't handle stat failure! (\"" << strerror(errno) << "\")"); - return; + return list; } // If we don't have a buffered list, or we do but the directory // has been modified since we buffered it, we need to re-scan the @@ -713,7 +714,7 @@ if (dp == NULL) { NOT_DONE("boo hoo hoo, need to handle opendir(\"" << path << "\") failure"); - return; + return list; } // QRegExp re("\\.so$"); std::string filename; @@ -781,6 +782,7 @@ if (getClassNamesBuf_q) list += *getClassNamesBuf_q; #endif + return list; } #endif @@ -922,13 +924,13 @@ #endif #if FUN_API_QSTRING -void +QString ClassLoader::decodeTypeIDName(const char *name, QString &rv) { // XXX I'm sure this is compiler-specific, and should be wrapped in // XXX an #ifdef determined by a configure test. rv = QString::null; - if (!name) return; + if (!name) return rv; QString buf(name); const char *np = name; int nlen; @@ -944,7 +946,7 @@ if (nlen < 1) { rv = name; - return; + return rv; } if (nlen < 10) ++np; else if (nlen < 100) np += 2; @@ -957,21 +959,20 @@ np += nlen; } } while (wantE); + return rv; } #endif #if FUN_API_STD_STRING -void +std::string ClassLoader::decodeTypeIDName(const char *name, std::string &rv) { #if FUN_UTIL_WITH_QT - QString qs; - decodeTypeIDName(name, qs); - rv = (const char *)qs; + rv = (const char *)decodeTypeIDName(name, QString()); #else // XXX I'm sure this is compiler-specific, and should be wrapped in // XXX an #ifdef determined by a configure test. rv.clear(); - if (!name) return; + if (!name) return rv; std::string buf(name); const char *np = name; int nlen; @@ -987,7 +988,7 @@ if (nlen < 1) { rv = name; - return; + return rv; } if (nlen < 10) ++np; else if (nlen < 100) np += 2; @@ -1001,6 +1002,7 @@ } } while (wantE); #endif + return rv; } #endif Index: ClassLoader.h =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/lib/funUtil/ClassLoader.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- ClassLoader.h 28 Aug 2003 12:01:00 -0000 1.24 +++ ClassLoader.h 5 Sep 2003 07:41:59 -0000 1.25 @@ -224,25 +224,25 @@ #if FUN_API_QSTRING /** - * Appends all of the translated class names to the given list. You'll - * have to call getTranslation() for each element in the list to find - * out what it's mapped to. + * Appends all of the translated class names to the given list, and + * returns it. You'll have to call getTranslation() for each element + * in the list to find out what it's mapped to. * - * This appends to the list instead of returning a new list for - * simultaneous support of QString and std::string APIs. + * (The only reason this takes the list as an argument is for + * simultaneous support of QString and std::string APIs.) */ - virtual void getTranslations(QStringList &list); + virtual QStringList getTranslations(QStringList &); #endif #if FUN_API_STD_STRING /** - * Appends all of the translated class names to the given list. You'll - * have to call getTranslation() for each element in the list to find - * out what it's mapped to. + * Appends all of the translated class names to the given list, and + * returns it. You'll have to call getTranslation() for each element + * in the list to find out what it's mapped to. * - * This appends to the list instead of returning a new list for - * simultaneous support of QString and std::string APIs. + * (The only reason this takes the list as an argument is for + * simultaneous support of QString and std::string APIs.) */ - virtual void getTranslations(string_list_type &list); + virtual string_list_type getTranslations(string_list_type &); #endif /** @@ -307,7 +307,7 @@ #if FUN_API_QSTRING /** * Gets the list of class names which this ClassLoader believes it - * can instantiate. + * can instantiate, appends them to the given list, and returns it. * * ClassLoaders for whom setDSODir() has been called look at the * list of files in their DSO directory. @@ -341,15 +341,15 @@ * QStringList/QValueList member for getting a sorted unique list, * so see ClassLoader::sortUniq(QStringList &).) * - * This appends to the list instead of returning a new list for - * simultaneous support of QString and std::string APIs. + * (The only reason this takes the list as an argument is for + * simultaneous support of QString and std::string APIs.) */ - void getClassNames(QStringList &list, bool openFiles = false); + QStringList getClassNames(QStringList &, bool openFiles = false); #endif #if FUN_API_STD_QSTRING /** * Gets the list of class names which this ClassLoader believes it - * can instantiate. + * can instantiate, appends them to the given list, and returns it. * * ClassLoaders for whom setDSODir() has been called look at the * list of files in their DSO directory. @@ -381,10 +381,10 @@ * will append its list to the list returned by the "next" ClassLoader, * and will not attempt to remove duplicates. * - * This appends to the list instead of returning a new list for - * simultaneous support of QString and std::string APIs. + * (The only reason this takes the list as an argument is for + * simultaneous support of QString and std::string APIs.) */ - void getClassNames(string_list_type &list, bool openFiles = false); + string_list_type getClassNames(string_list_type &, bool openFiles = false); #endif /** @@ -419,12 +419,12 @@ * doesn't know what to do with it.) * * If this isn't able to figure out how to decode the given name, it - * just sets @c decodedName to @c name. + * just returns @c name. * - * This takes a reference to a string instead of returning a string for - * simultaneous support of QString and std::string APIs. + * The only reason this takes a reference to a string (which is returned) + * is for simultaneous support of QString and std::string APIs. */ - static void decodeTypeIDName(const char *name, QString &decodedName); + static QString decodeTypeIDName(const char *name, QString &); #endif #if FUN_API_STD_QSTRING /** @@ -435,12 +435,12 @@ * doesn't know what to do with it.) * * If this isn't able to figure out how to decode the given name, it - * just sets @c decodedName to @c name. + * just returns @c name. * - * This takes a reference to a string instead of returning a string for - * simultaneous support of QString and std::string APIs. + * The only reason this takes a reference to a string (which is returned) + * is for simultaneous support of QString and std::string APIs. */ - static void decodeTypeIDName(const char *name, std::string &decodedName); + static std::string decodeTypeIDName(const char *name, std::string &); #endif private: |