The solution of the reference hypernetted-chain approximation for fluids of hard spheres with dipoles and quadrupoles