Refactored MimeParser to use the MimeEntity class type to decide how to construct it

This is the first step toward making it possible for developers to
write their own MimeEntity subclasses and have the parser use them.