One important nuance for anybody reading this and drawing conclusions about their own cat: purring is not only a sign of contentment.
Cats also purr when stressed, injured, unwell, giving birth, and sometimes when dying. This surprises people badly, and it matters because a purring cat at a veterinary practice is not necessarily a comfortable one. We see it constantly.
The usual interpretation is that purring is a self-soothing behaviour as well as a social one — there is a well-known hypothesis that the frequencies involved may have some restorative effect, though that is a hypothesis rather than an established fact.
So read it in context. Purring while relaxed, kneading, half-asleep on your lap, is contentment. Purring while hiding, hunched, off food or reluctant to move is a reason to phone somebody.