Calculate HBA HBD Count: the algorithm behind

Dear,

What is the algorithm to calculate HBA_Count, HBD_Count. The help file has only the information:
* HBA Count : Returns the count of the number of hydrogen bond accepting groups in the molecule
* HBD Count : Returns the count of the number of hydrogen bond donating groups in the molecule

best regards, Paul Nelis