uni

University stuff
git clone git://git.margiolis.net/uni.git
Log | Files | Refs | README | LICENSE

errlog.cpp (841B)


      1 #include "errlog.hpp"
      2 
      3 ErrLog::ErrLog() {fclear();}
      4 
      5 void
      6 ErrLog::fclear() const
      7 {
      8     std::ofstream f;
      9     f.open(fpath, std::ofstream::trunc);
     10     f << "Type;Info;Err" << std::endl;
     11     f.close();
     12 }
     13 
     14 void
     15 ErrLog::write(ErrType type, const lab::xstring& s) const
     16 {
     17     std::ofstream f;
     18     f.open(fpath, std::ios_base::app);
     19     switch(type)
     20     {
     21         case ErrType::STUDENT_MISSING:
     22             f << "Student;" << s << ";Missing" << std::endl;
     23             break;
     24         case ErrType::COURSE_MISSING:
     25             f << "Course;" << s << ";Missing" << std::endl;
     26             break;
     27         case ErrType::DIFFERENT_GRADES:
     28             f << "Grade;" << s << ";Different" << std::endl;
     29             break;
     30         case ErrType::RUNTIME_ERR:
     31             f << "Runtime;" << s << ";Error" << std::endl;
     32             break;
     33     }
     34     f.close();
     35 }