4.1.4 Title

The ``Title'' property is a string used to represent the name of the molecule. The default value is an empty string. This field may be used to store registry number or other identifier, instead of a common name. The string is typically trimmed of white space by most file format readers.

The following code uses the OEMolBase::GetTitle method to list the names of the molecules in an MDL SD file. The input file is read from standard-in and the list of identifiers (molecule names) are written to standard-out.

#include "oechem.h"
#include <iostream>

using namespace OEChem;
using namespace OESystem;
using namespace std;

int main()
{
  OEIter<OEMolBase> mol;
  oemolistream ims;

  ims.SetFormat(OEFormat::SDF);
  for (mol=ims.GetMolBases(); mol; ++mol)
    cout << mol->GetTitle() << endl;
  return 0;
}