| 135 | //========================================================================= |
| 136 | |
| 137 | void cTextDBViewer::PrintDB(cFCODatabaseFile& rd, const TSTRING& strFilename, DbVerbosity verbosity) |
| 138 | { |
| 139 | TOSTREAM* pOut; |
| 140 | TOFSTREAM fileOut; |
| 141 | bool fIsFile = false; |
| 142 | |
| 143 | if (strFilename == _T("-")) |
| 144 | { |
| 145 | pOut = &TCOUT; |
| 146 | } |
| 147 | else |
| 148 | { |
| 149 | //Gonna have to insert a lame hack here, since ostr.open DEMANDS a const char*!! |
| 150 | fileOut.open(strFilename.c_str()); |
| 151 | |
| 152 | if (fileOut.is_open()) |
| 153 | { |
| 154 | pOut = &fileOut; |
| 155 | fIsFile = true; |
| 156 | } |
| 157 | else |
| 158 | { |
| 159 | ASSERT(false); |
| 160 | throw eArchiveOpen(strFilename, iFSServices::GetInstance()->GetErrString()); |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | InitOStream(pOut); |
| 165 | |
| 166 | // |
| 167 | // output header, just like it sez.... |
| 168 | // |
| 169 | OutputDatabaseHeader(rd.GetHeader(), pOut); |
| 170 | |
| 171 | |
| 172 | if (verbosity > SUMMARY) |
| 173 | { |
| 174 | //TODO: OutputRulesSummary() would go here |
| 175 | |
| 176 | OutputObjectSummary(rd, pOut, DETAILS_MARGIN); |
| 177 | |
| 178 | if (verbosity == VERBOSE) |
| 179 | { |
| 180 | OutputObjectDetail(rd, pOut); |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | // we're done |
| 185 | (*pOut) << g_sz79Dashes << endl; |
| 186 | (*pOut) << TSS_GetString(cTW, tw::STR_END_OF_DB) << endl << endl; |
| 187 | (*pOut) << TSS_GetString(cTW, tw::STR_COPYRIGHT) << endl; |
| 188 | |
| 189 | if (fIsFile) |
| 190 | static_cast<TOFSTREAM*>(pOut)->close(); |
| 191 | |
| 192 | return; |
| 193 | } |
| 194 |
nothing calls this directly
no test coverage detected