An object containing just text. More...
#include <openbabel/text.h>
Public Member Functions | |
OBText () | |
OBText (const std::string &text) | |
std::string | GetText () const |
std::string | GetText (std::string::size_type &pos, bool ToInsertOnly=false) const |
void | SetText (const std::string &text) |
virtual bool | Clear () |
virtual OBBase * | DoTransformations (const std::map< std::string, std::string > *, OBConversion *) |
template<class T > | |
T * | CastAndClear (bool clear=true) |
virtual const char * | GetTitle (bool replaceNewlines=true) const |
virtual void | SetTitle (const char *) |
Generic data handling methods (via OBGenericData) | |
bool | HasData (const std::string &) |
bool | HasData (const char *) |
bool | HasData (const unsigned int type) |
void | DeleteData (unsigned int type) |
void | DeleteData (OBGenericData *) |
void | DeleteData (std::vector< OBGenericData * > &) |
bool | DeleteData (const std::string &s) |
void | SetData (OBGenericData *d) |
void | CloneData (OBGenericData *d) |
size_t | DataSize () const |
OBGenericData * | GetData (const unsigned int type) |
OBGenericData * | GetData (const std::string &) |
OBGenericData * | GetData (const char *) |
std::vector< OBGenericData * > & | GetData () |
std::vector< OBGenericData * > | GetData (DataOrigin source) |
std::vector< OBGenericData * > | GetAllData (const unsigned int type) |
OBDataIterator | BeginData () |
OBDataIterator | EndData () |
Static Public Member Functions | |
static const char * | ClassDescription () |
Protected Attributes | |
std::vector< OBGenericData * > | _vdata |
An object containing just text.
OBText | ( | ) | [inline] |
OBText | ( | const std::string & | text ) | [inline] |
std::string GetText | ( | ) | const [inline] |
std::string GetText | ( | std::string::size_type & | pos, |
bool | ToInsertOnly = false |
||
) | const [inline] |
pos | up to, but not including, the line containing the next occurrence of "OPENBABEL_INSERT". |
pos | is updated to the start of the next line. If "OPENBABEL_INSERT" is not found, and |
ToInsertOnly | is false the text up to the end of the file is returned and |
pos | is set to 0. If "OPENBABEL_INSERT" is not found, and |
ToInsertOnly | is true an empty string is return and |
pos | is unchaged. |
Inserting OpenBabel output into boilerplate text. Suppose you wanted to insert XML output from OB into into a template XML document using the babel interface babel template.text inputfile.xxx outputfile.yyy The template file could contain a line:
and still be well-formed XML. The template file would be read by TextFormat and passed to the output as an OBText object. This could be processed in the output format's WriteChemObject() or WriteMolecule() in the following way (see cmlreactformat.cpp) OBText* ptext = dynamic_cast<OBText*>(pOb); if(ptext) { string::size_type pos = 0; pConv->GetOutStream() << ptext->GetText(pos); //Output text up to insertion point _text = ptext->GetText(pos); //Save text after insertion point to be output at the end }
void SetText | ( | const std::string & | text ) | [inline] |
bool Clear | ( | void | ) | [virtual, inherited] |
Clear any and all data associated with this object.
This method can be called by OBConversion::Read() before reading data. Derived classes should be sure to call OBBase::Clear() to remove inherited generic data.
Reimplemented in OBAtom, OBMol, OBReaction, and OBResidue.
Referenced by OBResidue::Clear().
virtual OBBase* DoTransformations | ( | const std::map< std::string, std::string > * | , |
OBConversion * | |||
) | [inline, virtual, inherited] |
Perform a set of transformations specified by the user
Typically these are program options to filter or modify an object For example, see OBMol::DoTransformations() and OBMol::ClassDescription() Base type does nothing
Reimplemented in OBMol.
static const char* ClassDescription | ( | ) | [inline, static, inherited] |
Reimplemented in OBMol, and OBReaction.
T* CastAndClear | ( | bool | clear = true ) |
[inline, inherited] |
By default clears the object. Called from ReadMolecule of most format classes.
virtual const char* GetTitle | ( | bool | replaceNewlines = true ) |
const [inline, virtual, inherited] |
Base type does nothing Made virtual around r3535 to simplify code which passes around OBBase*.
Reimplemented in OBMol.
Referenced by OBMoleculeFormat::DoOutputOptions().
virtual void SetTitle | ( | const char * | ) | [inline, virtual, inherited] |
Reimplemented in OBMol.
Referenced by OBMoleculeFormat::DoOutputOptions().
bool HasData | ( | const std::string & | s ) | [inherited] |
Referenced by OBDepict::DrawMolecule(), OBForceField::GetAtomTypes(), OBForceField::GetConformers(), OBForceField::GetCoordinates(), OBMol::GetEnergies(), OBMol::GetEnergy(), OBForceField::GetPartialCharges(), OBDescriptor::MatchPairData(), OBMol::operator=(), and OBMol::SetEnergies().
bool HasData | ( | const char * | s ) | [inherited] |
bool HasData | ( | const unsigned int | type ) | [inherited] |
void DeleteData | ( | unsigned int | type ) | [inherited] |
Delete any data matching the given OBGenericDataType.
Referenced by OpenBabel::CanonicalLabels(), OBDescriptor::DeleteProperties(), and OBMol::RenumberAtoms().
void DeleteData | ( | OBGenericData * | gd ) | [inherited] |
Delete the given generic data from this object.
void DeleteData | ( | std::vector< OBGenericData * > & | vg ) | [inherited] |
Delete all of the given generic data from this object.
bool DeleteData | ( | const std::string & | s ) | [inherited] |
Deletes the generic data with the specified attribute, returning false if not found.
void SetData | ( | OBGenericData * | d ) | [inline, inherited] |
Adds a data object; does nothing if d==NULL.
Referenced by OBGastChrg::AssignPartialCharges(), OpenBabel::CalcSignedVolume(), OBForceField::GetAtomTypes(), OBForceField::GetConformers(), OBForceField::GetCoordinates(), OBMol::GetEnergies(), OBMol::GetEnergy(), OBMol::GetNextFragment(), OBForceField::GetPartialCharges(), OBMoleculeFormat::MakeCombinedMolecule(), OBDescriptor::PredictAndSave(), and OBMol::SetEnergies().
void CloneData | ( | OBGenericData * | d ) | [inherited] |
Adds a copy of a data object; does nothing if d == NULL
size_t DataSize | ( | ) | const [inline, inherited] |
OBGenericData * GetData | ( | const unsigned int | type ) | [inherited] |
Referenced by OpenBabel::CalcSignedVolume(), OpenBabel::CorrectChirality(), OBDepict::DrawMolecule(), OBDescriptor::FilterCompare(), OpenBabel::GetAtomSymClass(), OBForceField::GetAtomTypes(), OBForceField::GetConformers(), OBForceField::GetCoordinates(), OBMol::GetNextFragment(), OBForceField::GetPartialCharges(), OBDescriptor::GetValues(), OBMoleculeFormat::MakeCombinedMolecule(), OBMolAngleIter::OBMolAngleIter(), OBMolRingIter::OBMolRingIter(), OBMolTorsionIter::OBMolTorsionIter(), OBMol::operator=(), and OBDescriptor::PredictAndSave().
OBGenericData * GetData | ( | const std::string & | s ) | [inherited] |
OBGenericData * GetData | ( | const char * | s ) | [inherited] |
std::vector<OBGenericData*>& GetData | ( | ) | [inline, inherited] |
Referenced by OBMol::GetEnergies(), OBMol::GetEnergy(), and OBMol::SetEnergies().
std::vector< OBGenericData * > GetData | ( | DataOrigin | source ) | [inherited] |
std::vector< OBGenericData * > GetAllData | ( | const unsigned int | type ) | [inherited] |
Referenced by OpenBabel::CanonicalLabels(), OBBuilder::CorrectStereoAtoms(), and OBBuilder::CorrectStereoBonds().
OBDataIterator BeginData | ( | ) | [inline, inherited] |
Referenced by OBAtom::Duplicate(), OBMoleculeFormat::MakeCombinedMolecule(), and OBMol::operator=().
OBDataIterator EndData | ( | ) | [inline, inherited] |
Referenced by OBAtom::Duplicate(), OBMoleculeFormat::MakeCombinedMolecule(), and OBMol::operator=().
std::vector<OBGenericData*> _vdata [protected, inherited] |
Custom data.
Referenced by OBMol::OBMol().