CFx SDK Documentation  2022 SP0
Public Types | Public Member Functions | List of all members
OdDbBaseHostAppServices Class Referenceabstract

#include <DbBaseHostAppServices.h>

Inheritance diagram for OdDbBaseHostAppServices:
OdRxObject OdDAIHostAppServicesBase OdDbHostAppServices OdIfcHostAppServices OdDbHostAppServices2 CFxHostAppServices

Public Types

enum  RemapFileContext { kDrawingOpen = 0 , kXrefResolution = 1 , kRasterResolution = 2 }
 
enum  FindFileHint {
  kDefault = 0 , kFontFile = 1 , kCompiledShapeFile = 2 , kTrueTypeFontFile = 3 ,
  kEmbeddedImageFile = 4 , kXRefDrawing = 5 , kPatternFile = 6 , kTXApplication = 7 ,
  kFontMapFile = 8 , kUnderlayFile = 9 , kTextureMapFile = 10 , kPhotometricWebFile = 11
}
 
enum  GsBitmapDeviceFlags { kUseSoftwareHLR = (1 << 0) , kFor2dExportRender = (1 << 1) , kFor2dExportRenderHLR = (1 << 2) , kForThumbnail = (1 << 3) }
 

Public Member Functions

 ODRX_DECLARE_MEMBERS (OdDbBaseHostAppServices)
 
 OdDbBaseHostAppServices ()
 
virtual OdString findFile (const OdString &filename, OdDbBaseDatabase *pDb=0, FindFileHint hint=kDefault)=0
 
virtual OdDbHostAppProgressMeternewProgressMeter ()
 
virtual void releaseProgressMeter (OdDbHostAppProgressMeter *pProgressMeter)
 
virtual const OdString program ()=0
 
virtual const OdString product ()=0
 
virtual const OdString companyName ()=0
 
virtual ProdIdCode prodcode ()
 
virtual const OdString releaseMajorMinorString ()
 
virtual int releaseMajorVersion ()
 
virtual int releaseMinorVersion ()
 
virtual const OdString versionString ()
 
virtual void warning (const OdString &message)
 
virtual void warning (const char *warnVisGroup, const OdString &message)
 
virtual void warning (OdWarning warningOb)
 
virtual void warning (const char *warnVisGroup, OdWarning warningOb)
 
virtual OdString getErrorDescription (unsigned int errorCode)
 
virtual OdString formatMessage (unsigned int errorCode,...)
 
virtual OdDbUndoControllerPtr newUndoController ()
 
virtual OdStreamBufPtr newUndoStream ()
 
virtual void auditPrintReport (OdAuditInfo *pAuditInfo, const OdString &strLine, int printDest) const
 
virtual bool ttfFileNameByDescriptor (const OdTtfDescriptor &description, OdString &filename)
 
virtual OdString getAlternateFontName () const =0
 
virtual OdString getFontMapFileName () const =0
 
virtual OdString getPreferableFont (const OdString &fontName, OdFontType fontType)=0
 
virtual OdString getSubstituteFont (const OdString &fontName, OdFontType fontType)=0
 
virtual OdString getSubstituteFontByChar (const OdFont &pFont, OdChar unicodeChar, OdDbBaseDatabase *pDb)
 
virtual bool getSystemFontFolders (OdStringArray &aDirs)
 
virtual void collectFilePathsInDirectory (OdStringArray &res, const OdString &sPath, const OdString &sFilter=L"*.*")
 
virtual OdString fileDialog (int flags, const OdString &dialogCaption=OdString::kEmpty, const OdString &defExt=OdString::kEmpty, const OdString &defFilename=OdString::kEmpty, const OdString &filter=OdString::kEmpty)
 
virtual OdGsDevicePtr gsBitmapDevice (OdRxObject *pViewObj=NULL, OdDbBaseDatabase *pDb=NULL, OdUInt32 flags=0)
 
virtual OdString getTempPath () const
 
virtual OdInt16 getMtMode () const
 
virtual int numThreads (OdDb::MultiThreadedMode mtMode)
 
virtual OdResult brepBuilder (OdBrepBuilder &bbuilder, BrepType bbType)
 
- Public Member Functions inherited from OdRxObject
 ODRX_HEAP_OPERATORS ()
 
 OdRxObject ()
 
virtual ~OdRxObject ()
 
virtual OdRxObjectqueryX (const OdRxClass *pClass) const
 
virtual OdRxObjectx (const OdRxClass *pClass) const
 
virtual OdRxClassisA () const
 
virtual void addRef ()=0
 
virtual void release ()=0
 
virtual long numRefs () const
 
bool isKindOf (const OdRxClass *pClass) const
 
virtual OdRxObjectPtr clone () const
 
virtual void copyFrom (const OdRxObject *pSource)
 
virtual OdRx::Ordering comparedTo (const OdRxObject *pOther) const
 
virtual bool isEqualTo (const OdRxObject *pOther) const
 

Additional Inherited Members

- Static Public Member Functions inherited from OdRxObject
static OdRxObjectPtr cast (const OdRxObject *pointer)
 
static OdRxClassdesc ()
 

Detailed Description

This class is the base class for platform specific operations within Teigha.

Corresponding C++ library: TD_Db

<group OdDb_Classes>

Definition at line 84 of file DbBaseHostAppServices.h.

Member Enumeration Documentation

◆ FindFileHint

Enumerator
kDefault 
kFontFile 
kCompiledShapeFile 
kTrueTypeFontFile 
kEmbeddedImageFile 
kXRefDrawing 
kPatternFile 
kTXApplication 
kFontMapFile 
kUnderlayFile 
kTextureMapFile 
kPhotometricWebFile 

Definition at line 98 of file DbBaseHostAppServices.h.

◆ GsBitmapDeviceFlags

Enumerator
kUseSoftwareHLR 
kFor2dExportRender 
kFor2dExportRenderHLR 
kForThumbnail 

Definition at line 114 of file DbBaseHostAppServices.h.

◆ RemapFileContext

Enumerator
kDrawingOpen 
kXrefResolution 
kRasterResolution 

Definition at line 91 of file DbBaseHostAppServices.h.

Constructor & Destructor Documentation

◆ OdDbBaseHostAppServices()

OdDbBaseHostAppServices::OdDbBaseHostAppServices ( )

Member Function Documentation

◆ auditPrintReport()

virtual void OdDbBaseHostAppServices::auditPrintReport ( OdAuditInfo pAuditInfo,
const OdString strLine,
int  printDest 
) const
virtual

Print the audit report for the specified AuditInfo object.

Parameters
pAuditInfo[in] Pointer to an OdDbAuditInfo object.
strLine[in] The string to print.
printDest[in] Print destination.
Remarks
The default implementation of this function does nothing but return.

Reimplemented in OdDbHostAppServices.

◆ brepBuilder()

virtual OdResult OdDbBaseHostAppServices::brepBuilder ( OdBrepBuilder bbuilder,
BrepType  bbType 
)
virtual

Initialize brep builder with product specific implementation. Return eNotImplementedYet by default.

Parameters
brepBuilder[in] instance of brep builder class.
bbType[in] type of brep.

Reimplemented in OdDbHostAppServices, and OdIfcHostAppServices.

◆ collectFilePathsInDirectory()

virtual void OdDbBaseHostAppServices::collectFilePathsInDirectory ( OdStringArray res,
const OdString sPath,
const OdString sFilter = L"*.*" 
)
virtual

Collects TrueType font paths.

Parameters
res[out] Array of full file names of TrueType fonts.
sPath[in] Array of folders paths with TrueType files.
sFilter[in] File name filter.
See also
Font Handling

Reimplemented in OdDbHostAppServices.

◆ companyName()

virtual const OdString OdDbBaseHostAppServices::companyName ( )
pure virtual

Returns the name of the client company.

Remarks
This function is typically used for populating "About" information.
The default implementation of this function returns oddbGetLibraryInfo()->getCompanyName().

Implemented in OdDbHostAppServices, and OdIfcHostAppServices.

◆ fileDialog()

virtual OdString OdDbBaseHostAppServices::fileDialog ( int  flags,
const OdString dialogCaption = OdString::kEmpty,
const OdString defExt = OdString::kEmpty,
const OdString defFilename = OdString::kEmpty,
const OdString filter = OdString::kEmpty 
)
virtual

Prompts the user for a filename, and returns their response.

Parameters
flags[in] Dialog behavior.
dialogCaption[in] Dialog caption.
defExt[in] Default file extension without "."
defFilename[in] Default filename.
filter[in] Filter pattern.
Remarks
flags must be one of the following:

Value Description kGfpForOpen 0 For Open. kGfpForSave 1 For Save. kGfpOverwritePrompt 2 Enable overwrite prompt displaying when exist file selected for saving.

This function is intended for the selection of filenames via dialog boxes, although other methods may be used.

Returns "canceled" if the user cancels the request. Returns "unsupported" if the application does not support this user input.

Remarks
The default implementation of this function does nothing but return "unsupported".

Reimplemented in OdDbHostAppServices.

◆ findFile()

virtual OdString OdDbBaseHostAppServices::findFile ( const OdString filename,
OdDbBaseDatabase pDb = 0,
FindFileHint  hint = kDefault 
)
pure virtual

Returns the fully qualified path to the specified file.

Parameters
filename[in] Name of the file to find.
pDb[in] Pointer to the database context.
hint[in] Hint that indicates the type of file that is required.
Returns
Returns an empty string if the file is not found.

This function is called by Teigha when access is needed to a file, such as a font file, a template file, etc.

pDb == 0 specifies that this file search is not related to a database.

If pDb != 0, call pDb->getFilename() to determine the path to the DWG file associated with the database.

The typical search order is as follows:

  1. The filename itself.
  2. The current directory.
  3. The drawing directory (for shx font, image, and xref files).
  4. The directories listed in the ACAD environment variable.
  5. The Windows fonts directory (only for TTF fonts on Windows).

hint must be one of the following:

Value Description Extension kDefault 0 Any file. any kFontFile 1 Can be either SHX or TTF file. SHX or TTF kCompiledShapeFile 2 SHX file. SHX kTrueTypeFontFile 3 TTF file. TTF kEmbeddedImageFile 4 Image file. ISM kXRefDrawing 5 Drawing template file. DWT kPatternFile 6 Pattern file (PAT) PAT kTXApplication 7 Teigha(R) Xtension file. TX kFontMapFile 8 FontMap file FMP kUnderlayFile 9 Underlay file kTextureMapFile 10

Remarks
The client application can, in fact return any non-null string, so long as the application can handle that string in OdDbSystemServices::createFile.

Implemented in OdDbHostAppServices, and OdIfcHostAppServices.

◆ formatMessage()

virtual OdString OdDbBaseHostAppServices::formatMessage ( unsigned int  errorCode,
  ... 
)
virtual

Returns a formatted message corresponding to the specified error code(s).

Parameters
errorCode[in] Error code.

Reimplemented in OdDbHostAppServices, and OdIfcHostAppServices.

◆ getAlternateFontName()

virtual OdString OdDbBaseHostAppServices::getAlternateFontName ( ) const
pure virtual

Returns the font file to be used when a given font file is not found by Teigha.

See also
Font Handling

Implemented in OdDbHostAppServices, and OdIfcHostAppServices.

◆ getErrorDescription()

virtual OdString OdDbBaseHostAppServices::getErrorDescription ( unsigned int  errorCode)
virtual

Returns the error description associated with the specified error code.

Parameters
errorCode[in] Error code.
Remarks
The default implementation of this function returns formatMessage(errorCode).

Reimplemented in OdDbHostAppServices.

◆ getFontMapFileName()

virtual OdString OdDbBaseHostAppServices::getFontMapFileName ( ) const
pure virtual

Returns the name of the font mapping file used by the getPreferableFont function.

See also
Font Handling
Remarks
The default implementation of this function does nothing but return an empty string. It will be fully implemented in a future release.

Implemented in OdDbHostAppServices, and OdIfcHostAppServices.

◆ getMtMode()

virtual OdInt16 OdDbBaseHostAppServices::getMtMode ( ) const
virtual

MtMode controls if multi-threading is used (bit-coded)

◆ getPreferableFont()

virtual OdString OdDbBaseHostAppServices::getPreferableFont ( const OdString fontName,
OdFontType  fontType 
)
pure virtual

Returns the preferable font name for the specified font name and type.

Parameters
fontName[in] Font name.
fontType[in] Font type.
Remarks
This function is called as the first step in the process of resolving a font file. The default implementation tries to locate a font mapping file by calling getFontMapFileName, and substitutes the font name based on the contents of this file.

fontType must be one of the following:

Value Description kFontTypeUnknown 0 Unknown. kFontTypeShx 1 SHX font. kFontTypeTrueType 2 TrueType font. kFontTypeShape 3 Shape file. kFontTypeBig 4 BigFont file.

See also
Font Handling

Implemented in OdDbHostAppServices, and OdIfcHostAppServices.

◆ getSubstituteFont()

virtual OdString OdDbBaseHostAppServices::getSubstituteFont ( const OdString fontName,
OdFontType  fontType 
)
pure virtual

Returns the font to be used when the specified font is not found.

Parameters
fontName[in] Font name.
fontType[in] Font type.
Remarks
fontType must be one of the following:

Value Description kFontTypeUnknown 0 Unknown. kFontTypeShx 1 SHX font. kFontTypeTrueType 2 TrueType font. kFontTypeShape 3 Shape file. kFontTypeBig 4 BigFont file.

The default implementation of this function calls getAlternateFontName for fonts that are not of type kFontTypeShape or kFontTypeBig. When they are, and empty string is returned.

Client code could override this function to perform custom substitution for these types of fonts.

See also
Font Handling

Implemented in OdDbHostAppServices, and OdIfcHostAppServices.

◆ getSubstituteFontByChar()

virtual OdString OdDbBaseHostAppServices::getSubstituteFontByChar ( const OdFont pFont,
OdChar  unicodeChar,
OdDbBaseDatabase pDb 
)
inlinevirtual

Returns the typeface name of the TTF font which has the character.

Parameters
pFont[in] Current font.
unicodeChar[in] Current symbol.
pDb[in] Pointer to the database context.
See also
Font Handling
Remarks
The default implementation uses Windows API for getting the font.

Reimplemented in OdDbHostAppServices, and OdIfcHostAppServices.

Definition at line 496 of file DbBaseHostAppServices.h.

◆ getSystemFontFolders()

virtual bool OdDbBaseHostAppServices::getSystemFontFolders ( OdStringArray aDirs)
virtual

Collects folders with TrueType fonts.

Parameters
aDirs[out] Array names of folders.
See also
Font Handling

Reimplemented in OdDbHostAppServices.

◆ getTempPath()

virtual OdString OdDbBaseHostAppServices::getTempPath ( ) const
virtual

Returns the path to the temporary files folder.

Reimplemented in OdDbHostAppServices.

◆ gsBitmapDevice()

virtual OdGsDevicePtr OdDbBaseHostAppServices::gsBitmapDevice ( OdRxObject pViewObj = NULL,
OdDbBaseDatabase pDb = NULL,
OdUInt32  flags = 0 
)
virtual

Returns a the gsBitmapDevice associated with this HostAppServices object.

Parameters
pViewObj[in] OdAbstractViewPE compatible object (OdGsView, OdDbViewport or etc.).
pDb[in] Pointer to the database context.
flags[in] Bitmap device flags.

Reimplemented in OdDbHostAppServices, and OdIfcHostAppServices.

◆ newProgressMeter()

virtual OdDbHostAppProgressMeter* OdDbBaseHostAppServices::newProgressMeter ( )
virtual

Returns an instance of an OdDbHostAppProgressMeter.

Reimplemented in OdDbHostAppServices.

◆ newUndoController()

virtual OdDbUndoControllerPtr OdDbBaseHostAppServices::newUndoController ( )
virtual

Returns an alternate UndoController object for Teigha.

Remarks
The default implementation of this function always returns a null SmartPointer.

Each database requires at most 2 undo controllers (for undo and redo).

Reimplemented in OdDbHostAppServices.

◆ newUndoStream()

virtual OdStreamBufPtr OdDbBaseHostAppServices::newUndoStream ( )
virtual

Returns an alternate stream object for undo/redo operations.

Remarks
The default implementation of this function always returns a null SmartPointer. It may return null in the user application. In this case the default memory based stream will be used. In fact this stream will be used for the current undo/redo step. Other steps can be controlled by OdDbUndoController.

◆ numThreads()

virtual int OdDbBaseHostAppServices::numThreads ( OdDb::MultiThreadedMode  mtMode)
virtual

Returns the number of threads for required multi-threaded mode.

◆ ODRX_DECLARE_MEMBERS()

OdDbBaseHostAppServices::ODRX_DECLARE_MEMBERS ( OdDbBaseHostAppServices  )

◆ prodcode()

virtual ProdIdCode OdDbBaseHostAppServices::prodcode ( )
virtual

Returns the name of the client product code.

Remarks
This function is typically used for populating "About" information.

prodcode() returns one of the following:

Value Description kProd_ACAD 1 Plain kProd_LT 2 Lite kProd_OEM 3 OEM kProd_OdDb 4 ..

Remarks
The default implementation of this function returns kProd_OEM, and should not be overridden.

Reimplemented in OdDbHostAppServices.

◆ product()

virtual const OdString OdDbBaseHostAppServices::product ( )
pure virtual

Returns the name of the client product.

Remarks
This function is typically used for populating "About" information.
The default implementation of this function returns program().

Implemented in OdDbHostAppServices, and OdIfcHostAppServices.

◆ program()

virtual const OdString OdDbBaseHostAppServices::program ( )
pure virtual

Returns the name of the client program.

Remarks
This function is typically used for populating "About" information.
The default implementation of this function returns oddbGetLibraryInfo()->getLibName()

Implemented in OdDbHostAppServices, and OdIfcHostAppServices.

◆ releaseMajorMinorString()

virtual const OdString OdDbBaseHostAppServices::releaseMajorMinorString ( )
virtual

Returns the release major and minor version string of the client application.

Remarks
The default implementation of this function returns oddbGetLibraryInfo()->getLibVersion().

Reimplemented in OdDbHostAppServices, and OdIfcHostAppServices.

◆ releaseMajorVersion()

virtual int OdDbBaseHostAppServices::releaseMajorVersion ( )
virtual

Returns the release major version of the client application.

Remarks
The default implementation of this function returns TD_MAJOR_VERSION.

Reimplemented in OdDbHostAppServices.

◆ releaseMinorVersion()

virtual int OdDbBaseHostAppServices::releaseMinorVersion ( )
virtual

Returns the release minor version of the client application.

Remarks
The default implementation of this function returns TD_MINOR_VERSION.

Reimplemented in OdDbHostAppServices.

◆ releaseProgressMeter()

virtual void OdDbBaseHostAppServices::releaseProgressMeter ( OdDbHostAppProgressMeter pProgressMeter)
virtual

Notification function called whenever Teigha no longer needs the specified ProgressMeter object.

Parameters
pProgressMeter[in] Pointer to the ProgressMeter object no longer needed by Teigha.
Remarks
The default implementation of this function does nothing but return.

Reimplemented in OdDbHostAppServices.

◆ ttfFileNameByDescriptor()

virtual bool OdDbBaseHostAppServices::ttfFileNameByDescriptor ( const OdTtfDescriptor description,
OdString filename 
)
virtual

Locates the TTF or TTC file containing the specified font description.

Parameters
description[in] Font description.
filename[out] Receives the name of the TrueType font file.
Returns
Returns true and the filename if and only if the font file was found.
Remarks
The non-Windows builds of this function do nothing but return.

◆ versionString()

virtual const OdString OdDbBaseHostAppServices::versionString ( )
virtual

Returns the release version string of the client application.

Remarks
The default implementation of this function returns oddbGetLibraryInfo()->getLibVersion().

Reimplemented in OdDbHostAppServices, and OdIfcHostAppServices.

◆ warning() [1/4]

virtual void OdDbBaseHostAppServices::warning ( const char *  warnVisGroup,
const OdString message 
)
virtual

Displays the specified warning message.

Parameters
warnVisGroup[in] Group of warning message visibility (always visible if empty).
message[in] Warning message.
Remarks
This function calls odSystemServices()->warning(message) to display the warning.

◆ warning() [2/4]

virtual void OdDbBaseHostAppServices::warning ( const char *  warnVisGroup,
OdWarning  warningOb 
)
virtual

Displays the specified warning message.

Parameters
warnVisGroup[in] Group of warning message visibility (always visible if empty).
warningOb[in] Warning object.

◆ warning() [3/4]

virtual void OdDbBaseHostAppServices::warning ( const OdString message)
virtual

Displays the specified warning message.

Parameters
message[in] Warning message.
Remarks
This function calls odSystemServices()->warning(message) to display the warning.

◆ warning() [4/4]

virtual void OdDbBaseHostAppServices::warning ( OdWarning  warningOb)
virtual

Displays the specified warning message.

Parameters
warningOb[in] Warning object.

The documentation for this class was generated from the following file: