Show: Delphi C++
Display Preferences

Unit Scope Names

From RAD Studio
Jump to: navigation, search

Go Up to Getting Started with RAD Studio


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

Contents

Syntax and Description

<unitscope>.<unitname>. ...

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

System.SysUtils

Likewise, the Controls unit is now part of the Vcl unit scope, and there is also a Controls unit in the FMX unit scope:

Vcl.Controls 
FMX.Controls

Unit scope names:

  • Classify units into basic groups such as Vcl, 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 Vcl). The FireMonkey unit scope is an exception: FMX.
  • Are typically made up of one element (such as DataSnap), although some are made up of two elements (such as System.Win).

Third party products, such as Indy and TeeChart, are not unit-scoped. When developing new code with third party components, adding unit scope names is not necessary because added uses entries are automatically scoped.

Component developers can add unit scope names as described in Adding Unit Scope Names for Your Own Components.

Fully Qualified Names Must Include the Unit Scope Name

With one notable exception, legacy code should continue to work without changes. The one exception is scoped or qualified identifiers in the code itself. Fully qualified identifier names now require unit scoping. This means that if you used qualified identifiers in your existing code (which was not unit-scoped), changes are required in order to compile. You need to add the unit scope name to the unit name.

For example, here is the fully qualified identifier of the TStream class that you might have specified in previous product releases:

Classes.TStream

The name Classes.TStream is no longer considered to be a fully qualified class name because fully qualified names now 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 Delphi, 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

Possible code changes: If your existing code contains qualified identifiers (such as Classes.TStream.Seek), you must correct the name so that the identifier is unit-scoped and fully qualified (such as System.Classes.TStream.Seek).

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 Delphi Compiler page in Project Options.
Caution: Using partially qualified names can significantly slow down compile time because the compilers must resolve all partially qualified names during a compile.

RAD Studio Uses Unit Scopes, and the Help Also Uses Unit Scope Names

The wizards and templates in RAD Studio now 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 VCL-FMX-RTL 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>

In your code you can specify unqualified member names, 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, including Vcl, Database, and System. 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

Bde, Data, Data.Bind, Data.Cloud, Datasnap, Datasnap.Win, 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.Win

Vcl (Visual Component Library)

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

SOAP, COM

Soap

Web-related

Web, Web.Win

Windows API

Winapi

XML processing

Xml, Xml.Internal, Xml.Win


  • Nine unit scopes are database-related (Bde, Data, Data.Bind, Data.Cloud, Data.Win, DataSnap, DataSnap.Win, Db, IB).
  • Two unit scopes are FireMonkey (FMX, FMX.Bind).
  • The SOAP unit scope contains COM-related units.
  • The System unit scope has four subscopes (System.Bindings, System.Generics, System.Win).
  • VCL has four related unit scopes (Vcl, Vcl.Imaging, Vcl.Samples, Vcl.Touch).
  • Xml 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 lists the unit scope names, and the units that belong in each unit scope:

Unit Scope Name Units

Bde

BDE, Bdeconst, DBBdeWeb, DbTables, DrTable, SMINTF

Data

DB, DBByteBuffer, DBCommon, DBCommonTypes, DBConnAdmin, DBConsts, DBPlatform, DBXClassRegistry, DBXClient, DBXClientResStrs, DBXCommon, DBXCommonIndy, DBXCommonResStrs, DBXCommonTable, DbxCompressionFilter, DBXDataExpressMetaDataProvider, DbxDatasnap, DBXDBReaders, DBXDelegate, DBXDynalink, DBXDynalinkNative, DBXEncryption, DBXJSON, DBXJSONCommon, DBXJSONReflect, DBXMemoryRow, DBXMessageHandlerCommon, DBXMessageHandlerJSonClient, DBXMessageHandlerJSonCommon, DBXMessageHandlerJSonServer, DBXMessageHandlerServer, DBXMetaDataCommand, DBXMetaDataCommandFactory, DBXMetadataCommon, DBXMetaDataError, DBXMetaDataNames, DBXMetaDataProvider, DBXMetaDataReader, DBXMetaDataUtil, DBXMetaDataWriter, DBXMetaDataWriterFactory, DBXOpenSSL, DBXOpenSSLRes, DBXPlatform, DBXPool, DBXReaderTableStorage, DBXRSAFilter, DbxSocketChannelNative, DBXSqlScanner, DBXStream, DBXStreamer, DBXStreamPlatform, DBXTableFactory, DBXTrace, DBXTransport, DBXTransportFilter, DBXTypedTableStorage, DSUtil, FMTBcd, SqlConst, SqlExpr, SqlTimSt, Win.ADODB

Data.Bind

Components, Consts, DBLinks, DBScope, Editors, EngExt

Data.Cloud

AmazonAPI, AzureAPI, Azure, AzureBlob, AzureMessageDialog, AzureQueueMetadataDialog, AzureQueue, AzureTableDialog, AzureTableRowDialog, AzureTable, AzureUI

Datasnap

DataBkr, DBClient, DSAuth, DSAzure, DSClientMetadata, DSClientResStrs, DSClientRest, DSCommonProxy, DSCommonServer, DSCommonTable, DSConnect, DSHTTP, DSHTTPCommon, DSHTTPLayer, DSHTTPServiceProxyDispatcher, DSHTTPWebBroker, DSLoginDlg, DSIntf, DSNames, DSPlatform, DSProxy, DSProxyCpp, DSProxyCppRest, DSProxyDelphi, DSProxyDelphiRest, DSProxyDispatcher, DSProxyRest, DSProxyWriter, DSProxyWriterRegistry, DSReflect, DSServer, DSServerResStrs, DSService, DSTCPServerTransport, DSTransport, Midas, MidConst, Provider, Win.MConnect, Win.MidasCon, Win.MtsRdm, Win.ObjBrkr, Win.SConnect, Win.TConnect

FMX

(FireMonkey application platform)

ActnList, ActnRes, Ani, ASE, Bind, Canvas, Colors, Controls, Controls3D, DAE, Dialogs, Edit, Effects, ExtCtrls, Filter, Filter.Effects, Forms, Forms3D, Gestures, Grid, Header, Import, InertialMovement, Layers3D, Layouts, ListBox, ListView, Materials, MaterialSources, Media, MediaLibrary, Memo, Menus, Messages, Notification, Objects, Objects3D, PhoneDialer, Pickers, PixelFormats, Platform, Printer, TabControl, Text, TextLayout, TreeView, Types, Types3D, Video, VirtualKeyboard, WebBrowser

iOSapi (RTL)

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

Macapi (RTL)

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

EncdDecd, HTTPSOAPTBind, HTTPUtil, inquire_vcl, IntfInfo, InvConst, Invoker, InvokeRegistry, OPConvert, OPConvertOptions, OPToSOAPDomConv, OPToSOAPDomCustom, Rio, SOAInv, SOAPAttach, SOAPAttachIntf, SOAPConn, SOAPConst, SOAPDm, SOAPDomConv, SOAPHTTPClient, SOAPHTTPPasInv, SOAPHTTPTrans, SOAPLinked, SOAPMidas, TypeTrans, UDDIHelper, WebBrokerSOAP, WebNode, WebServerExp, WSDLBind, WSDLIntf, WSDLItems, WSDLLookup, WSDLNode, WSDLPub, WSDLSOAP, WSILIntf, XSBuiltIns

SysInit

See SysInit for members.

System

Actions, AnsiStrings, Bindings, Character, Classes, Contnrs, ConvUtils, DateUtils, Diagnostics, Generics.Collections, Generics.Defaults, HelpIntfs, Inifiles, IOUtils, Masks, MaskUtils, Math, ObjAuto, RegularExpressions, RegularExpressionsCore, Rtti, Sensors, StdConvs, StrUtils, SyncObjs, SysUtils, TimeSpan, Types, TypInfo, UIConsts, UITypes, VarCmplx, VarConv, Variants, VarUtils, WideStrings, WideStrUtils, Win, Zip, ZLib

System.Bindings

CustomScope, CustomWrapper, EvalProtocol, Expression, ExpressionDefaults, Factories, Helper, Manager, ManagerDefaults, Methods, Outputs

System.Win

ComObj,Comserv, Mtsobj, ObjComAuto, Registry, ScktComp, VCLCom

Vcl

(Visual Component Library)

ActnColorMaps, ActnCtrls, ActnList, ActnMan, ActnMenus, ActnPopup, AppEvnts, AxCtrls, BandActn, ButtonGroup, Buttons, Calendar, CaptionedDockTree, CategoryButtons, CheckLst, Clipbrd, CmAdmCtl, ColorGrid, ComCtrls, Controls, CustomizeDlg, DBActns, DBCGrids, DBClientActns, DBCtrls, DBGrids, DBLogDlg, DBLookup, DBOleCtl, DBPWDlg, DdeMan, Dialogs, Direct2D, DockTabSet, ExtActns, ExtCtrls, ExtDlgs, FileCtrl, Forms, Graphics, GraphUtil, Grids, HTMLHelpViewer, Imaging, ImgList, IMouse, ListActns, Mask, Menus, MPlayer, OleAuto, OleCntnrs, OleCtrls, OleServer, Outline, PlatformDefaultStyleActnCtrls, Printers, Ribbon, RibbonActnCtrls, RibbonActnMenus, RibbonGalleryBar, RibbonLunaStyleActnCtrls, RibbonObsidianStyleActnCtrls, RibbonSilverStyleActnCtrls, RibbonStyleActnCtrls, Samples, ScreenTips, ShadowWnd, ShellAnimations, StdActnMenus, StdActns, StdCtrls, StdStyleActnCtrls, Styles, SvcMgr, TabNotBk, Tabs, ThemedActnCtrls, Themes, ToolWin, Touch, ValEdit, WinHelpViewer, XPActnCtrls, XPMan, XPStyleActnCtrls

Web

AutoDisp, BrkrConst, CGIApp, CGIHTTP, CGIHTTP, DBWeb, DBXpressWeb, DSProd, HTTPApp, HTTPProd, WebBroker, WebCntxt, WebFileDispatcher, WebReq, Win


Winapi

See Winapi.

Xml

XMLDoc, xmldom, XMLIntf, Win.msxmldom

Units that Have No Unit Scope Name

The following units exist without unit scoping. These units do not require that you specify a unit scope name in the uses clause or #include.


  • ActnRes
  • AdaptReq
  • AutoAdap
  • ComApp
  • CompProd
  • CtlPanel
  • DBAdapt
  • DBAdaptImg
  • DesignEditors
  • DesignIntf
  • DSAzure
  • IB, IBBlob, and all the other IB (InterBase) units
  • MidItems
  • MidProd
  • PagItems
  • PlatformAPI
  • ReqFiles
  • ReqMulti
  • SessColn
  • SHDocVw
  • SimpleDS
  • SiteComp
  • SiteProd
  • WebAdapt
  • WebComp
  • WebContnrs
  • WebDisp
  • WebFact
  • WebForm
  • WebModu
  • WebScript
  • WebSess
  • WebUsers
  • XMLBrokr
  • XSLProd

Unit Names in Alphabetical Order with Their Unit Scopes

For a reference list of unit names with their associated unit scope name, see Unit Names Alphabetical List with Unit Scopes.

Topics

See Also

Personal tools
In other languages