#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;
}
/**
* Registers a new import filter.
*/
-void RS_FileIO::registerFilter(RS_FilterInterface * f)
+void FileIO::registerFilter(FilterInterface * f)
{
filterList.append(f);
}
/**
* @return List of registered filters.
*/
-QList<RS_FilterInterface *> RS_FileIO::getFilterList()
+QList<FilterInterface *> FileIO::getFilterList()
{
return filterList;
}
/**
* @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; i<filterList.size(); i++)
{
- RS_FilterInterface * f = filterList[i];
+ FilterInterface * f = filterList[i];
if (f->canImport(t))
return f;
/**
* @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; i<filterList.size(); i++)
{
- RS_FilterInterface * f = filterList[i];
+ FilterInterface * f = filterList[i];
if (f->canExport(t))
return f;
* 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 & graphic, 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);
return filter->fileImport(graphic, 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());
}
*
* @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 & graphic, const QString & file, RS2::FormatType type)
{
- RS_DEBUG->print("RS_FileIO::fileExport");
+ DEBUG->print("FileIO::fileExport");
if (type == RS2::FormatUnknown)
{
type = RS2::FormatCXF;
}
- RS_FilterInterface * filter = getExportFilter(type);
+ FilterInterface * filter = getExportFilter(type);
if (filter)
return filter->fileExport(graphic, file, type);
- RS_DEBUG->print("RS_FileIO::fileExport: no filter found");
+ DEBUG->print("FileIO::fileExport: no filter found");
return false;
}
/**
* 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);
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);