From: stephan b. <sg...@us...> - 2004-12-25 18:08:17
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10782/include/pclasses/System Modified Files: Mime.h Log Message: Moved the comparison ops into namespace-scope funcs, non-friends. i'm not sure why, but C++ gurus making them free funcs if possible, as opposed to members. Index: Mime.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/Mime.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Mime.h 25 Dec 2004 00:06:01 -0000 1.7 +++ Mime.h 25 Dec 2004 18:08:03 -0000 1.8 @@ -57,20 +57,6 @@ ~MimeType(); - /** - For compatibility with containers. - - Returns the equivalent of mimeType()<rhs.mimeType(). - */ - bool operator<( const MimeType & rhs ) const; - - /** - For compatibility with containers. - Returns true if this object's media- and sub-types are the - same as rhs'. - */ - bool operator==( const MimeType & rhs ) const; - //! Return the full MIME type inline const std::string mimeType() const { return m_mediaType + "/" + m_subType; } @@ -88,6 +74,24 @@ std::string m_subType; }; +/** + For compatibility with sorted containers. + + Returns the equivalent of (lhs.mimeType() < rhs.mimeType()). + +*/ +bool operator<( const MimeType & lhs, const MimeType & rhs ) ; + +/** + Returns the equivalent of (lhs.mimeType() == rhs.mimeType()). +*/ +bool operator==( const MimeType & lhs, const MimeType & rhs ); + +/** + Returns the equivalent of (lhs.mimeType() == rhs). +*/ +bool operator==( const MimeType & lhs, const std::string & rhs ); + //! MIME type database /*! @@ -124,7 +128,7 @@ @fixme: should not re-insert existing file extension mappings into mimeToFilesMap(). - @fixme: allow file_ext to e ba space-separated list of extensions. + @fixme: allow file_ext to be a space-separated list of extensions. */ void mapExtension(const MimeType& type, const std::string & file_ext ); @@ -263,9 +267,15 @@ Parses in a mime.types-format file from the given stream. Returns the number of mime type entries parsed from the stream. + + Does not clear existing entries - they are appended + to the current db. */ size_t readDatabase( std::istream & ); + /** + Cleares all mime type mappings in this database. + */ void clear(); private: @@ -289,14 +299,13 @@ } } // P::System -#include "pclasses/Factory.h" -#include "pclasses/SharingContext.h" +#include "pclasses/Plugin/Plugin.h" namespace P { namespace System { template <typename InterfaceT> - class MimeHandlerFactory : public ::P::Factory< InterfaceT, MimeType, ::P::Sharing::FactoryContext > + class MimeHandlerFactory : public ::P::Plugin::PluginManager< InterfaceT > { }; |