ICF 3.0.5.47
Technical documentation of ICF Libraries
ipackage::CRegistryCodeSaverComp Class Reference

Save registry as C++ code (it generates C++ class with the same functionality) and/or dependencies list. More...

#include <CRegistryCodeSaverComp.h>

Inheritance diagram for ipackage::CRegistryCodeSaverComp:
Collaboration diagram for ipackage::CRegistryCodeSaverComp:

Public Types

enum  MessageId { MI_UNDEFINED_PACKAGE = 0x341f0 , MI_UNDEFINED_COMPONENT , MI_UNDEFINED_ATTR_TYPE , MI_UNKNOWN_PACKAGE }
 
enum  WorkingMode { WM_SOURCES , WM_DEPS_SIMPLE , WM_DEPS_ALL }
 
typedef ilog::CLoggerComponentBase BaseClass
 
- Public Types inherited from ilog::TLoggerCompWrap< Base >
enum  MessageId { MI_BAD_DEPENDENCY = 0x8a340 }
 
typedef Base BaseClass
 
typedef ilog::CLoggerBase BaseClass2
 
- Public Types inherited from ifile::IFilePersistence
enum  ErrorType { ET_NO_WRITE_PERMISSIONS , ET_NO_READ_PERMISSIONS , ET_FILE_NOT_EXIST }
 Possible file I/O errors. More...
 
enum  MessageId {
  MI_BAD_OBJECT_TYPE = 0xabf0 , MI_CANNOT_LOAD , MI_CANNOT_SAVE , MI_BAD_EXTENSION ,
  MI_FILE_NOT_EXIST , MI_UNSUPPORTED_VERSION
}
 List of possible message IDs used in context of this interface. More...
 
- Public Types inherited from ifile::IFileTypeInfo
enum  QueryFlags {
  QF_LOAD = 1 << 0 , QF_SAVE = 1 << 1 , QF_FILE = 1 << 2 , QF_DIRECTORY = 1 << 3 ,
  QF_ANONYMOUS = 1 << 4
}
 Describe detailed options of query. More...
 

Public Member Functions

 CRegistryCodeSaverComp ()
 
bool IsOperationSupported (const istd::IChangeable *dataObjectPtr, const QString *filePathPtr=nullptr, int flags=-1, bool beQuiet=true) const override
 Returns true if object dataObject can be loaded/saved.
 
iproc::CTaskState LoadFromFile (istd::IChangeable &data, const QString &filePath=QString(), iproc::IProgressManager *progressManagerPtr=nullptr) const override
 This function loads data data from file filePath.
 
iproc::CTaskState SaveToFile (const istd::IChangeable &data, const QString &filePath=QString(), iproc::IProgressManager *progressManagerPtr=nullptr) const override
 This function saves data data to file filePath.
 
bool GetFileExtensions (QStringList &result, const istd::IChangeable *dataObjectPtr=nullptr, int flags=-1, bool doAppend=false) const override
 Get file extensions supported by this loader.
 
QString GetTypeDescription (const QString *extensionPtr=nullptr) const override
 Get description of object type associated with single extension.
 
- Public Member Functions inherited from ilog::CLoggerBase
 CLoggerBase ()
 
const QByteArray & GetVerboseSenderId () const
 Get sender ID for verbose messages.
 
void SetVerboseSenderId (const QByteArray &id)
 Set sender ID for verbose messages.
 
void SetLogPtr (ilog::IMessageConsumer *logPtr) override
 Install log.
 
ilog::IMessageConsumerGetLogPtr () const override
 Get log.
 
- Public Member Functions inherited from ilog::ILoggable
- Public Member Functions inherited from ifile::IFilePersistence
- Public Member Functions inherited from ifile::IFileTypeInfo

Protected Types

typedef QSet< icomp::CComponentAddressAddresses
 
typedef QSet< QByteArray > Ids
 

Protected Member Functions

bool AppendAddresses (const icomp::IRegistry &registry, const QStringList &registryPath, Addresses &realAddresses, Addresses &composedAddresses) const
 Get component addresses used by given registry and its elements (recursively).
 
Ids ExtractPackageIds (const Addresses &addresses) const
 
Ids ExtractComponentIds (const Addresses &addresses, const QByteArray &packageId) const
 
bool WriteHeader (const QByteArray &className, const icomp::IRegistry &registry, const Addresses &composedAddresses, const Addresses &realAddresses, QTextStream &stream) const
 
bool WriteIncludes (const QByteArray &className, const Addresses &addresses, QTextStream &stream) const
 
bool WriteClassDefinitions (const QByteArray &className, const icomp::IRegistry &registry, const Addresses &composedAddresses, const Addresses &realAddresses, QTextStream &stream) const
 
bool WriteDependencies (const Addresses &composedAddresses, const Addresses &realAddresses, bool singleLine, QTextStream &stream, const QDir *relativeDirPtr=nullptr) const
 
bool WriteRegistryInfo (const icomp::IRegistry &registry, const QByteArray &registryCallPrefix, QTextStream &stream) const
 
bool WriteComponentInfo (const icomp::IRegistry &registry, const QByteArray &registryCallPrefix, const QByteArray &elementName, const icomp::IRegistry::ElementInfo &componentInfo, QTextStream &stream) const
 
bool WriteAttribute (const QByteArray &attributeId, const QByteArray &componentId, const QByteArray &attributeName, const iser::IObject &attribute, QTextStream &stream) const
 
bool WriteRegistryTranslation (int level, const QByteArray &elementPath, const icomp::IRegistry &registry, bool &translationFound, QSet< icomp::CComponentAddress > &processedComponents, QTextStream &stream) const
 Write translation macro of all string attributes from registry.
 
bool WriteComponentTranslation (int level, const QByteArray &elementPath, const icomp::IRegistry::ElementInfo &componentInfo, bool &translationFound, QTextStream &stream) const
 Write translation macro of all string attributes from component.
 
bool WriteRegistryClassDeclaration (const QByteArray &baseClassName, const QByteArray &registryClassName, const icomp::IRegistry &registry, QTextStream &stream) const
 
bool WriteRegistryClassBody (const QByteArray &baseClassName, const QByteArray &registryClassName, const icomp::IRegistry &registry, QTextStream &stream) const
 
bool WriteDeserializingCode (const iser::ISerializable &object, QTextStream &stream) const
 Write code deserializing some object from data buffer.
 
bool GetAttributeValue (const iser::ISerializable &attribute, QByteArray &valueString, QByteArray &typeName) const
 
bool GetMultiAttributeValue (const iser::ISerializable &attribute, QList< QByteArray > &valueStrings, QByteArray &typeName) const
 
bool NextLine (QTextStream &stream) const
 Insert a new line and indentation tabs.
 
int ChangeIndent (int difference) const
 
bool ExtractInfoFromFile (const QString &filePath, QByteArray &className, QString &baseFilePath) const
 Extract class name and absolute header path from a file name.
 
QByteArray GetPackageName (const QByteArray &packageId) const
 Ensure that a package name ends with 'Pck'.
 
QByteArray GetStringLiteral (const QString &text) const
 Get some wide string as C++ string literal.
 
QByteArray GetIdValueLiteral (const QByteArray &text) const
 Get some string as C++ string literal.
 
QByteArray GetValidIdentifier (const QByteArray &identifier) const
 Get valid C++ identifier (used for variable names) from arbitrary string.
 
- Protected Member Functions inherited from ilog::TLoggerCompWrap< Base >
virtual void DecorateMessage (istd::IInformationProvider::InformationCategory category, int id, int flags, QString &message, QString &messageSource) const override
 Decorate message parts before outputting.
 
void OnComponentCreated () override
 
void OnComponentDestroyed () override
 
- Protected Member Functions inherited from ilog::CLoggerBase
bool IsVerboseEnabled () const
 Check if verbose messages are enabled.
 
bool SendVerboseMessage (const QString &message, const QString &messageSource=QString()) const
 Send verbose message.
 
bool SendInfoMessage (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send info message to log.
 
bool SendWarningMessage (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send warning message to log.
 
bool SendErrorMessage (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send error message to log.
 
bool SendCriticalMessage (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send critical message to log.
 
bool SendInfoMessageOnce (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send once info message to log.
 
bool SendWarningMessageOnce (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send once warning message to log.
 
bool SendErrorMessageOnce (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send once error message to log.
 
bool SendCriticalMessageOnce (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send once critical message to log.
 
bool SendUserMessage (const istd::IInformationProvider *messagePtr) const
 Send message with user object.
 
bool AllowMessageOnceAgain (int id)
 Reset message lock.
 
bool IsLogConsumed (const istd::IInformationProvider::InformationCategory *categoryPtr=nullptr, const int *flagsPtr=nullptr) const override
 Check if any log message is consumed.
 
bool SendLogMessage (istd::IInformationProvider::InformationCategory category, int id, const QString &message, const QString &messageSource, int flags=0) const override
 Send any message to log.
 
- Protected Member Functions inherited from istd::ILogger

Static Protected Member Functions

static QList< QByteArray > GetSortedIds (const Ids &ids)
 

Additional Inherited Members

- Protected Attributes inherited from ilog::CLoggerBase
QSet< int > m_onceMessageIds
 

Detailed Description

Save registry as C++ code (it generates C++ class with the same functionality) and/or dependencies list.

Definition at line 33 of file CRegistryCodeSaverComp.h.

Member Typedef Documentation

◆ Addresses

◆ BaseClass

◆ Ids

QSet<QByteArray> ipackage::CRegistryCodeSaverComp::Ids
protected

Definition at line 100 of file CRegistryCodeSaverComp.h.

Member Enumeration Documentation

◆ MessageId

Enumerator
MI_UNDEFINED_PACKAGE 
MI_UNDEFINED_COMPONENT 
MI_UNDEFINED_ATTR_TYPE 
MI_UNKNOWN_PACKAGE 

Definition at line 40 of file CRegistryCodeSaverComp.h.

◆ WorkingMode

Enumerator
WM_SOURCES 

Generation of sources.

WM_DEPS_SIMPLE 

Generation of dependencies to base ICF files (registries and configurations).

WM_DEPS_ALL 

Generation of dependencies to all related ICF files.

Definition at line 48 of file CRegistryCodeSaverComp.h.

Constructor & Destructor Documentation

◆ CRegistryCodeSaverComp()

ipackage::CRegistryCodeSaverComp::CRegistryCodeSaverComp ( )

Member Function Documentation

◆ AppendAddresses()

bool ipackage::CRegistryCodeSaverComp::AppendAddresses ( const icomp::IRegistry & registry,
const QStringList & registryPath,
Addresses & realAddresses,
Addresses & composedAddresses ) const
protected

Get component addresses used by given registry and its elements (recursively).

◆ ChangeIndent()

int ipackage::CRegistryCodeSaverComp::ChangeIndent ( int difference) const
protected

◆ ExtractComponentIds()

Ids ipackage::CRegistryCodeSaverComp::ExtractComponentIds ( const Addresses & addresses,
const QByteArray & packageId ) const
protected

◆ ExtractInfoFromFile()

bool ipackage::CRegistryCodeSaverComp::ExtractInfoFromFile ( const QString & filePath,
QByteArray & className,
QString & baseFilePath ) const
protected

Extract class name and absolute header path from a file name.

◆ ExtractPackageIds()

Ids ipackage::CRegistryCodeSaverComp::ExtractPackageIds ( const Addresses & addresses) const
protected

◆ GetAttributeValue()

bool ipackage::CRegistryCodeSaverComp::GetAttributeValue ( const iser::ISerializable & attribute,
QByteArray & valueString,
QByteArray & typeName ) const
protected

◆ GetFileExtensions()

bool ipackage::CRegistryCodeSaverComp::GetFileExtensions ( QStringList & result,
const istd::IChangeable * dataObjectPtr = nullptr,
int flags = -1,
bool doAppend = false ) const
overridevirtual

Get file extensions supported by this loader.

Parameters
resultlist of extensions, e.g. {"txt", "doc"}.
dataObjectPtroptional pointer to data object for which all possible extensions are requested. It can be nullptr if any object is meant.
flagsset of flags
See also
QueryFlags.
Parameters
doAppendif true, list of extensions should be appended to existing list.

Implements ifile::IFileTypeInfo.

◆ GetIdValueLiteral()

QByteArray ipackage::CRegistryCodeSaverComp::GetIdValueLiteral ( const QByteArray & text) const
protected

Get some string as C++ string literal.

◆ GetMultiAttributeValue()

bool ipackage::CRegistryCodeSaverComp::GetMultiAttributeValue ( const iser::ISerializable & attribute,
QList< QByteArray > & valueStrings,
QByteArray & typeName ) const
protected

◆ GetPackageName()

QByteArray ipackage::CRegistryCodeSaverComp::GetPackageName ( const QByteArray & packageId) const
protected

Ensure that a package name ends with 'Pck'.

◆ GetSortedIds()

static QList< QByteArray > ipackage::CRegistryCodeSaverComp::GetSortedIds ( const Ids & ids)
staticprotected

◆ GetStringLiteral()

QByteArray ipackage::CRegistryCodeSaverComp::GetStringLiteral ( const QString & text) const
protected

Get some wide string as C++ string literal.

◆ GetTypeDescription()

QString ipackage::CRegistryCodeSaverComp::GetTypeDescription ( const QString * extensionPtr = nullptr) const
overridevirtual

Get description of object type associated with single extension.

Implements ifile::IFileTypeInfo.

◆ GetValidIdentifier()

QByteArray ipackage::CRegistryCodeSaverComp::GetValidIdentifier ( const QByteArray & identifier) const
protected

Get valid C++ identifier (used for variable names) from arbitrary string.

◆ IsOperationSupported()

bool ipackage::CRegistryCodeSaverComp::IsOperationSupported ( const istd::IChangeable * dataObjectPtr,
const QString * filePathPtr = nullptr,
int flags = -1,
bool beQuiet = true ) const
overridevirtual

Returns true if object dataObject can be loaded/saved.

Parameters
dataObjectPtroptional pointer to data object should be loaded/stored. It can be nullptr if any object is meant.
filePathPtroptional pointer to file should be loaded/stored. It can be nullptr if any file is meant. If it points at empty string, anonymous loading is mean.
flagscombination of flags defined in QueryFlags and ifile::IFileTypeInfo::QueryFlags.
beQuietif true, no user message output is allowed.

Implements ifile::IFilePersistence.

◆ LoadFromFile()

iproc::CTaskState ipackage::CRegistryCodeSaverComp::LoadFromFile ( istd::IChangeable & data,
const QString & filePath = QString(),
iproc::IProgressManager * progressManagerPtr = nullptr ) const
overridevirtual

This function loads data data from file filePath.

Returns
File loading state.
See also
Status

Implements ifile::IFilePersistence.

◆ NextLine()

bool ipackage::CRegistryCodeSaverComp::NextLine ( QTextStream & stream) const
protected

Insert a new line and indentation tabs.

◆ SaveToFile()

iproc::CTaskState ipackage::CRegistryCodeSaverComp::SaveToFile ( const istd::IChangeable & data,
const QString & filePath = QString(),
iproc::IProgressManager * progressManagerPtr = nullptr ) const
overridevirtual

This function saves data data to file filePath.

Returns
File saving state.
See also
Status

Implements ifile::IFilePersistence.

◆ WriteAttribute()

bool ipackage::CRegistryCodeSaverComp::WriteAttribute ( const QByteArray & attributeId,
const QByteArray & componentId,
const QByteArray & attributeName,
const iser::IObject & attribute,
QTextStream & stream ) const
protected

◆ WriteClassDefinitions()

bool ipackage::CRegistryCodeSaverComp::WriteClassDefinitions ( const QByteArray & className,
const icomp::IRegistry & registry,
const Addresses & composedAddresses,
const Addresses & realAddresses,
QTextStream & stream ) const
protected

◆ WriteComponentInfo()

bool ipackage::CRegistryCodeSaverComp::WriteComponentInfo ( const icomp::IRegistry & registry,
const QByteArray & registryCallPrefix,
const QByteArray & elementName,
const icomp::IRegistry::ElementInfo & componentInfo,
QTextStream & stream ) const
protected

◆ WriteComponentTranslation()

bool ipackage::CRegistryCodeSaverComp::WriteComponentTranslation ( int level,
const QByteArray & elementPath,
const icomp::IRegistry::ElementInfo & componentInfo,
bool & translationFound,
QTextStream & stream ) const
protected

Write translation macro of all string attributes from component.

◆ WriteDependencies()

bool ipackage::CRegistryCodeSaverComp::WriteDependencies ( const Addresses & composedAddresses,
const Addresses & realAddresses,
bool singleLine,
QTextStream & stream,
const QDir * relativeDirPtr = nullptr ) const
protected

◆ WriteDeserializingCode()

bool ipackage::CRegistryCodeSaverComp::WriteDeserializingCode ( const iser::ISerializable & object,
QTextStream & stream ) const
protected

Write code deserializing some object from data buffer.

◆ WriteHeader()

bool ipackage::CRegistryCodeSaverComp::WriteHeader ( const QByteArray & className,
const icomp::IRegistry & registry,
const Addresses & composedAddresses,
const Addresses & realAddresses,
QTextStream & stream ) const
protected

◆ WriteIncludes()

bool ipackage::CRegistryCodeSaverComp::WriteIncludes ( const QByteArray & className,
const Addresses & addresses,
QTextStream & stream ) const
protected

◆ WriteRegistryClassBody()

bool ipackage::CRegistryCodeSaverComp::WriteRegistryClassBody ( const QByteArray & baseClassName,
const QByteArray & registryClassName,
const icomp::IRegistry & registry,
QTextStream & stream ) const
protected

◆ WriteRegistryClassDeclaration()

bool ipackage::CRegistryCodeSaverComp::WriteRegistryClassDeclaration ( const QByteArray & baseClassName,
const QByteArray & registryClassName,
const icomp::IRegistry & registry,
QTextStream & stream ) const
protected

◆ WriteRegistryInfo()

bool ipackage::CRegistryCodeSaverComp::WriteRegistryInfo ( const icomp::IRegistry & registry,
const QByteArray & registryCallPrefix,
QTextStream & stream ) const
protected

◆ WriteRegistryTranslation()

bool ipackage::CRegistryCodeSaverComp::WriteRegistryTranslation ( int level,
const QByteArray & elementPath,
const icomp::IRegistry & registry,
bool & translationFound,
QSet< icomp::CComponentAddress > & processedComponents,
QTextStream & stream ) const
protected

Write translation macro of all string attributes from registry.


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

© Witold Gantzke and Kirill Lepskiy