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");
const string bytes = OEWriteMolToString(".oeb", mol);
OEGraphMol mol;
OESmilesToMol(mol, "c1ccccc1");
const bool gzip = false;
const string bytes = OEWriteMolToString(OEFormat::OEB, gzip, mol);
OEGraphMol mol;
OESmilesToMol(mol, "c1ccccc1");
const bool gzip = false;
const string bytes = OEWriteMolToString(OEFormat::OEB, OEGetDefaultOFlavor(OEFormat::OEB), gzip, mol);
OEGraphMol mol;
OESmilesToMol(mol, "c1ccccc1");
string bytes;
const bool gzip = false;
const bool success = OEWriteMolToString(bytes, OEFormat::OEB, OEGetDefaultOFlavor(OEFormat::OEB), gzip, mol);