X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Ffileio.cpp;h=8390be19690e13e4e469b06f3438f39e7a42d31e;hb=a18a12fc3bcb18e5c7ca5494d7f97fb8b93f90a2;hp=3187bedfe0b5533d85c2b93befbeabe4d5f0ec89;hpb=3239ef39dcee08fa6e8cd68cdf2727fc68cc7a8c;p=architektonas diff --git a/src/base/fileio.cpp b/src/base/fileio.cpp index 3187bed..8390be1 100644 --- a/src/base/fileio.cpp +++ b/src/base/fileio.cpp @@ -22,20 +22,20 @@ #include "filterdxf1.h" #include "filterinterface.h" -RS_FileIO * RS_FileIO::uniqueInstance = NULL; +FileIO * FileIO::uniqueInstance = NULL; // Constructor -RS_FileIO::RS_FileIO() +FileIO::FileIO() { } /** * @return Instance to the unique import object. */ -/*static*/ RS_FileIO * RS_FileIO::instance() +/*static*/ FileIO * FileIO::instance() { if (!uniqueInstance) - uniqueInstance = new RS_FileIO(); + uniqueInstance = new FileIO(); return uniqueInstance; } @@ -43,7 +43,7 @@ RS_FileIO::RS_FileIO() /** * Registers a new import filter. */ -void RS_FileIO::registerFilter(RS_FilterInterface * f) +void FileIO::registerFilter(FilterInterface * f) { filterList.append(f); } @@ -51,7 +51,7 @@ void RS_FileIO::registerFilter(RS_FilterInterface * f) /** * @return List of registered filters. */ -QList RS_FileIO::getFilterList() +QList FileIO::getFilterList() { return filterList; } @@ -59,11 +59,11 @@ QList RS_FileIO::getFilterList() /** * @return Filter which can import the given file type. */ -RS_FilterInterface * RS_FileIO::getImportFilter(RS2::FormatType t) +FilterInterface * FileIO::getImportFilter(RS2::FormatType t) { for(int i=0; icanImport(t)) return f; @@ -75,11 +75,11 @@ RS_FilterInterface * RS_FileIO::getImportFilter(RS2::FormatType t) /** * @return Filter which can export the given file type. */ -RS_FilterInterface * RS_FileIO::getExportFilter(RS2::FormatType t) +FilterInterface * FileIO::getExportFilter(RS2::FormatType t) { for(int i=0; icanExport(t)) return f; @@ -89,27 +89,26 @@ RS_FilterInterface * RS_FileIO::getExportFilter(RS2::FormatType t) } /** - * Calls the import method of the filter responsible for the format - * of the given file. + * Calls the import method of the filter responsible for the format of the + * given file. * - * @param graphic The container to which we will add - * entities. Usually that's an Drawing entity but - * it can also be a polyline, text, ... + * @param drawing The container to which we will add entities. Usually that's + * an Drawing entity but it can also be a polyline, text, ... * @param file Path and name of the file to import. */ -bool RS_FileIO::fileImport(Drawing & graphic, const QString & file, RS2::FormatType type) +bool FileIO::fileImport(Drawing & drawing, const QString & file, RS2::FormatType type) { - RS_DEBUG->print("Trying to import file '%s'...", file.toAscii().data()); + DEBUG->print("Trying to import file '%s'...", file.toAscii().data()); - RS_FilterInterface * filter = NULL; + FilterInterface * filter = NULL; RS2::FormatType t = (type == RS2::FormatUnknown ? detectFormat(file) : type); filter = getImportFilter(t); if (filter) - return filter->fileImport(graphic, file, t); + return filter->fileImport(drawing, file, t); else { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_FileIO::fileImport: failed to import file: %s", + DEBUG->print(Debug::D_WARNING, "FileIO::fileImport: failed to import file: %s", file.toAscii().data()); } @@ -117,14 +116,14 @@ bool RS_FileIO::fileImport(Drawing & graphic, const QString & file, RS2::FormatT } /** - * Calls the export method of the object responsible for the format - * of the given file. + * Calls the export method of the object responsible for the format of the + * given file. * * @param file Path and name of the file to import. */ -bool RS_FileIO::fileExport(Drawing & graphic, const QString & file, RS2::FormatType type) +bool FileIO::fileExport(Drawing & drawing, const QString & file, RS2::FormatType type) { - RS_DEBUG->print("RS_FileIO::fileExport"); + DEBUG->print("FileIO::fileExport"); if (type == RS2::FormatUnknown) { @@ -136,12 +135,12 @@ bool RS_FileIO::fileExport(Drawing & graphic, const QString & file, RS2::FormatT type = RS2::FormatCXF; } - RS_FilterInterface * filter = getExportFilter(type); + FilterInterface * filter = getExportFilter(type); if (filter) - return filter->fileExport(graphic, file, type); + return filter->fileExport(drawing, file, type); - RS_DEBUG->print("RS_FileIO::fileExport: no filter found"); + DEBUG->print("FileIO::fileExport: no filter found"); return false; } @@ -149,7 +148,7 @@ bool RS_FileIO::fileExport(Drawing & graphic, const QString & file, RS2::FormatT /** * Detects and returns the file format of the given file. */ -RS2::FormatType RS_FileIO::detectFormat(const QString & file) +RS2::FormatType FileIO::detectFormat(const QString & file) { RS2::FormatType type = RS2::FormatUnknown; QFileInfo info(file); @@ -167,13 +166,13 @@ RS2::FormatType RS_FileIO::detectFormat(const QString & file) if (!f.open(QIODevice::ReadOnly)) { // Error opening file: - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_FileIO::detectFormat: Cannot open file: %s", file.toAscii().data()); + DEBUG->print(Debug::D_WARNING, + "FileIO::detectFormat: Cannot open file: %s", file.toAscii().data()); type = RS2::FormatUnknown; } else { - RS_DEBUG->print("RS_FileIO::detectFormat: Successfully opened DXF file: %s", + DEBUG->print("FileIO::detectFormat: Successfully opened DXF file: %s", file.toAscii().data()); QTextStream ts(&f);