Show: Object Pascal C++
Display Preferences

Unit Scope Names

From Appmethod Topics
Jump to: navigation, search

Go Up to Getting Started with Appmethod


Unit scope names are prefixes that are prepended to unit names in the Appmethod libraries (FMX-RTL). That is, names of units, functions, classes, and members have a unit scope name prepended to the unit name, as follows:

Syntax and Description

The unit scope name precedes the unit name:

<unitscope>.<unitname>. ...

For example, the SysUtils unit is part of the System unit scope, as follows:

System.SysUtils

and the Controls unit is part of the FMX unit scope:

FMX.Controls

Unit scope names:

  • Classify units into basic groups such as System, FMX, and so forth (unit scopes are classified in Unit Scopes).
  • Ensure compatibility of the code that you write using the IDE.
  • Differentiate members whose names are ambiguous (that is, ensure correct name resolution when a member's name matches the name of a member of another unit).
  • Typically begin with a single uppercase letter followed by lowercase letters (such as Data).
  • Are typically made up of one element, although some are made up of two elements (such as System.Generics).


Fully Qualified Names Must Include the Unit Scope Name

For example, here is a partially qualified identifier of the TStream class:

Classes.TStream

The name Classes.TStream is not considered to be a fully qualified class name because fully qualified names must be unit-scoped, that is, they must include the unit scope name. In this case, the unit scope name System must be added to the Classes unit name in order to yield a unit-scoped or fully qualified name, as follows:

  • In Object Pascal, the fully qualified identifier name for TStream is:
    System.Classes.TStream
  • In C++, unit scope names use the C++ scope operator (::). The fully qualified name for the TStream class in C++ code is:
    System::Classes::TStream


How to Specify Unit-Scoped Unit Names in Your Code

For new development, you must specify the unit scope for units in your application. Choose any of the following ways to do this:

  • Everywhere:
    Fully qualify all names of all members throughout your code. Using full qualification, including unit scope names, throughout your application ensures the fastest compile time.
  • Uses clause or #includes:
    Fully qualify unit names (with the unit scope and unit names) in the uses clause or #include. Then in your code, you can partially qualify the names of members of those units that you fully qualified (with unit scope) in the uses clause or #include.
  • In Project Options:
    Add the unit scope names in the Unit scope names option on the Object Pascal Compiler page in Project Options.
YellowBang.pngCaution: Using partially qualified names can significantly slow your compile time because the compilers must resolve all partially qualified names during a compile.

Appmethod Uses Unit Scopes, and the Help Also Uses Unit Scope Names

The wizards and templates in Appmethod use and include properly unit-scoped unit names. In the help, some instances of unit, class, and member names do not include the unit scope names. However, the Libraries documentation has full unit scope names in the page titles.


Example

If your code contains:

 uses
   System.SysUtils, System.Types, System.Classes, FMX.Controls;

or:

#include <System.SysUtils.hpp>
#include <System.Types.hpp>
#include <System.Classes.hpp>
#include <FMX.Controls.hpp>

You can specify unqualified member names in your code, such as:

  GetPackageInfo  // referring to System.SysUtils.GetPackageInfo
  TRect           // referring to System.Types.TRect
  TNotifyEvent    // referring to System.Classes.TNotifyEvent
  TTrackBar       // referring to FMX.Controls.TTrackBar

Unit Scopes

There are more than a few unit scopes, but most of the unit scopes can be grouped into a few general categories. The following table lists the general categories and the unit scope names in each category:

General Category Unit Scope Names in this Category

Database-related

Data, Data.Bind, Data.Cloud, IB (also System.Bindings)

FireMonkey

FMX, FMX.ASE, FMX.Bind, FMX.Canvas, FMX.DAE, FMX.Filter, FMX.Platform, FMX.Printer

iOS

iOSapi (RTL)

Mac OS X

Macapi, Posix, System.Mac (RTL)

System-related (Run-Time Library)

System, System.Bindings, System.Generics, System.Math, System.Sensors, System.Tether

Vcl (Visual Component Library)

Vcl, Vcl.Imaging, Vcl.Samples, Vcl.Shell, Vcl.Touch

SOAP, COM

Soap

Web-related

Web, Web.Win

Windows API

Winapi (RTL)

XML processing

Xml, Xml.Internal, Xml.Win

  • Ten unit scopes are FireMonkey related (FMX, FMX.ASE, FMX.Bind, FMX.Canvas, FMX.DAE, FMX.DateTimeControls, FMX.EmbeddedControls, FMX.Filter, FMX.ListView, FMX.MediaLibrary).
  • The Soap unit scope contains COM-related units.
  • The System unit scope has several unit scopes, including System.Bindings, System.Generics, System.Math, System.Sensors, System.Tether).
  • The Xml unit scope contains the four units related to XML processing, such as Xml.Win.msxmldom.

Unit Scopes and the Units in Each Unit Scope

The following table gives the following information:

  • For units that are documented in the help, a hyperlink is given to the unit scope, where you will see the units that belong in the unit scope.
  • For external units, which are not documented in the help, the units are listed that belong in the unit scope.
Unit Scope Name Units

Androidapi (RTL)

AppGlue, AssetManager, AssetManagaerIni, Bitmap, Configuration, Consts, Egl, Eglext, EglPlatform Gles, Gles2, Gles2ext, Glesext, Input, IOUtils, JNI.Analytics, JNI.ApkExpansion, JNI.App, JNI.Dalvik, JNI.Embarcadero, JNI.GraphicsContentViewText, JNI.Hardware, JNI.InputMethodService, JNI.JavaTypes, JNI.Licensing, JNI.Location, JNI.Media, JNI.Net, JNI.OpenGL, JNI.Os, Jni, JNI.PlayServices, JNI.Provider, JNI.Support, JNI.Telephony, JNI.Util, JNI.VideoView, JNI.WebKit, JNI.Widget, JNIBridge, JNIMarshal, Keycodes, KhrPlatform, Log, Looper, NativeActivity, NativeWindow, NativeWindowJni, Obb, OpenSles, Rect, Sensor, StorageManager

Data

See Data

Data.Bind

See Data.Bind

Data.Cloud

See Data.Cloud

Datasnap

See Datasnap

FMX
(FireMonkey application platform)

See FMX

IBX

See IBX

iOSapi (RTL)

AssetsLibrary, AVFoundation, CocoaTypes, CoreAudio, CoreData, CoreGraphics, CoreImage, CoreLocation, CoreMedia, CoreMotion, CoreTelephony, CoreText, CoreVideo, Foundation, GLKit, MediaPlayer, OpenGLES, QuartzCore, UIKit

Macapi (RTL) (Mac Objective-C Frameworks)

AppKit, CocoaTypes, CoreFoundation, CoreServices, Foundation, Mach, ObjCRuntime, ObjectiveC, OCMarshal, OpenGL, QuartzCore, Security, SystemConfiguration, VarObjC

Posix
(Mac OS X) (RTL)

ArpaInet, Base, Dirent, Dlfcn, Errno, Fcntl, Fnmatch, Grp, Iconv, Langinfo, Limits, Locale, NetDB, NetIf, NetinetIcmp6, NetinetIn, NetinetIp6, Posix, Pthread, Pwd, Sched, Semaphore, Signal, StdDef, Stdio, Stdlib, String_, StrOpts, SysMman, SysSelect, SysSocket, SysStat, SysStatvfs, SysSysctl, SysTime, SysTimes, Systypes, SysUio, SysWait, Termios, Time, Unistd, Utime, Wchar, Wctype, Wordexp

Soap

See Soap

SysInit

See SysInit

System

See System

System.Win

See System.Win

Vcl

(Visual Component Library)

See Vcl

Web style="display: none;"

See Web

Winapi

See Winapi

Xml

See Xml


Topics

See Also

Personal tools
In other languages