pgLab/pglablib/codebuilder/LanguageConfig.h
eelke f5145f36ed wip: codegenerator, basic widget present for showing the generated code and specifying
parameters. Some code is also generated but it is not complete yet.

minimum still required
- field assignments
- properly format and escape the query string
2018-09-18 11:54:43 +02:00

69 lines
1.6 KiB
C++

#ifndef LANGUAGECONFIG_H
#define LANGUAGECONFIG_H
#include <QString>
#include "Pgsql_oids.h"
class NameManglingRules;
class TypeMappings;
class StructureTemplate;
class IndentationConfig;
/**
*
*/
class LanguageConfig {
public:
LanguageConfig();
QString columnNameToFieldName(const QString& column_name) const;
QString getTypeName(Oid dbtype) const;
void setNameManglingRules(std::shared_ptr<const NameManglingRules> name_mangling_rules)
{
m_varNaming = name_mangling_rules;
}
std::shared_ptr<const TypeMappings> typeMappings() const { return m_typeMappings; }
void setTypeMappings(std::shared_ptr<const TypeMappings> type_mappings)
{
m_typeMappings = type_mappings;
}
std::shared_ptr<const StructureTemplate> structureTemplate() const
{
return m_structureTemplate;
}
void setStructureTemplate(std::shared_ptr<const StructureTemplate> structure_template)
{
m_structureTemplate = structure_template;
}
std::shared_ptr<const IndentationConfig> indentationConfig() const
{
return m_indentationConfig;
}
void setIndentationConfig(std::shared_ptr<const IndentationConfig> indentation_config)
{
m_indentationConfig = indentation_config;
}
private:
/** Default template for declaring a variable of the correct type.
* exmaple: "{$type} {$varname};"
*/
//QString varDeclTemplate;
std::shared_ptr<const NameManglingRules> m_varNaming;
std::shared_ptr<const TypeMappings> m_typeMappings;
std::shared_ptr<const StructureTemplate> m_structureTemplate;
std::shared_ptr<const IndentationConfig> m_indentationConfig;
enum class VariableStrategy {
UseLocalVariables,
DeclareClass
};
};
#endif // LANGUAGECONFIG_H