[Scummvm-devel] SaveFileManager::listSavefiles()

Max Horn max at quendi.de
Thu Sep 20 10:45:13 CEST 2007


Am 19.09.2007 um 21:53 schrieb Marcus Comstedt:

>
> Hi.
>
> I notice someone has changed the API for
> SaveFileManager::listSavefiles().  However, the documentation is
> weirdly ambigous:
>
> 	/**
> 	 * Request a list of available savegames with a given regex.
> 	 * @param regex Regular expression to match. Wildcards like * or ?  
> are available.
> 	 * returns a list of strings for all present file names.
> 	 */
> 	virtual Common::StringList listSavefiles(const char *regex) = 0;
>
>
> Uh, ok, so which is it?  Should the parameter be a regexp, or should
> it be a glob ("wildcards like * or ?")?  IMNSHO a regexp would be
> rather overkill of the year...

Short answer: "It's a glob", if you like that term "glob".

Long answer: It expect a "regular expression", which, in the language  
of a computer scientists, usually consists of only * and ?, and hence  
corresponds what you call a "glob". It is *not*, however, what I  
would call an "extended regular expression", such as tools as "grep"  
expect. Of course, in day-to-day "hacker language", the term "regex"  
is often used not to refer to "regular expressions" in the original  
sense, but rather to all sorts of extension, even some which are not  
"regular expressions" anymore (i.e. anything which allows  
backreferences or some other kind of "memory").

But I agree, the doc is a bit confusing.

> And does the "like" suggest that the list is incomplete?  Which
> metacharacters should be supported and what should they mean?  If this
> isn't properly specified, the function is useless.

Relax, no need to overreact, there is quite a difference between  
"needs some enhancements" and "useless", isn't there? ;-)

Anyway, quick answer: only * and ? need to be supported. We'll fix  
the doc string. David, please do that, and also move the "matchString 
()" function from common/fs.cpp to common/util.cpp, and make it  
public, so that porters can make easy use of it (ensuring consistent  
behavior across all platforms). While you are at it, please extend  
the doxygen comment on matchString() to explain / reference the exact  
format it expects.


Cheers,
Max




More information about the Scummvm-devel mailing list