// -*- mode: c++; indent-tabs-mode: nil; -*- // // Copyright 2009 Illumina, Inc. // // This software is covered by the "Illumina Genome Analyzer Software // License Agreement" and the "Illumina Source Code License Agreement", // and certain third party copyright/licenses, and any user of this // source file is bound by the terms therein (see accompanying files // Illumina_Genome_Analyzer_Software_License_Agreement.pdf and // Illumina_Source_Code_License_Agreement.pdf and third party // copyright/license notices). // // /// \file /// \author Chris Saunders /// #include "blt_util/blt_exception.hh" #include "blt_util/export_line_parser.hh" #include #include #include #include #include void export_line_parser:: set_export_line(char* line) { static const char sep('\t'); assert(line); char* p(line); _entry[0]=p; unsigned i(1); while((*p != '\n') && (*p != '\0')) { if (*p == sep) { if(i == MAX_ENTRY) break; *p = '\0'; _entry[i++] = p+1; } ++p; } *p = '\0'; _is_set=true; if(i < SIZE){ _entry[i] = 0; std::ostringstream oss; oss << "ERROR:: Detected only " << i << " fields in export line where at least " << SIZE << " fields were expected.\n" << "\texport line: "; write_export_line(oss); oss << "\n"; throw blt_exception(oss.str().c_str()); _is_set=false; } _entry_count=i; } void export_line_parser:: write_export_line(std::ostream& os) const { for(unsigned i(0);i