VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
DtEnumDictionaryConfig Class Reference

Class to read JSON configuration files containing configuration for the DtEnumDictionary. More...

+ Collaboration diagram for DtEnumDictionaryConfig:

Public Member Functions

 DtEnumDictionaryConfig ()
 Constructor. More...
 
virtual ~DtEnumDictionaryConfig ()
 Destructor. More...
 
 DtEnumDictionaryConfig (const DtEnumDictionaryConfig &orig)
 Copy constructor. More...
 
DtEnumDictionaryConfig & operator= (const DtEnumDictionaryConfig &orig)
 Assignment operator. More...
 
virtual bool loadConfigFile (const DtFilename &filename)
 Load configuration from JSON file. More...
 
virtual bool getEntityDescriptionSettings (const DtEntityType &entityType, std::vector< DtEntityTypeField > &fields) const
 Get the entity type description settings for a specific entity type. More...
 
virtual bool getEntityDescriptionSettings (const DtString &entityTypeStr, std::vector< DtEntityTypeField > &fields) const
 Get the entity type description settings for a specific entity type by string. More...
 
virtual void getDefaultDescriptionSettings (std::vector< DtEntityTypeField > &fields) const
 Get the default entity type description settings, used when no entity-specific entry matches. More...
 
virtual void clear ()
 Clear all loaded configuration. More...
 
virtual size_t size () const
 Get the number of configured entity types. More...
 

Protected Member Functions

virtual bool parseJsonContent (const std::string &jsonContent)
 Parse JSON content from string. More...
 
virtual bool readFileContent (const DtFilename &filename, std::string &content)
 Read file content into string. More...
 
virtual bool extractJsonValue (const std::string &json, const std::string &key, std::string &value)
 Simple JSON value extraction helper. More...
 
virtual bool parseJsonArray (const std::string &arrayStr, std::vector< DtEntityTypeField > &fields) const
 Parse a JSON array of field name strings into a vector of DtEntityTypeField values. More...
 
virtual bool parseEntityTypeField (const std::string &fieldStr, DtEntityTypeField &field) const
 Parse a field name string into a DtEntityTypeField enum value. More...
 
std::string trim (const std::string &str) const
 

Protected Attributes

std::map< DtEntityType,
std::vector< DtEntityTypeField > > 
myEntityConfigMap
 Map of entity types to their associated entity type field settings. More...
 
std::vector< DtEntityTypeField > myDefaultFields
 Default field settings, used when no entity-specific entry matches. More...
 

Detailed Description

Class to read JSON configuration files containing configuration for the DtEnumDictionary.

The configuration file contains settings for how to generate entity type descriptions for different entity types. It allows specifying which fields of the entity type should be concatenated to form the description, and it supports default settings as well as specific settings for particular entity types or patterns of entity types. An example of what a configuration file might look like:

* {
* "defaultDescriptionSetting": ["subcategory"] ,
* "entityDescriptionSettings" : {
* "8:-1:-1:-1:-1:-1:-1": ["kind", "extra"],
* "2:-1:-1:-1:-1:-1:-1": ["specific"]
* }
* }
*

Constructor & Destructor Documentation

DtEnumDictionaryConfig::DtEnumDictionaryConfig ( )

Constructor.

virtual DtEnumDictionaryConfig::~DtEnumDictionaryConfig ( )
virtual

Destructor.

DtEnumDictionaryConfig::DtEnumDictionaryConfig ( const DtEnumDictionaryConfig &  orig)

Copy constructor.

Member Function Documentation

virtual void DtEnumDictionaryConfig::clear ( )
virtual

Clear all loaded configuration.

virtual bool DtEnumDictionaryConfig::extractJsonValue ( const std::string &  json,
const std::string &  key,
std::string &  value 
)
protectedvirtual

Simple JSON value extraction helper.

Parameters
jsonJSON string
keyKey to find
valueOutput value
Returns
true if key found
virtual void DtEnumDictionaryConfig::getDefaultDescriptionSettings ( std::vector< DtEntityTypeField > &  fields) const
virtual

Get the default entity type description settings, used when no entity-specific entry matches.

Parameters
fieldsVector of entity type fields that should be concatenated to form the description.
virtual bool DtEnumDictionaryConfig::getEntityDescriptionSettings ( const DtEntityType &  entityType,
std::vector< DtEntityTypeField > &  fields 
) const
virtual

Get the entity type description settings for a specific entity type.

Parameters
entityTypeThe entity type to look up
fieldsVector of entity type fields that should be concatenated to form the description.
Returns
true if a matching entry or default was found, false otherwise
virtual bool DtEnumDictionaryConfig::getEntityDescriptionSettings ( const DtString &  entityTypeStr,
std::vector< DtEntityTypeField > &  fields 
) const
virtual

Get the entity type description settings for a specific entity type by string.

Parameters
entityTypeStrEntity type in format "1:2:3:4:5:6:7" or "1.2.3.4.5.6.7"
fieldsVector of entity type fields that should be concatenated to form the description.
Returns
true if a matching entry or default was found, false otherwise
virtual bool DtEnumDictionaryConfig::loadConfigFile ( const DtFilename &  filename)
virtual

Load configuration from JSON file.

Parameters
filenamePath to JSON configuration file
Returns
true if successful, false on error
DtEnumDictionaryConfig& DtEnumDictionaryConfig::operator= ( const DtEnumDictionaryConfig &  orig)

Assignment operator.

virtual bool DtEnumDictionaryConfig::parseEntityTypeField ( const std::string &  fieldStr,
DtEntityTypeField &  field 
) const
protectedvirtual

Parse a field name string into a DtEntityTypeField enum value.

Parameters
fieldStrField name string (e.g. "kind", "domain", "country", etc.)
fieldOutput field enum value
Returns
true if the string mapped to a known field
virtual bool DtEnumDictionaryConfig::parseJsonArray ( const std::string &  arrayStr,
std::vector< DtEntityTypeField > &  fields 
) const
protectedvirtual

Parse a JSON array of field name strings into a vector of DtEntityTypeField values.

Parameters
arrayStrJSON array string like ["kind", "domain"]
fieldsOutput vector to receive the parsed field values
Returns
true if at least one valid field was parsed
virtual bool DtEnumDictionaryConfig::parseJsonContent ( const std::string &  jsonContent)
protectedvirtual

Parse JSON content from string.

Parameters
jsonContentThe JSON content as string
Returns
true if successful, false on error
virtual bool DtEnumDictionaryConfig::readFileContent ( const DtFilename &  filename,
std::string &  content 
)
protectedvirtual

Read file content into string.

Parameters
filenamePath to file
contentOutput string to receive file content
Returns
true if successful, false on error
virtual size_t DtEnumDictionaryConfig::size ( ) const
virtual

Get the number of configured entity types.

std::string DtEnumDictionaryConfig::trim ( const std::string &  str) const
protected

Member Data Documentation

std::vector<DtEntityTypeField> DtEnumDictionaryConfig::myDefaultFields
protected

Default field settings, used when no entity-specific entry matches.

std::map<DtEntityType, std::vector<DtEntityTypeField> > DtEnumDictionaryConfig::myEntityConfigMap
protected

Map of entity types to their associated entity type field settings.


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

Document ID: Generated on Mon Sep 28 00:09:32 EDT 2026 from SVN revision 295353
Copyright © 1992-2025 MAK Technologies. All Rights Reserved (www.mak.com)