error routines working on windows

git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/branches/ErrorHandling@6082 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
Scott R Charlton 2012-01-20 00:28:46 +00:00
parent fdcb31d93b
commit 2ee8c4203c
3 changed files with 13 additions and 5 deletions

View File

@ -33,6 +33,7 @@ IPhreeqc::IPhreeqc(void)
, LogStringOn(false)
, ErrorStringOn(true)
, ErrorReporter(0)
, WarningStringOn(true)
, WarningReporter(0)
, SelectedOutput(0)
, SelectedOutputStringOn(false)
@ -1212,10 +1213,13 @@ void IPhreeqc::error_msg(const char *str, bool stop)
ASSERT(!(this->ErrorFileOn ^ (this->error_ostream != 0)));
this->PHRQ_io::error_msg(str);
this->AddError(str);
if (this->ErrorStringOn && this->error_on)
{
this->AddError(str);
}
if (stop)
{
if (this->error_ostream)
if (this->error_ostream && this->error_on)
{
(*this->error_ostream) << "Stopping.\n";
this->error_ostream->flush();
@ -1231,7 +1235,10 @@ void IPhreeqc::warning_msg(const char *str)
std::ostringstream oss;
oss << str << std::endl;
this->AddWarning(oss.str().c_str());
if (this->WarningStringOn)
{
this->AddWarning(oss.str().c_str());
}
}
void IPhreeqc::output_msg(const char * str)

View File

@ -1482,7 +1482,7 @@ Headings
/**
* Sets the error string switch on or off. This switch controls whether or not the data normally sent
* to the error file are stored in a buffer for retrieval. The initial setting after calling
* \ref CreateIPhreeqc is off.
* \ref CreateIPhreeqc is on.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @param output_string_on If non-zero, captures the error output into a string buffer;
* if zero, error output is not captured to a string buffer.

View File

@ -688,7 +688,7 @@ public:
/**
* Sets the error string switch on or off. This switch controls whether or not the data normally sent
* to the error file are stored in a buffer for retrieval. The initial setting is false.
* to the error file are stored in a buffer for retrieval. The initial setting is true.
* @param bValue If true, captures error output into a string buffer; if false, error output is not captured to a string buffer.
* @see GetErrorFileOn, GetErrorString, GetErrorStringOn, GetErrorStringLine, GetErrorStringLineCount, SetErrorFileOn
*/
@ -833,6 +833,7 @@ protected:
std::string ErrorString;
std::vector< std::string > ErrorLines;
bool WarningStringOn;
IErrorReporter *WarningReporter;
std::string WarningString;
std::vector< std::string > WarningLines;