# ImportExport Class Reference

`#include <importexport.h>`

List of all members.

## Public Slots
void | batchConverter ()
void | retranslateUi ()
## Signals
void | modified ()
| signal page modified, emitted if save or open functions finished
void | active ()
| signal savePage(QString Str) function active, emitted if save functions started
void | ready ()
| signal savePage(QString Str) function ready, emitted if save function finished
## Public Member Functions
| ImportExport (PageCtrl *pageCtrl, Prototype *prototype)
virtual | ~ImportExport ()
QString | createSucosoftHeader (QString Str)
bool | OpenPrepare (QStringList files)
int | savePage (QString Str)
void | SavePrepare (int pageIndex, QString fn, QStringList *tmpList, int Ext, int convOption, bool sendConvBack)
void | saveAllPages (QString batchPath, int batchExt, int batchConvOption)
## Public Attributes
int | conversionOption
| option for fb call model conversion, set by preferences dialog
QStringList | errorFiles
| string list for files which could not be opened
QString | lastDir
| last directory of save or open function
bool | usePresetDir
| use preset dir flag, set by preferences dialog
bool | usePrgLngDetection
| use programming language detection
bool | savePTT
| save prototype flag, set by preferences dialog
## Private Member Functions
bool | checkFileContentAndExtension (QStringList *tmpList, int index, int endPos, QString *ExtStr)
QString | getCoDeSysVISU (QStringList *tmpList, int index, int end)
QString | getMELSOFTConfig (QStringList *tmpList, int index, int end)
QString | getSTEP7DBData (QStringList *tmpList, int index, int end)
int | nextPOUEndIndexAt (QStringList *tmpList, int index, QString ExtStr)
int | nextPOUStartIndexAt (QStringList *tmpList, int index, int end)
bool | OpenReinforce (QStringList *tmpList, int index, int endPos, QString ExtStr)
void | setProgressBar (int files, int minFiles, QString msg)
QString | strippedFileName (const QString &fullFileName)
## Private Attributes
QString | msg_progress_fopen
| message at progressbar "file open"
QString | msg_progress_batch
| message at progressbar "batch converter"
QString | msg_error_pou_line
| message file open error in pou line
QProgressBar * | progressBar
| instance of qprogressbar
PageCtrl * | m_PageCtrl
| instance of PageCtrl class
Prototype * | m_Prototype
| instance of Prototype class

## Constructor & Destructor Documentation

ImportExport::ImportExport | ( | PageCtrl * | pageCtrl,
|  | Prototype * | prototype |
| ) |  |  |

creating function for ImportExport

Parameters:

  | PageCtrl | class, Prototype class

ImportExport::~ImportExport | ( |  | ) | `[virtual]`

virtual destructor

## Member Function Documentation

void ImportExport::active | ( |  | ) | `[signal]`

signal savePage(QString Str) function active, emitted if save functions started

void ImportExport::batchConverter | ( |  | ) | `[slot]`

batch converting / file resaving function

The batch dialog returns the full string of the combobox:

'only copy'

'plain POU (.txt)'

'Sucosoft S40 (.poe)'

'CoDeSys (.EXP)'

'STEP 7 (.awl / .scl - keep current language)'

'MULTIPROG (.IL / .ST - keep current language)'

'MELSOFT (.asc)'

If Siemens of KW-Software were detected the called saveAllPages(QString batchPath, int batchExt) function will only get batchExt=4 or batchExt=6 to keep the current programming language by self detection.

bool ImportExport::checkFileContentAndExtension | ( | QStringList * | tmpList,
|  | int | index,
|  | int | endPos,
|  | QString * | ExtStr |
| ) |  |  | `[private]`

check unexpected content in file according to file extension

QString ImportExport::createSucosoftHeader | ( | QString | Str | ) |

revise Moeller Sucosoft header from string input

QString ImportExport::getCoDeSysVISU | ( | QStringList * | tmpList,
|  | int | index,
|  | int | end |
| ) |  |  | `[private]`

return CoDeSys VISU section from a list, by using a start index and an end position

QString ImportExport::getMELSOFTConfig | ( | QStringList * | tmpList,
|  | int | index,
|  | int | end |
| ) |  |  | `[private]`

return MELSOFT configuration data from a list, by using a start index and an end position

QString ImportExport::getSTEP7DBData | ( | QStringList * | tmpList,
|  | int | index,
|  | int | end |
| ) |  |  | `[private]`

return Siemens DB data from a list, by using a start index and an end position

void ImportExport::modified | ( |  | ) | `[signal]`

signal page modified, emitted if save or open functions finished

int ImportExport::nextPOUEndIndexAt | ( | QStringList * | tmpList,
|  | int | index,
|  | QString | ExtStr |
| ) |  |  | `[private]`

return next POU end index of tmpList up from index

int ImportExport::nextPOUStartIndexAt | ( | QStringList * | tmpList,
|  | int | index,
|  | int | end |
| ) |  |  | `[private]`

return next POU start index of tmpList up from index

bool ImportExport::OpenPrepare | ( | QStringList | files | ) |

prepare file opening of string list content and call open reinforce function

bool ImportExport::OpenReinforce | ( | QStringList * | tmpList,
|  | int | index,
|  | int | endPos,
|  | QString | ExtStr |
| ) |  |  | `[private]`

reinforce import of file content in tmpList up from index until endPos, respecting the ExtStr value

Parameters:

  | *tmpList | temporary list which will be filled with the file content
  | index | is the index of the next POU start poisition
  | endPos | is the position of the POU end mark
  | ExtStr | contains the file extension as STRING

supported extension values:

- '.txt'

- '.poe'

- '.EXP'

- '.awl'

- '.scl'

- '.IL'

- '.ST'

- '.asc'

void ImportExport::ready | ( |  | ) | `[signal]`

signal savePage(QString Str) function ready, emitted if save function finished

void ImportExport::retranslateUi | ( |  | ) | `[slot]`

retranslate Ui

void ImportExport::saveAllPages | ( | QString | batchPath,
|  | int | batchExt,
|  | int | batchConvOption |
| ) |  |  |

save all pages

Parameters:

  | batchPath | contains save path, if empty call PageCtrl->filePathOf(i)
  | batchExt | contains the selected file extension, if set to 99 use PageCtrl->fileExtOf(i)
  | batchConvOption | holds the function block call model conversion option

supported extension values:

- 0 = .txt

- 1 = .poe

- 2 = .EXP

- 3 = .awl

- 4 = .scl

- 5 = .IL

- 6 = .ST

- 7 = .asc

- 99 = PageCtrl->fileExtOf(i)

supported conversion values:

option 0: do nothing

option 1: all into selected compatibility call model

option 2: outputs into simple IEC call model

option 3: all into simple IEC call model

int ImportExport::savePage | ( | QString | Str | ) |

save page content into path which is setted in Str and call saveprepare function

void ImportExport::SavePrepare | ( | int | pageIndex,
|  | QString | fn,
|  | QStringList * | tmpList,
|  | int | Ext,
|  | int | convOption,
|  | bool | sendConvBack |
| ) |  |  |

prepare file storage for content at pageIndex into tmpList, with specified by filename and extension from fn and Ext

Parameters:

  | pageIndex | is the index of the selected page
  | fn | contains the file name
  | *tmpList | temporary list which will be filled with the file content
  | Ext | contains the file extension as INT
  | convOption | contains the conversion option as INT
  | sendConvBack | is used to revise the instruction section with all function block conversions

supported extension values:

- 0 = .txt

- 1 = .poe

- 2 = .EXP

- 3 = .awl

- 4 = .scl

- 5 = .IL

- 6 = .ST

- 7 = .asc

supported conversion values:

option 0: do nothing

option 1: all into selected compatibility call model

option 2: outputs into simple IEC call model

option 3: all into simple IEC call model

void ImportExport::setProgressBar | ( | int | files,
|  | int | minFiles,
|  | QString | msg |
| ) |  |  | `[private]`

set progressbar with number of files, min. files to be activated, message string

QString ImportExport::strippedFileName | ( | const QString & | fullFileName | ) | `[private]`

strip filename from fullFileName (path + file name)

## Member Data Documentation

int ImportExport::conversionOption

option for fb call model conversion, set by preferences dialog

QStringList ImportExport::errorFiles

string list for files which could not be opened

QString ImportExport::lastDir

last directory of save or open function

PageCtrl* ImportExport::m_PageCtrl`[private]`

instance of PageCtrl class

Prototype* ImportExport::m_Prototype`[private]`

instance of Prototype class

QString ImportExport::msg_error_pou_line`[private]`

message file open error in pou line

QString ImportExport::msg_progress_batch`[private]`

message at progressbar "batch converter"

QString ImportExport::msg_progress_fopen`[private]`

message at progressbar "file open"

QProgressBar* ImportExport::progressBar`[private]`

instance of qprogressbar

bool ImportExport::savePTT

save prototype flag, set by preferences dialog

bool ImportExport::usePresetDir

use preset dir flag, set by preferences dialog

bool ImportExport::usePrgLngDetection

use programming language detection

The documentation for this class was generated from the following files:

- importexport.h
- importexport.cpp