📄️ About class functions
This section describes the built-in 4D class functions as well as the associated constructor commands. 4D class functions and properties are available through class instance objects.
The Blob class lets you create and manipulate blob objects (4D.Blob).
When a user class is defined in the project, it is loaded in the 4D language environment. A class is an object itself, of "Class" class, which has properties and a function.
The Collection class manages Collection type variables.
The CryptoKey class in the 4D language encapsulates an asymmetric encryption key pair.
A DataClass provides an object interface to a database table. All dataclasses in a 4D application are available as a property of the ds datastore.
Dataclass attributes are available as properties of their respective classes. For example:
A Datastore is the interface object provided by ORDA to reference and access a database. Datastore objects are returned by the following commands:
Creating, sending or receiving emails in 4D is done by handling an Email object.
An entity is an instance of a Dataclass, like a record of the table matching the dataclass in its associated datastore. It contains the same attributes as the dataclass as well as the data values and specific properties and functions.
An entity selection is an object containing one or more reference(s) to entities belonging to the same Dataclass. An entity selection can contain 0, 1 or X entities from the dataclass -- where X can represent the total number of entities contained in the dataclass.
File objects are created with the File command. They contain references to disk files that may or may not actually exist on disk. For example, when you execute the File command to create a new file, a valid File object is created but nothing is actually stored on disk until you call the file.create( ) function.
The FileHandle class has functions that allow you to sequentially read from or append contents to an opened File object. A file handle can access any part of a document.
Folder objects are created with the Folder command. They contain references to folders that may or may not actually exist on disk. For example, when you execute the Folder command to create a new folder, a valid Folder object is created but nothing is actually stored on disk until you call the folder.create() function.
A 4D.Function object contains a piece of code that can be executed from an object, either using the () operator, or using the apply() and call() functions. 4D proposes three kinds of Function objects:
The HTTPRequest class allows you to handle HTTPRequest objects that can be used to configure and send requests to an HTTP server, as well as to process the HTTP server responses.
The IMAPTransporter class allows you to retrieve messages from a IMAP email server.
Attachment objects allow referencing files within a Email object. Attachment objects are created using the MAIL New attachment command.
The POP3Transporter class allows you to retrieve messages from a POP3 email server.
Session objects are returned by the Session command when scalable sessions are enabled in your project. The Session object is automatically created and maintained by the 4D web server to control the session of a web client (e.g. a browser). This object provides the web developer with an interface to the user session, allowing to manage privileges, store contextual data, share information between processes, and launch session-related preemptive processes.
Signals are tools provided by the 4D language to manage interactions and avoid conflicts between processes in a multiprocess application. Signals allow you to make sure one or more process(es) will wait for a specific task to be completed before continuing execution. Any process can wait and/or release a signal.
The SMTPTransporter class allows you to configure SMTP connections and send emails through SMTP transporter objects.
System workers allow the 4D code to call any external process (a shell command, PHP, etc.) on the same machine. System workers are called asynchronously. By using callbacks, 4D makes it possible to communicate both ways.
The WebServer class API allows you to start and monitor a web server for the main (host) application as well as each hosted component (see the Web Server object overview). This class is available from the 4D class store.
A 4D ZIP archive is a File or Folder object containing one or more files or folders, which are compressed to be smaller than their original size. These archives are created with a ".zip" extension and can be used to save disk space or transfer files via mediums which may have size limitations (e.g., email or network).
The following properties and functions from the File class are available to ZIPFile objects:
The following properties and functions from the Folder class are available to ZIPFolder objects: