2018-09-09 18:52:32 +02:00
|
|
|
|
#include "DefaultConfigs.h"
|
2018-09-18 11:53:19 +02:00
|
|
|
|
#include "IndentationConfig.h"
|
2018-09-09 18:52:32 +02:00
|
|
|
|
#include "LanguageConfig.h"
|
2018-09-18 11:53:19 +02:00
|
|
|
|
#include "NameManglingRules.h"
|
|
|
|
|
|
#include "StructureTemplate.h"
|
2018-09-09 18:52:32 +02:00
|
|
|
|
#include "TypeMappings.h"
|
|
|
|
|
|
#include "Pgsql_oids.h"
|
|
|
|
|
|
|
|
|
|
|
|
using namespace Pgsql;
|
|
|
|
|
|
|
2018-09-18 11:53:19 +02:00
|
|
|
|
std::shared_ptr<const TypeMappings> GetDefaultCppTypeMappings()
|
2018-09-09 18:52:32 +02:00
|
|
|
|
{
|
2018-09-18 11:53:19 +02:00
|
|
|
|
auto tm = std::make_shared<TypeMappings>();
|
|
|
|
|
|
*tm = {
|
2018-09-09 18:52:32 +02:00
|
|
|
|
{ bool_oid, "bool" },
|
|
|
|
|
|
{ char_oid, "char" },
|
|
|
|
|
|
{ name_oid, "std::string" },
|
|
|
|
|
|
{ int8_oid, "int64_t" },
|
|
|
|
|
|
{ int2_oid, "int16_t" },
|
|
|
|
|
|
{ int4_oid, "int32_t" },
|
|
|
|
|
|
{ text_oid, "std::string" },
|
|
|
|
|
|
{ oid_oid, "Oid" },
|
|
|
|
|
|
{ float4_oid, "float" },
|
|
|
|
|
|
{ float8_oid, "double" }
|
|
|
|
|
|
};
|
2018-09-18 11:53:19 +02:00
|
|
|
|
tm->setDefaultStringType("std::string");
|
|
|
|
|
|
tm->setDefaultContainerType("std::vector<%1>");
|
|
|
|
|
|
return tm;
|
2018-09-09 18:52:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<LanguageConfig> buildDefaultCppLanguageConfig()
|
|
|
|
|
|
{
|
2018-09-18 11:53:19 +02:00
|
|
|
|
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;
|
2018-09-09 18:52:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<const LanguageConfig> getDefaultCppLanguageConfig()
|
|
|
|
|
|
{
|
|
|
|
|
|
static auto config = buildDefaultCppLanguageConfig();
|
|
|
|
|
|
return config;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<const LanguageConfig> buildPgLabCppLanguageConfig()
|
|
|
|
|
|
{
|
|
|
|
|
|
auto cfg = buildDefaultCppLanguageConfig();
|
|
|
|
|
|
|
|
|
|
|
|
return cfg;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<const LanguageConfig> getPgLabCppLanguageConfig()
|
|
|
|
|
|
{
|
|
|
|
|
|
static auto config = buildPgLabCppLanguageConfig();
|
|
|
|
|
|
return config;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|