OEWriteMolToStringΒΆ

std::string OEWriteMolToString(const std::string &format, const OEMolBase &mol)
std::string OEWriteMolToString(unsigned format, bool gzip, const OEMolBase &mol)
std::string OEWriteMolToString(unsigned format, unsigned flavor, bool gzip, const OEMolBase &mol)

std::string OEWriteMolToString(const std::string &format, const OEMCMolBase &mol)
std::string OEWriteMolToString(unsigned format, bool gzip, const OEMCMolBase &mol)
std::string OEWriteMolToString(unsigned format, unsigned flavor, bool gzip, const OEMCMolBase &mol)

bool OEWriteMolToString(std::string& molstring, unsigned format, bool gzip, const OEMolBase& mol)
bool OEWriteMolToString(std::string& molstring, unsigned format, unsigned flavor, bool gzip, const OEMolBase& mol)
bool OEWriteMolToString(std::string& molstring, unsigned format, bool gzip, const OEMCMolBase& mol)
bool OEWriteMolToString(std::string& molstring, unsigned format, unsigned flavor, bool gzip, const OEMCMolBase& mol)

Encodes a molecule in terms of ‘format’. ‘format’ must be a file extension that is writeable by OpenEye, for example: ”.oeb.gz”. The overloads which take a Boolean ‘gzip’ parameter or an unsigned ‘flavor’ and Boolean ‘gzip’ parameters expect the format or the format and flavor to be specified by one of the constants in OEFormat and OEOFlavor.

Overloads which take an extra string reference and return a boolean status write the result in the provided string and return true if encoding into the given string was successful.

Otherwise, a non-empty std::string is returned if the encoding was successful.

OEGraphMol mol;
OESmilesToMol(mol, "c1ccccc1");
std::string bytes = OEWriteMolToString(".oeb", mol);
OEGraphMol mol;
OESmilesToMol(mol, "c1ccccc1");
std::string bytes = OEWriteMolToString(OEFormat::OEB, false, mol);
OEGraphMol mol;
OESmilesToMol(mol, "c1ccccc1");
std::string bytes = OEWriteMolToString(OEFormat::OEB, OEGetDefaultOFlavor(OEFormat::OEB), false, mol);
OEGraphMol mol;
OESmilesToMol(mol, "c1ccccc1");
std::string bytes;
bool success = OEWriteMolToString(bytes, OEFormat::OEB, OEGetDefaultOFlavor(OEFormat::OEB), false, mol);