ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Editors / Code editor
  • Overview
  • Importing a class in text file format
  • How to?
  • Remarks
  • Examples
  • Importing a set of procedures in text file format
  • How to?
  • Remarks
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Importing classes and sets of procedures (text file)
Overview
From version 23, you have the ability to import existing classes or sets of procedures in text format.
Therefore, the development teams can for example create a class generator corresponding to their development architecture.
Importing a class in text file format

How to?

To import a class in text file format into a project:
  1. Open the relevant project.
  2. In the "Project explorer" pane, select the "Classes" folder.
  3. Right-click and select "Import text files" in the context menu.
    Importing text files
  4. In the file picker that is opened, select the text files to import and validate.
    Reminder: Use Shift or Ctrl to select multiple elements.
  5. The classes are imported into the project.

Remarks

  • The name of text file corresponds to the name of the class to import. For example, the "ClassA.txt" file is used to import the description of "ClassA" class.
  • You have the ability to select several files. Each text file corresponds to a class.
  • If a class with the same name is already found in the project, the code editor proposes not to import the class or to overwrite its content with the one of imported file.
  • The '...' symbols, indicating that a line of code continues over the next line, are not supported. A text file containing these symbols will not be imported.
  • The comments found before a declaration (procedure, ...) are considered as belonging to the previous procedure.
  • The declarations of procedures containing the '::' symbols are not supported.
  • To import properties, all you have to do is replace PROCEDURE by PROPERTY in the text file containing the code of class and properties (see the example below).

Examples

Examples of text files:
  • "ClassA.txt" file:
    ClassA is Class
    n is int
    END

    PROCEDURE Constructor()
    n = 5

    PROCEDURE Destructor()


    PROCEDURE GetN()
    RESULT n
  • "ClassB.txt" file:
    ClassB is Class
    pclA is ClassA dynamic
    END


    PROCEDURE Constructor()

    PROCEDURE Destructor()

    PROCEDURE Test()
    IF pclA = Null THEN
    trace("not allocated")
    ELSE
    trace(:pclA:GetN())
    END

    PROCEDURE Init(pclA=Null)
    pclA = pclA
  • "cAnimal.txt" file containing properties:
    cAnimal is Class

    PRIVATE
    m_sIdentifier is string

    PROTECTED
    m_sAnimalName is string
    m_AnimalImage is Image

    END

    PROCEDURE Constructor(sName is string)

    // Defines the animal identifier
    m_sIdentifier = GetGUID()

    // Stores the animal name
    m_sAnimalName = sName

    PROCEDURE Destructor()


    PROPERTY Identifier()

    RESULT m_sIdentifier
    PROPERTY Identifier(Value)

    // No possible modification for the identifier
    dbgAssertion(False, "The identifier cannot be modified")
    PROPERTY AnimalName()

    RESULT m_sAnimalName
    PROPERTY AnimalName(Value)

    m_sAnimalName = Value
    PROPERTY AnimalImage()

    RESULT m_AnimalImage
    PROPERTY AnimalImage(Value)

    m_AnimalImage = Value
Importing a set of procedures in text file format

How to?

To import a set of procedures in text file format into a project:
  1. Open the relevant project.
  2. In the "Project explorer" pane, select the "Procedures" folder.
  3. Right-click and select "Import text files" in the context menu.
    Importing text files

    WEBDEV - Server codeWEBDEV - Browser code In WEBDEV, you have the ability to import sets of server or browser procedures:
    Importing text files
  4. In the file picker that is opened, select the text files to import and validate.
    Reminder: Use Shift or Ctrl to select multiple elements.
  5. The sets of procedures are imported into the project.

Remarks

  • The name of text file corresponds to the name of the set of procedures to import. For example, the "Set_bCompareFiles.txt" file is used to import the description of the set of procedures named "Set_bCompareFiles".
  • You have the ability to select several files. Each text file corresponds to a set of procedures.
  • If a set of procedures with the same name is already found in the project, the code editor proposes not to import the set of procedures or to overwrite its content with the one of imported file.
  • The '...' symbols, indicating that a line of code continues over the next line, are not supported. A text file containing these symbols will not be imported.
  • The declarations of procedures containing the '::' symbols are not supported.
  • The comments found before a declaration (procedure, ...) are considered as belonging to the previous procedure. For example, you must not write :
    // Description of the input/output parameters of 'gCheckItemValue':
    //
    // Syntax:
    //gCheckItemValue (<HFItem>, <TextFileValue>, <sItemName>, <nRecNum>)
    //
    // Parameters:
    // HFItem: <specify the role of HFItem>
    // TextFileValue: <specify the role of TextFileValue>
    // sItemName: <specify the role of sItemName>
    // nRecNum: <specify the role of nRecNum>
    // Return value:
    // None
    PROCEDURE gCheckItemValue(HFItem,TextFileValue,sItemName,nRecNum)

    but you must write:
    PROCEDURE gCheckItemValue(HFItem,TextFileValue,sItemName,nRecNum)
    // Description of the input/output parameters of 'gCheckItemValue':
    //
    // Syntax:
    //gCheckItemValue (<HFItem>, <TextFileValue>, <sItemName>, <nRecNum>)
    //
    // Parameters:
    // HFItem: <specify the role of HFItem>
    // TextFileValue: <specify the role of TextFileValue>
    // sItemName: <specify the role of sItemName>
    // nRecNum: <specify the role of nRecNum>
    // Return value:
    // None
  • The imported code can contain internal procedures.
Minimum version required
  • Version 23
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/23/2023

Send a report | Local help