X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsim%2Farray2dfile.cpp;h=6c400ad77f35ebae4c1a5ab5f1dddc368433c743;hp=e35a14982056cbb5f414b8fb73402ebe58a1c4a8;hb=dc034c9d0b7d9c3874a324a4c2c189a02945adc8;hpb=55426f4170ed9dc777c3cec3741e4a59e6eebd38 diff --git a/libctsim/array2dfile.cpp b/libctsim/array2dfile.cpp index e35a149..6c400ad 100644 --- a/libctsim/array2dfile.cpp +++ b/libctsim/array2dfile.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: array2dfile.cpp,v 1.16 2000/12/06 15:17:51 kevin Exp $ +** $Id: array2dfile.cpp,v 1.21 2000/12/16 06:12:47 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -31,7 +31,6 @@ typedef long off_t; #endif -using namespace std; const kuint16 Array2dFile::m_signature = ('I'*256+'F'); @@ -106,7 +105,7 @@ Array2dFileLabel::getDateTime (int& year, int& month, int& day, int& hour, int& second = m_second; } -const string& +const std::string& Array2dFileLabel::getDateString (void) const { char szDate [128]; @@ -139,19 +138,19 @@ Array2dFileLabel::operator= (const Array2dFileLabel& rhs) } void -Array2dFileLabel::print (ostream& os) const +Array2dFileLabel::print (std::ostream& os) const { if (m_labelType == L_HISTORY) { - os << "History: " << endl; - os << " " << m_strLabel << endl; - os << " calc time = " << m_calcTime << " secs" << endl; - os << " Timestamp = " << getDateString() << endl; + os << "History: " << std::endl; + os << " " << m_strLabel << std::endl; + os << " calc time = " << m_calcTime << " secs" << std::endl; + os << " Timestamp = " << getDateString() << std::endl; } else if (m_labelType == L_USER) { - os << "Note: " << m_strLabel << endl; - os << " Timestamp = %s" << getDateString() << endl; + os << "Note: " << m_strLabel << std::endl; + os << " Timestamp = %s" << getDateString() << std::endl; } else { - os << "Unknown (" << m_labelType << "): " << m_strLabel << endl; - os << " Timestamp = %s" << getDateString() << endl; + os << "Unknown (" << m_labelType << "): " << m_strLabel << std::endl; + os << " Timestamp = %s" << getDateString() << std::endl; } } @@ -242,7 +241,7 @@ Array2dFile::freeArray (void) } bool -Array2dFile::fileWrite (const string& filename) +Array2dFile::fileWrite (const std::string& filename) { return fileWrite (filename.c_str()); } @@ -252,7 +251,7 @@ Array2dFile::fileWrite (const char* const filename) { m_filename = filename; - frnetorderstream fs (m_filename.c_str(), ios::out | ios::in | ios::trunc | ios::binary); + frnetorderstream fs (m_filename.c_str(), std::ios::out | std::ios::in | std::ios::trunc | std::ios::binary); if (fs.fail()) { sys_error (ERR_WARNING, "Error opening file %s for writing [fileCreate]", m_filename.c_str()); return false; @@ -270,7 +269,7 @@ Array2dFile::fileWrite (const char* const filename) } bool -Array2dFile::fileRead (const string& filename) +Array2dFile::fileRead (const std::string& filename) { return fileRead (filename.c_str()); } @@ -281,9 +280,9 @@ Array2dFile::fileRead (const char* const filename) m_filename = filename; #ifdef MSVC - frnetorderstream fs (m_filename.c_str(), ios::out | ios::in | ios::binary); + frnetorderstream fs (m_filename.c_str(), std::ios::out | std::ios::in | std::ios::binary); #else - frnetorderstream fs (m_filename.c_str(), ios::out | ios::in | ios::binary | ios::nocreate); + frnetorderstream fs (m_filename.c_str(), std::ios::out | std::ios::in | std::ios::binary | std::ios::nocreate); #endif if (fs.fail()) { sys_error (ERR_WARNING, "Unable to open file %s [fileRead]", m_filename.c_str()); @@ -555,13 +554,15 @@ Array2dFile::labelAdd (const Array2dFileLabel& label) } void -Array2dFile::labelsCopy (Array2dFile& copyFile, const char* const idStr) +Array2dFile::labelsCopy (Array2dFile& copyFile, const char* const pszId) { - string id = idStr; + std::string id; + if (pszId) + id = pszId; for (unsigned int i = 0; i < copyFile.getNumLabels(); i++) { Array2dFileLabel l (copyFile.labelGet (i)); - string lstr = l.getLabelString(); - lstr = idStr + lstr; + std::string lstr = l.getLabelString(); + lstr = id + lstr; l.setLabelString (lstr); labelAdd (l); } @@ -578,13 +579,13 @@ Array2dFile::arrayDataClear (void) } void -Array2dFile::printLabels (ostream& os) const +Array2dFile::printLabels (std::ostream& os) const { for (constLabelIterator l = m_labels.begin(); l != m_labels.end(); l++) { const Array2dFileLabel& label = **l; label.print (os); - os << endl; + os << std::endl; } }