diff --git a/IPhreeqc.cpp b/IPhreeqc.cpp index c5bfc231..ca5d6c97 100644 --- a/IPhreeqc.cpp +++ b/IPhreeqc.cpp @@ -180,6 +180,32 @@ GetErrorLine(int n) return IPhreeqc::LibraryInstance()->GetErrorLine(n); } +int +GetComponentCount(void) +{ + return (int)IPhreeqc::LibraryInstance()->ListComponents().size(); +} + +const char* +GetComponent(int n) +{ + static const char empty[] = ""; + static std::string comp; + std::list< std::string > comps = IPhreeqc::LibraryInstance()->ListComponents(); + if (n < 0 || n >= (int)comps.size()) + { + return empty; + } + std::list< std::string >::iterator it = comps.begin(); + for(int i = 0; i < n; ++i) + { + ++it; + } + comp = (*it); + return comp.c_str(); +} + + IPhreeqc::IPhreeqc(void) : Phreeqc() , ErrorReporter(0) @@ -1787,3 +1813,9 @@ void IPhreeqc::update_errors(void) this->ErrorLines.push_back(line); } } +std::list< std::string > IPhreeqc::ListComponents(void) +{ + std::list< std::string > comps; + this->list_components(comps); + return comps; +} diff --git a/IPhreeqc.hpp b/IPhreeqc.hpp index 9a69857d..c6f10570 100644 --- a/IPhreeqc.hpp +++ b/IPhreeqc.hpp @@ -35,6 +35,8 @@ public: int GetErrorLineCount(void)const; const char* GetErrorLine(int n); + std::list< std::string > ListComponents(void); + VRESULT AccumulateLine(const char *line); void SetDumpOn(bool bValue);