KMime API review

Albert Astals Cid aacid at kde.org
Mon Sep 15 21:15:26 BST 2025


As requested during Akademy.


Function has boolean trap:
 * Content::clearContents
 * Content::encodedContent
 * All the functions with "bool create"
 * All the functions with "bool useCrLf"
 * All the functions with "bool isCRLF"
 * All the functions with "bool withHeaderType"


Function is undocumented
 * Content::replaceContent


Should the input parameter be a std::unique_ptr to clearly indicate the 
function is taking care of ownership?
 * Content::setHeader
 * Content::appendHeader
 * Content::prependContent
 * Content::appendContent
 * Content::replaceContent


Should the return value be a std::unique_ptr to clearly indicate the user 
needs to take care of deleting it?
 * Content::takeContent


AddrSpec has no documentation and the name could be longer/more descriptive?


Does the class/struct need a d-pointer?
 * AddrSpec 
 * Mailbox
 * Address


Base::type returining a const char * seems old fashioned?


content.h has two KDE5: BIC maybe moving to KF would be the chance to do it?


Make the input parameter const & instead of const * since we don't check if 
the pointer is null?
 * Ident::fromIdent


Split ContentType::setPartialParams into two functions? It takes two int, the 
order is not clear, and as far as i can see there's no really a benefit in 
just having 1 function


Seems like the parseXXX functions that return a bool and return the result as 
input parameter by reference nowadays would return a std::optional?


P.S: Also created two small MRs that seemed simple enough.

Cheers,
  Albert




More information about the kde-pim mailing list