Source and target

Top  Previous  Next

Scripts > Class elements and c++ instructions > Parser class methods > Plugin methods > Source and target

 

Prototype

 

str SourceName()

void SourceName(const str& xsSourceName, bool xbLast)

str TargetName()

void TargetName(const str& xsTargetName)

str SourceRoot()

void SourceRoot(const str& xsSourceDir)

str TargetRoot()

void TargetRoot(const str& xsTargetDir)

 

Description

 

By these functions you can get the current source and target directories and files. The use of these functions makes sense at most for the transformation manager, the command line tool and in the generated code.In the TETRA working space these paths are constructed from the current project directory and the name "unnamed.txt", if texts weren't loaded in the source window or saved in the target window before.

 

 

str SourceName()

 

returns the name of the actual source file; the absolute path included.

 

str TargetName()

 

returns the name of the actual target file; the absolute path included.

 

str SourceRoot()

 

returns the absolute path of the superior source directory

 

str TargetRoot()

 

returns the absolute path of the superior source directory.

 

bool IsLastFile()

 

indicates, if the actual source file is the last of a sequence of files. This information can be important, if a group of source files is processed to a single target file to finish certain actions. If single source files are transformed to single target files respectively, this function returns true.

 

 

void SourceName(const str& xsSourceName, bool xbLast)

void TargetName(const str& xsTargetName)

void SourceRoot(const str& xsSourceDir)

void TargetRoot(const str& xsTargetDir)

 

In the created c++ code the name of the actual source file cannot be evaluated automatically, but the programmer can set it by this function; accordingly the source directory and the target directory.

When the name of the source file is set, you can use the second parameter xbLast to indicate, whether the file is the last of a sequence of files. Per default xbLast is true, because in a 1:1 transformation each source file is the last of the actual transformation.

 

 

str str()

 

If you are not in the TextTransformer IDE and the output wasn't redirected to a file, the output will be written into a buffer of the plugin. The content of the buffer can be retrieved by the str-method of the plugin:

 

xState.GetPlugin().str()

 

When this method is called, the buffer is cleared.

 



This page belongs to the TextTransformer Documentation

Home  Content  German