From: <re...@us...> - 2005-05-13 19:48:19
|
Update of /cvsroot/crystal/CS/include/iutil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22054/include/iutil Modified Files: cmdline.h string.h Log Message: res removed std::string from the AWS headers; while use of the STL is accepted inside plugins, it is not a good idea to use it in interfaces, as there's no guarantee on binary compatibility (e.g. implementations of stl::string from different e.g. compiler versions might be incompatible). Also, it necessitates the inclusion of <string>, which means that through the crystalspace.h header external projects are suddenly "contaminated" with STL includes. Lastly we prefer the use of our own containers in public headers. The offending method has been replaced with one that replaces the contents of a user-supplied iString*. res removed iAwsPrefManager::GetString() that changes a user-provided reference to an iString*. This is not safe as it does not ensure proper refcounting; also, it differs semantically from the other Get*() methods as a reference to the original value is returned and not a copy. (That allows to change the value without going through the proper accessor methods.) res removed usage of csString from some interfaces. Index: cmdline.h =================================================================== RCS file: /cvsroot/crystal/CS/include/iutil/cmdline.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- cmdline.h 2 Jul 2004 14:34:05 -0000 1.12 +++ cmdline.h 13 May 2005 19:47:39 -0000 1.13 @@ -26,7 +26,7 @@ #include "csutil/scf.h" #include "csutil/csstring.h" -SCF_VERSION (iCommandLineParser, 0, 0, 2); +SCF_VERSION (iCommandLineParser, 0, 0, 3); /** * A utility class that makes it easier to parse the command line. @@ -86,18 +86,18 @@ * GetAppDir(); however, on MacOS/X, it is the "Resources" directory within * the Cocoa application wrapper. */ - virtual const csString& GetResourceDir () = 0; + virtual const char* GetResourceDir () = 0; /** * Returns the directory in which the application executable resides; or the * directory in which the Cocoa application wrapper resides on MacOS/X. */ - virtual const csString& GetAppDir () = 0; + virtual const char* GetAppDir () = 0; /** * Returns the full path to the application executable. */ - virtual const csString& GetAppPath () = 0; + virtual const char* GetAppPath () = 0; }; /** @} */ Index: string.h =================================================================== RCS file: /cvsroot/crystal/CS/include/iutil/string.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- string.h 12 May 2005 15:28:23 -0000 1.17 +++ string.h 13 May 2005 19:47:39 -0000 1.18 @@ -274,6 +274,14 @@ virtual void Replace (const iString* str, size_t count = (size_t)-1) = 0; /** + * Replace contents of this string with the contents of another. + * \param str String from which new content of this string will be copied. + * \param count Number of characters to copy. If (size_t)-1 is specified, + * then all characters will be copied. + */ + virtual void Replace (const char* str, size_t count = (size_t)-1) = 0; + + /** * Check if another string is equal to this one. * \param Str Other string. * \return True if they are equal; false if not. |