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
This commit is contained in:
parent
daf9536bed
commit
f5145f36ed
19 changed files with 380 additions and 32 deletions
|
|
@ -1,13 +1,17 @@
|
|||
#include "DefaultConfigs.h"
|
||||
#include "IndentationConfig.h"
|
||||
#include "LanguageConfig.h"
|
||||
#include "NameManglingRules.h"
|
||||
#include "StructureTemplate.h"
|
||||
#include "TypeMappings.h"
|
||||
#include "Pgsql_oids.h"
|
||||
|
||||
using namespace Pgsql;
|
||||
|
||||
TypeMappings GetDefaultCppTypeMappings()
|
||||
std::shared_ptr<const TypeMappings> GetDefaultCppTypeMappings()
|
||||
{
|
||||
TypeMappings result = {
|
||||
auto tm = std::make_shared<TypeMappings>();
|
||||
*tm = {
|
||||
{ bool_oid, "bool" },
|
||||
{ char_oid, "char" },
|
||||
{ name_oid, "std::string" },
|
||||
|
|
@ -19,13 +23,27 @@ TypeMappings GetDefaultCppTypeMappings()
|
|||
{ float4_oid, "float" },
|
||||
{ float8_oid, "double" }
|
||||
};
|
||||
return result;
|
||||
tm->setDefaultStringType("std::string");
|
||||
tm->setDefaultContainerType("std::vector<%1>");
|
||||
return tm;
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<LanguageConfig> buildDefaultCppLanguageConfig()
|
||||
{
|
||||
return std::make_shared<LanguageConfig>();
|
||||
auto config = std::make_shared<LanguageConfig>();
|
||||
config->setTypeMappings(GetDefaultCppTypeMappings());
|
||||
config->setNameManglingRules(std::make_shared<NameManglingRules>());
|
||||
|
||||
auto st_templ = std::make_shared<StructureTemplate>();
|
||||
st_templ->m_startTemplate = "class /%structname%/ {\npublic:\n";
|
||||
st_templ->m_endTemplate = "};\n"; // };
|
||||
st_templ->m_fieldTemplate = "/%typename%/ /%varname%/;";
|
||||
//st_templ->m_fieldSeparator;
|
||||
config->setStructureTemplate(st_templ);
|
||||
config->setIndentationConfig(std::make_shared<IndentationConfig>());
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
std::shared_ptr<const LanguageConfig> getDefaultCppLanguageConfig()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue