57 const std::string & metabolite,
58 const std::string & compartment,
61 std::string DefaultCompartment;
64 DefaultCompartment =
"compartment";
68 std::string Metabolite = quoted ?
quote(metabolite,
"{}") : metabolite;
71 Metabolite =
"\"" + Metabolite +
"\"";
76 compartment == DefaultCompartment))
79 std::string Compartment = quoted ?
quote(compartment,
"{}") : compartment;
81 if ((quoted &&
isNumber(Compartment)) ||
82 (Compartment.find(
' ') != std::string::npos && Compartment.find(
'"') == std::string::npos))
83 Compartment =
"\"" + Compartment +
"\"";
85 return Metabolite +
'{' + Compartment +
'}';
89 const std::string & metabolite,
90 const std::string & compartment)
101 const std::string & metabolite,
102 const std::string & compartment)
106 if (compartment !=
"")
136 std::string metabName;
138 for (i = 0; i < metabs.
size(); i++)
142 if (metabName == name)
155 const std::string & metabolite,
156 const std::string & compartment)
158 if (compartment !=
"")
176 std::stringstream buffer((name.find(
'"') != std::string::npos ? name :
quote(name)) +
" ->");
180 std::pair< std::string, std::string > Result;
200 std::stringstream buffer(displayName +
" ->");
204 std::pair< std::string, std::string > Names;
208 Names.first = displayName;
217 std::string Name = Names.first;
219 if (Names.second !=
"")
221 std::string compartment = Names.second;
223 if (compartment.find(
' '))
224 compartment =
"\"" + compartment +
"\"";
226 Name +=
"{" + compartment +
"}";
233 std::string CMetabNameInterface::extractCompartmentName(
const std::string & name)
236 std::stringstream buffer(name);
241 if (Parser.yyparse() != 0)
return "";
243 return Parser.getSubstrateCompartments()[0];
246 std::string CMetabNameInterface::extractMetabName(
const std::string & name)
249 std::stringstream buffer(name);
254 if (Parser.yyparse() != 0)
return "";
256 return Parser.getSubstrateNames()[0];
259 bool CMetabNameInterface::isValidMetabDisplayName(
const std::string & name)
262 std::stringstream buffer(name);
267 return (Parser.yyparse() == 0);
bool isNumber(const std::string &str)
CCopasiVectorNS< CMetab > & getMetabolites()
const CCopasiVector< CMetab > & getMetabolites() const
const std::string & getObjectName() const
virtual size_t size() const
const std::vector< std::string > & getSubstrateCompartments() const
CCopasiObject * get(const std::string &key)
virtual size_t getIndex(const std::string &name) const
size_t findMetabByName(const std::string &Target) const
virtual const std::string & getKey() const
Header file of class CCopasiContainer.
std::string quote(const std::string &name, const std::string &additionalEscapes)
CCopasiVectorNS< CCompartment > & getCompartments()
static CKeyFactory * getKeyFactory()
const std::vector< std::string > & getSubstrateNames() const