COPASI API
4.40.278
|
#include <string>
#include <array>
#include <string.h>
#include <stdarg.h>
#include "copasi/copasi.h"
Macros | |
#define | INITIALTEXTSIZE 1024 |
Functions | |
bool | containsTag (const std::string &filename, const std::string &tagname, int numLines=10) |
void | FixSName (const std::string &original, std::string &fixed) |
bool | isNumber (const std::string &str) |
std::string | ISODateTime (tm *pTime) |
bool | isProbablySBML (const std::string &filename) |
std::string | LocalTimeStamp () |
std::string | nameToSbmlId (const std::string &name) |
std::string | pointerToString (const void *pVoid) |
std::string | quote (const std::string &name, const std::string &additionalEscapes="") |
std::string | StringPrint (const char *format,...) |
bool | stringReplace (std::string &str, const std::string &target, const std::string &replacement) |
void * | stringToPointer (const std::string str) |
double | strToDouble (const char *str, char const **pTail=NULL) |
bool | strToIndex (const std::string &str, size_t &index) |
C_INT32 | strToInt (const char *str, char const **pTail=NULL) |
unsigned C_INT32 | strToUnsignedInt (const char *str, char const **pTail=NULL) |
time_t | timeFromUTC (const std::string utc) |
template<class CType > | |
CType | toEnum (const char *attribute, const char **enumNames, const CType &enumDefault) |
template<class CType > | |
CType | toEnum (const std::string &attribute, const std::string *enumNames, const CType &enumDefault) |
std::string | unQuote (const std::string &name) |
std::string | UTCTimeStamp () |
size_t | utf8Length (const std::string &str) |
#define INITIALTEXTSIZE 1024 |
bool containsTag | ( | const std::string & | filename, |
const std::string & | tagname, | ||
int | numLines = 10 |
||
) |
Test whether a given XML tag is present in the first number of lines of a given file.
filename | the filename to be tested |
tagname | the tag name to be tested for |
numLines | the number of lines to be tested (default 10) |
Referenced by isProbablySBML().
void FixSName | ( | const std::string & | original, |
std::string & | fixed | ||
) |
bool isNumber | ( | const std::string & | str | ) |
Check whether the given string represents a number
const | std::string & str |
References strToDouble().
Referenced by COptItem::compileLowerBound(), COptItem::compileUpperBound(), ConverterASTNode::ConverterASTNode(), CMetabNameInterface::createUniqueDisplayName(), CMetabNameInterface::getDisplayName(), COptItem::setLowerBound(), CDataObject::setObjectName(), COptItem::setUpperBound(), and CChemEqInterface::writeElement().
std::string ISODateTime | ( | tm * | pTime | ) |
Returns the time pointed to by pTime in ISO format
Referenced by COptLogItem::fillString(), LocalTimeStamp(), and UTCTimeStamp().
bool isProbablySBML | ( | const std::string & | filename | ) |
Tests whether the file is SBML by reading the first 10 lines and looking for the presence of the sbml tag.
filename | the filename to be tested |
References containsTag().
Referenced by CDataModel::addModel().
std::string LocalTimeStamp | ( | ) |
Returns the current local time in ISO format
References ISODateTime().
Referenced by COptLogEntry::COptLogEntry(), and CCopasiMessage::handler().
std::string nameToSbmlId | ( | const std::string & | name | ) |
Convert a utf8 encoded name to a XmlId
const | std::string & name |
Referenced by CSBMLExporter::createFunctionDefinition(), and CSBMLExporter::createUniqueId().
std::string pointerToString | ( | const void * | pVoid | ) |
Convert a void pointer to a string
const | void * pVoid |
References fatalError.
Referenced by CEvaluationNodeObject::CEvaluationNodeObject(), CMathEvent::CAssignment::compile(), CMathObject::compileDependentMass(), CMathObject::compileFlux(), CMathObject::compileParticleFlux(), CMathObject::compilePropensity(), CMathObject::compileReactionNoise(), CMathObject::compileTotalMass(), CMathObject::compileTransitionTime(), CMathObject::createExtensiveNoiseExpression(), CMathObject::createExtensiveODERateExpression(), CMathObject::createExtensiveReactionNoiseExpression(), CMathObject::createExtensiveReactionRateExpression(), CMathObject::createExtensiveValueExpression(), CMathObject::createIntensiveRateExpression(), CMathObject::createIntensiveValueExpression(), CMathDelay::modifyMathObject(), and CEvaluationNodeObject::setObjectValuePtr().
std::string quote | ( | const std::string & | name, |
const std::string & | additionalEscapes = "" |
||
) |
Surround a name with quotes if the name contains a space or double quote else the name is returned unmodified. In the quoted name " and \ are escaped. The parameter additionalEscapes forces quotes around names containing any of the character in the parameter.
const | std::string & name |
const | std::string & additionalEscapes (default: "") |
References toBeEscaped.
Referenced by CChemEqInterface::addModifier(), CMetabNameInterface::createUniqueDisplayName(), CEvaluationNodeCall::getBerkeleyMadonnaString(), CEvaluationNodeCall::getCCodeString(), CEvaluationNodeCall::getData(), CMetabNameInterface::getDisplayName(), CEvaluationNodeCall::getDisplayString(), CEvaluationNodeCall::getInfix(), CEvaluationNodeCall::getMMLString(), CEvaluationNodeCall::getXPPString(), CUnitDefinitionDB::quoteSymbol(), CEvaluationNodeCall::setData(), and CMetabNameInterface::splitDisplayName().
std::string StringPrint | ( | const char * | format, |
... | |||
) |
sprintf like function for strings
const char * | format sprintf like format string |
... |
References C_INT32, and INITIALTEXTSIZE.
Referenced by CDataArray::addElementReference(), CExperimentSet::addExperiment(), CExperiment::elevateChildren(), CDataArray::getAnnotationsString(), CExperimentObjectMap::getDefaultScale(), CExperimentObjectMap::getName(), CExperimentObjectMap::getObjectCN(), CExperimentObjectMap::getRole(), CExperimentObjectMap::getScale(), CCopasiTimeVariable::LL2String(), CReaction::loadOld(), CReaction::loadOneRole(), ParameterDescriptionHandler::processStart(), CExperimentObjectMap::setNumCols(), CExperimentObjectMap::setObjectCN(), CExperimentObjectMap::setRole(), CExperimentObjectMap::setScale(), and CVersion::setString().
bool stringReplace | ( | std::string & | str, |
const std::string & | target, | ||
const std::string & | replacement | ||
) |
Replaces the all occurrences of target string in str with the replacement and returns true if the target string was replaced
std::string | & str |
const | std::string & target |
const | std::string & replacement |
Referenced by CUnit::buildExpression(), and CModel::replaceInExpressions().
void* stringToPointer | ( | const std::string | str | ) |
Convert a character sequence to a void pointer
const | std::string str |
Referenced by CEvaluationNodeObject::CEvaluationNodeObject(), CEvaluationNodeObject::compile(), and CMathExpression::relocate().
double strToDouble | ( | const char * | str, |
char const ** | pTail = NULL |
||
) |
Convert a character sequence to a double
const | char * str |
char | const ** pTail (default: NULL) |
Referenced by CEvaluationNodeNumber::CEvaluationNodeNumber(), COptItem::compileLowerBound(), COptItem::compileUpperBound(), CReadConfig::getVariable(), isNumber(), EllipseHandler::processStart(), GroupHandler::processStart(), PolygonHandler::processStart(), RectangleHandler::processStart(), RenderCurveHandler::processStart(), RenderTextHandler::processStart(), COptItem::setLowerBound(), COptItem::setUpperBound(), and CEvaluationNodeNumber::toAST().
bool strToIndex | ( | const std::string & | str, |
size_t & | index | ||
) |
Convert a string to a size_t index. Returns true if the conversion is successful, i.e., the whole string has been converted.
const | std::string & str |
size_t | & index |
References C_INVALID_INDEX.
Referenced by CDataArray::cnToIndex(), CDataArray::displayNamesToCN(), CCommonName::getElementIndex(), and CArrayElementReference::updateObjectName().
C_INT32 strToInt | ( | const char * | str, |
char const ** | pTail = NULL |
||
) |
Convert a character sequence to a double
const | char * str |
char | const ** pTail (default: NULL) |
References C_INT32.
Referenced by COPASIHandler::processStart(), ParameterHandler::processStart(), and CVersion::setVersion().
unsigned C_INT32 strToUnsignedInt | ( | const char * | str, |
char const ** | pTail = NULL |
||
) |
Convert a character sequence to a double
const | char * str |
char | const ** pTail (default: NULL) |
References C_INT32.
Referenced by CCopasiParameterGroup::getObject(), CompartmentHandler::processStart(), ParameterDescriptionHandler::processStart(), ParameterHandler::processStart(), ReportDefinitionHandler::processStart(), and SliderHandler::processStart().
time_t timeFromUTC | ( | const std::string | utc | ) |
Converts the UTC time to time_t
const | std::string utc |
Referenced by CCheckForUpdates::checkRequired().
CType toEnum | ( | const char * | attribute, |
const char ** | enumNames, | ||
const CType & | enumDefault | ||
) |
Convert an attribute to enum. If attribute is NULL or no matching name is found the parameter enumDefault is returned. Note: enumNames must be zero terminated.
const | char * attribute |
const | char ** enumNames |
const | CType & enumDefault |
Referenced by CCompartment::applyData(), CReaction::applyData(), CCopasiTask::applyData(), CCopasiTask::createUndoData(), CCopasiTask::fromData(), CPlotItem::getActivity(), CConfigurationFile::initializeParameter(), CModelParameterSet::insert(), FunctionHandler::processStart(), PlotItemHandler::processStart(), PlotSpecificationHandler::processStart(), SliderHandler::processStart(), and CPlotItem::setType().
CType toEnum | ( | const std::string & | attribute, |
const std::string * | enumNames, | ||
const CType & | enumDefault | ||
) |
Convert an attribute to enum. If attribute is "" or no matching name is found the parameter enumDefault is returned. Note: enumNames must be zero terminated.
const | std::string & attribute |
const | std::string * enumNames |
const | CType & enumDefault |
std::string unQuote | ( | const std::string & | name | ) |
Unesacape a quoted name. If the name is surrounded by quotes these are removed and included escape sequences '.' are reduced to '.' else the name is returned unmodified.
const | std::string & name |
Referenced by CModel::findMetabByName(), CEvaluationNodeCall::getData(), CDataVectorN< CType >::getIndex(), CUnitDefinitionDB::getUnitDefFromSymbol(), and CEvaluationNodeCall::setData().
std::string UTCTimeStamp | ( | ) |
Returns the current time in ISO format
References ISODateTime().
Referenced by CMIRIAMInfo::addDefaultCreatedDT(), CModelVersionHierarchy::addVersion(), CCheckForUpdates::checkRequired(), CFitProblem::createParameterSet(), CCopasiTimer::print(), CConfigurationFile::CXML::save(), CCopasiXML::save(), CCopasiXML::saveModelParameterSets(), and CCheckForUpdates::setChecked().
size_t utf8Length | ( | const std::string & | str | ) |
calculate the number of utf8 characters in a givent string
const | std::string & str |
Referenced by SBMLUnitSupport::createUnitExpressionFor().