Public Types | Public Member Functions | Protected Types | Protected Member Functions | List of all members
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:
ilog::TLoggerCompWrap< Base > ifile::IFilePersistence ilog::CLoggerBase ifile::IFileTypeInfo ilog::ILoggable istd::ILogger istd::IPolymorphic istd::IPolymorphic istd::IPolymorphic

Public Types

enum  MessageId { MI_UNDEFINED_PACKAGE = 0x341f0, MI_UNDEFINED_COMPONENT, MI_UNDEFINED_ATTR_TYPE, MI_UNKNOWN_PACKAGE }
 
enum  WorkingMode { WM_SOURCES, WM_DEPENDENCIES }
 
typedef ilog::CLoggerComponentBase BaseClass
 
- Public Types inherited from ilog::TLoggerCompWrap< Base >
typedef Base BaseClass
 
typedef ilog::CLoggerBase BaseClass2
 
- Public Types inherited from ifile::IFilePersistence
enum  OperationState { OS_OK, OS_CANCELED, OS_FAILED }
 Result of operation. More...
 
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 ()
 
virtual bool IsOperationSupported (const istd::IChangeable *dataObjectPtr, const QString *filePathPtr=NULL, int flags=-1, bool beQuiet=true) const
 Returns true if object dataObject can be loaded/saved. More...
 
virtual int LoadFromFile (istd::IChangeable &data, const QString &filePath=QString(), ibase::IProgressManager *progressManagerPtr=NULL) const
 This function loads data data from file filePath. More...
 
virtual int SaveToFile (const istd::IChangeable &data, const QString &filePath=QString(), ibase::IProgressManager *progressManagerPtr=NULL) const
 This function saves data data to file filePath. More...
 
virtual bool GetFileExtensions (QStringList &result, const istd::IChangeable *dataObjectPtr=NULL, int flags=-1, bool doAppend=false) const
 Get file extensions supported by this loader. More...
 
virtual QString GetTypeDescription (const QString *extensionPtr=NULL) const
 Get description of object type associated with single extension. More...
 
- Public Member Functions inherited from ilog::CLoggerBase
 CLoggerBase ()
 
virtual void SetLogPtr (ilog::IMessageConsumer *logPtr)
 Install log. More...
 
virtual ilog::IMessageConsumerGetLogPtr () const
 Get log. More...
 
virtual void SetTracingEnabled (bool trace)
 Enable/disable tracing. More...
 
virtual bool IsTracingEnabled () const
 Returns true if tracing enabled. More...
 
- Public Member Functions inherited from istd::IPolymorphic
virtual ~IPolymorphic ()
 

Protected Types

typedef QSet
< icomp::CComponentAddress
Addresses
 
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). More...
 
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, QTextStream &stream) const
 
bool WriteRegistryInfo (const icomp::IRegistry &registry, const QByteArray &registryCallPrefix, QTextStream &stream) const
 
bool WriteComponentInfo (const icomp::IRegistry &registry, const QByteArray &registryCallPrefix, const QByteArray &componentId, 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 (const icomp::IRegistry &registry, bool &translationFound, QTextStream &stream) const
 Write translation macro of all string attributes from registry. More...
 
bool WritePackagesTranslation (int level, bool &translationFound, QTextStream &stream) const
 Write translation macro of all string attributes from packages till some level of package depth. More...
 
bool WriteComponentTranslation (const QByteArray &componentId, const icomp::IRegistry::ElementInfo &componentInfo, bool &translationFound, QTextStream &stream) const
 Write translation macro of all string attributes from component. More...
 
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. More...
 
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. More...
 
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. More...
 
QByteArray GetPackageName (const QByteArray &packageId) const
 Ensure that a package name ends with 'Pck'. More...
 
QByteArray GetStringLiteral (const QString &text) const
 Get some wide string as C++ string literal. More...
 
QByteArray GetIdValueLiteral (const QByteArray &text) const
 Get some string as C++ string literal. More...
 
QByteArray GetValidIdentifier (const QByteArray &identifier) const
 Get valid C++ identifier (used for variable names) from arbitrary string. More...
 
- Protected Member Functions inherited from ilog::TLoggerCompWrap< Base >
bool IsVerboseEnabled () const
 Check if verbose messages are enabled. More...
 
void SendVerboseMessage (const QString &message, const QString &messageSource=QString()) const
 Send verbose message. More...
 
virtual void DecorateMessage (istd::IInformationProvider::InformationCategory category, int id, int flags, QString &message, QString &messageSource) const
 Decorate message parts before outputting. More...
 
virtual void OnComponentCreated ()
 
virtual void OnComponentDestroyed ()
 
- Protected Member Functions inherited from ilog::CLoggerBase
bool SendInfoMessage (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send info message to log. More...
 
bool SendWarningMessage (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send warning message to log. More...
 
bool SendErrorMessage (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send error message to log. More...
 
bool SendCriticalMessage (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send critical message to log. More...
 
bool SendInfoMessageOnce (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send once info message to log. More...
 
bool SendWarningMessageOnce (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send once warning message to log. More...
 
bool SendErrorMessageOnce (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send once error message to log. More...
 
bool SendCriticalMessageOnce (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send once critical message to log. More...
 
bool SendUserMessage (const istd::IInformationProvider *messagePtr) const
 Send message with user object. More...
 
bool AllowMessageOnceAgain (int id)
 Reset message lock. More...
 
virtual bool IsLogConsumed (const istd::IInformationProvider::InformationCategory *categoryPtr=NULL, const int *flagsPtr=NULL) const
 Check if any log message is consumed. More...
 
virtual bool SendLogMessage (istd::IInformationProvider::InformationCategory category, int id, const QString &message, const QString &messageSource, int flags=0) const
 Send any message to log. More...
 

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 28 of file CRegistryCodeSaverComp.h.

Member Typedef Documentation

Definition at line 89 of file CRegistryCodeSaverComp.h.

Definition at line 33 of file CRegistryCodeSaverComp.h.

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

Definition at line 90 of file CRegistryCodeSaverComp.h.

Member Enumeration Documentation

Enumerator
MI_UNDEFINED_PACKAGE 
MI_UNDEFINED_COMPONENT 
MI_UNDEFINED_ATTR_TYPE 
MI_UNKNOWN_PACKAGE 

Definition at line 35 of file CRegistryCodeSaverComp.h.

Enumerator
WM_SOURCES 

Generation of sources.

WM_DEPENDENCIES 

Generation of dependencies to all related ACF registry files.

Definition at line 43 of file CRegistryCodeSaverComp.h.

Constructor & Destructor Documentation

ipackage::CRegistryCodeSaverComp::CRegistryCodeSaverComp ( )

Member Function Documentation

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).

int ipackage::CRegistryCodeSaverComp::ChangeIndent ( int  difference) const
protected
Ids ipackage::CRegistryCodeSaverComp::ExtractComponentIds ( const Addresses addresses,
const QByteArray &  packageId 
) const
protected
bool ipackage::CRegistryCodeSaverComp::ExtractInfoFromFile ( const QString &  filePath,
QByteArray &  className,
QString &  baseFilePath 
) const
protected

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

Ids ipackage::CRegistryCodeSaverComp::ExtractPackageIds ( const Addresses addresses) const
protected
bool ipackage::CRegistryCodeSaverComp::GetAttributeValue ( const iser::ISerializable attribute,
QByteArray &  valueString,
QByteArray &  typeName 
) const
protected
virtual bool ipackage::CRegistryCodeSaverComp::GetFileExtensions ( QStringList &  result,
const istd::IChangeable dataObjectPtr = NULL,
int  flags = -1,
bool  doAppend = false 
) const
virtual

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 NULL 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.

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

Get some string as C++ string literal.

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

Ensure that a package name ends with 'Pck'.

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

Get some wide string as C++ string literal.

virtual QString ipackage::CRegistryCodeSaverComp::GetTypeDescription ( const QString *  extensionPtr = NULL) const
virtual

Get description of object type associated with single extension.

Implements ifile::IFileTypeInfo.

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

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

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

Returns true if object dataObject can be loaded/saved.

Parameters
dataObjectPtroptional pointer to data object should be loaded/stored. It can be NULL if any object is meant.
filePathPtroptional pointer to file should be loaded/stored. It can be NULL 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.

virtual int ipackage::CRegistryCodeSaverComp::LoadFromFile ( istd::IChangeable data,
const QString &  filePath = QString(),
ibase::IProgressManager progressManagerPtr = NULL 
) const
virtual

This function loads data data from file filePath.

Returns
File loading state.
See Also
OperationState

Implements ifile::IFilePersistence.

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

Insert a new line and indentation tabs.

virtual int ipackage::CRegistryCodeSaverComp::SaveToFile ( const istd::IChangeable data,
const QString &  filePath = QString(),
ibase::IProgressManager progressManagerPtr = NULL 
) const
virtual

This function saves data data to file filePath.

Returns
File saving state.
See Also
OperationState

Implements ifile::IFilePersistence.

bool ipackage::CRegistryCodeSaverComp::WriteAttribute ( const QByteArray &  attributeId,
const QByteArray &  componentId,
const QByteArray &  attributeName,
const iser::IObject attribute,
QTextStream &  stream 
) const
protected
bool ipackage::CRegistryCodeSaverComp::WriteClassDefinitions ( const QByteArray &  className,
const icomp::IRegistry registry,
const Addresses composedAddresses,
const Addresses realAddresses,
QTextStream &  stream 
) const
protected
bool ipackage::CRegistryCodeSaverComp::WriteComponentInfo ( const icomp::IRegistry registry,
const QByteArray &  registryCallPrefix,
const QByteArray &  componentId,
const icomp::IRegistry::ElementInfo componentInfo,
QTextStream &  stream 
) const
protected
bool ipackage::CRegistryCodeSaverComp::WriteComponentTranslation ( const QByteArray &  componentId,
const icomp::IRegistry::ElementInfo componentInfo,
bool &  translationFound,
QTextStream &  stream 
) const
protected

Write translation macro of all string attributes from component.

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

Write code deserializing some object from data buffer.

bool ipackage::CRegistryCodeSaverComp::WriteHeader ( const QByteArray &  className,
const icomp::IRegistry registry,
const Addresses composedAddresses,
const Addresses realAddresses,
QTextStream &  stream 
) const
protected
bool ipackage::CRegistryCodeSaverComp::WriteIncludes ( const QByteArray &  className,
const Addresses addresses,
QTextStream &  stream 
) const
protected
bool ipackage::CRegistryCodeSaverComp::WritePackagesTranslation ( int  level,
bool &  translationFound,
QTextStream &  stream 
) const
protected

Write translation macro of all string attributes from packages till some level of package depth.

bool ipackage::CRegistryCodeSaverComp::WriteRegistryClassBody ( const QByteArray &  baseClassName,
const QByteArray &  registryClassName,
const icomp::IRegistry registry,
QTextStream &  stream 
) const
protected
bool ipackage::CRegistryCodeSaverComp::WriteRegistryClassDeclaration ( const QByteArray &  baseClassName,
const QByteArray &  registryClassName,
const icomp::IRegistry registry,
QTextStream &  stream 
) const
protected
bool ipackage::CRegistryCodeSaverComp::WriteRegistryInfo ( const icomp::IRegistry registry,
const QByteArray &  registryCallPrefix,
QTextStream &  stream 
) const
protected
bool ipackage::CRegistryCodeSaverComp::WriteRegistryTranslation ( const icomp::IRegistry registry,
bool &  translationFound,
QTextStream &  stream 
) const
protected

Write translation macro of all string attributes from registry.


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

© 2007-2017 Witold Gantzke and Kirill Lepskiy