From: Christian P. <cp...@se...> - 2004-12-24 14:16:10
|
Am Freitag 24 Dezember 2004 12:32 schrieb stephan beal: > On Friday 24 December 2004 03:52, stephan beal wrote: > > Just comitted: > > > > P::System::MimeType - slightly different interface (no file > > extensions). Container-friendly, via operator< and operator==. > > ... > > > It compiles and links, but is untested. > > As you probably saw via pclasses-cvs, this is now working. Some notable > changes from the p1 code are: > > - MimeType is now default constructable (will need for serialization). > > - MimeType is now container-friendly, and can be used as a key. > > - MimeTypeDb is no longer a singleton, but a shared instance is provided > via the conventional instance() interface. i changed this for a couple > reasons, but one of them is because there are some cool potential uses > for local Mime DBs in other parts of the code (later on) and in client > code. > > - MimeTypeDb no longer reads the system-wide mime db at ctor type. > Instead this is delegated to the instance() object - only that object > loads mime.types by default. > > - MimeTypeDb::instance() is now post-main() safe, and the db is > repopulated if instance() is called after the shared object has been > destroyed post-main(). > > > - Added MimeTypeDb::FileExtensionsMap typedef, plus related functions. > File extensions mappings are now done once per MimeType media-subtype > combination, instead of once per instance of MimeType. This change made > making MimeType container-friendly straightforward, and also eases > client-side use of MimeType (IMO). Great work! but... we should move MimeType and MimeTypeDb to a different module, since it is on a higher level than the System abstraction classes. How about IO/ or Util/ or even Net/ ? I would like to see a MimeMagic (detection of the Mimetype by reading the contents of the file) feature added to MimeType/MimeTypeDb. Greetings, Christian |