mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
get_line moved to PHRQ_io. Still debugging some. git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/branches/ErrorHandling@5967 1feff8c3-07ed-0310-ac33-dd36852eb9cd
98 lines
1.4 KiB
C++
98 lines
1.4 KiB
C++
#include "PHRQ_base.h"
|
|
#include <iostream>
|
|
#include "PHRQ_io.h"
|
|
PHRQ_base::
|
|
PHRQ_base(void)
|
|
{
|
|
this->io = NULL;
|
|
base_error_count = 0;
|
|
}
|
|
|
|
PHRQ_base::
|
|
PHRQ_base(PHRQ_io * p_io)
|
|
{
|
|
this->io = p_io;
|
|
base_error_count = 0;
|
|
}
|
|
|
|
PHRQ_base::
|
|
~PHRQ_base()
|
|
{
|
|
}
|
|
|
|
void PHRQ_base::
|
|
error_msg(const std::string & stdstr, int stop)
|
|
{
|
|
this->base_error_count++;
|
|
std::ostringstream msg;
|
|
msg << "ERROR: " << stdstr << "\n";
|
|
if (this->io)
|
|
{
|
|
this->io->output_msg(msg.str().c_str());
|
|
this->io->log_msg(msg.str().c_str());
|
|
this->io->error_msg("\n");
|
|
this->io->error_msg(msg.str().c_str(), stop!=0);
|
|
}
|
|
else
|
|
{
|
|
std::cerr << msg.str().c_str();
|
|
std::cout << msg.str().c_str();
|
|
}
|
|
if (stop != 0)
|
|
{
|
|
throw PhreeqcStop();
|
|
}
|
|
}
|
|
|
|
void PHRQ_base::
|
|
warning_msg(const std::string & stdstr)
|
|
{
|
|
if (this->io)
|
|
{
|
|
this->io->warning_msg(stdstr.c_str());
|
|
}
|
|
else
|
|
{
|
|
std::cerr << stdstr << "\n";
|
|
std::cout << stdstr << "\n";
|
|
}
|
|
}
|
|
|
|
void PHRQ_base::
|
|
output_msg(const std::string & stdstr)
|
|
{
|
|
if (this->io)
|
|
{
|
|
this->io->output_msg(stdstr.c_str());
|
|
}
|
|
else
|
|
{
|
|
std::cout << stdstr << "\n";
|
|
}
|
|
}
|
|
|
|
void PHRQ_base::
|
|
screen_msg(const std::string & stdstr)
|
|
{
|
|
if (this->io)
|
|
{
|
|
this->io->screen_msg(stdstr.c_str());
|
|
}
|
|
else
|
|
{
|
|
std::cerr << stdstr << "\n";
|
|
}
|
|
}
|
|
|
|
void PHRQ_base::
|
|
echo_msg(const std::string & stdstr)
|
|
{
|
|
if (this->io)
|
|
{
|
|
this->io->echo_msg(stdstr.c_str());
|
|
}
|
|
else
|
|
{
|
|
std::cout << stdstr << "\n";
|
|
}
|
|
} |