Poco::CodeGeneration

class Utility

File Information

Library: CodeGeneration
Package: CodeGeneration
Header: Poco/CodeGeneration/Utility.h

Description

Constants and utility functions for code generation.

Member Summary

Member Functions: createFiles, createInclude, createIncludeGuard, extractTemplateFromClassDecl, handleBaseClassesInclude, handleInclude, handleSrcInclude, hasAnyRemoteProperty, resolveParamDecl, resolveType, resolveTypeImpl, writeAccess, writeAttributes, writeClassDeclaration, writeDocumentation, writeInclude, writeIncludeGuard, writeLines, writeNameSpaceBegin, writeNameSpaceEnd, writeStdHeader

Constructors

Destructor

~Utility protected

~Utility();

Member Functions

createFiles static

static void createFiles(
    const std::string & fileNameCore,
    std::ofstream & hFile,
    std::ofstream & cppFile
);

Takes the fileNameCore (name without extension), appends HFILEEXTENSION, and CPPFILEEXTENSION, and opens both files In case of an error an exception is thrown

createInclude static

static std::string createInclude(
    const Poco::CppParser::Struct * pStruct,
    bool usePocoIncludes
);

Creates an include path for the given struct.

createInclude static

static std::string createInclude(
    const std::string & filePath,
    bool flatInclude
);

Creates an include path for the given filePath.

createIncludeGuard static

static std::string createIncludeGuard(
    const std::string & libraryName,
    const std::string & fileName
);

Creates an include guard found at the very beginning of the h file.

extractTemplateFromClassDecl static

static std::string extractTemplateFromClassDecl(
    const Poco::CppParser::Struct * pStruct
);

Extracts the template name from the class.

handleBaseClassesInclude static

static void handleBaseClassesInclude(
    const Poco::CppParser::Struct * pStruct,
    CodeGenerator & gen
);

Includes all files for the parents

handleInclude static

static void handleInclude(
    const Poco::CppParser::Struct * pStruct,
    CodeGenerator & gen
);

Takes the absolute/relative file path from the struct as input and converts it to an include dir

handleSrcInclude static

static void handleSrcInclude(
    const Poco::CppParser::Struct * pStruct,
    CodeGenerator & gen
);

Takes the absolute/relative file path from the struct as input and converts it to an include dir

hasAnyRemoteProperty static

static bool hasAnyRemoteProperty(
    const Poco::CppParser::Struct * pStruct
);

Checks if a class or a single PUBLIC method of it has remote properties.

resolveParamDecl static

static std::string resolveParamDecl(
    const Poco::CppParser::NameSpace * pNS,
    const Poco::CppParser::Parameter * pSym
);

Returns the declaration of a parameter with resolved types.

resolveType static

static std::string resolveType(
    const Poco::CppParser::NameSpace * pSym,
    const std::string & name
);

Resolves types by appending namespaces to them

resolveTypeImpl static

static std::string resolveTypeImpl(
    const Poco::CppParser::NameSpace * pSym,
    const std::string & name
);

Resolves types by appending namespaces to them

writeAccess static

static void writeAccess(
    std::ostream & ostr,
    Poco::CppParser::Symbol::Access acc
);

Writes string version of the Access.

writeAttributes static

static void writeAttributes(
    std::ostream & out,
    const Poco::CppParser::Attributes & attrs,
    int indent
);

writeClassDeclaration static

static void writeClassDeclaration(
    std::ostream & ostr,
    const std::string & libName,
    const std::string & className
);

Writes a class declaration. Do not use for templates!

writeClassDeclaration static

static void writeClassDeclaration(
    std::ostream & ostr,
    const std::string & libName,
    const Poco::CppParser::Struct * pStruct,
    bool enableAttributes = false
);

Writes a class declaration. Works for templates.

writeDocumentation static

static void writeDocumentation(
    std::ostream & out,
    const std::string & docu,
    int indent
);

writeInclude static

static void writeInclude(
    std::ostream & ostr,
    const std::string & libraryName,
    const std::string & fileName
);

Writes an include.

writeIncludeGuard static

static void writeIncludeGuard(
    std::ostream & ostr,
    const std::string & libraryName,
    const std::string & fileName
);

Writes an includeguard: ie. #ifndef xy #define xy

writeLines static

static void writeLines(
    std::ostream & ostr,
    const std::vector < std::string > & lines,
    bool appendNewLine
);

Writes code lines to the output stream.

writeNameSpaceBegin static

static void writeNameSpaceBegin(
    std::ostream & out,
    const std::string & nameSpace
);

Starts the namespace

writeNameSpaceEnd static

static void writeNameSpaceEnd(
    std::ostream & out,
    const std::string & nameSpace
);

Ends the namespace

writeStdHeader static

static void writeStdHeader(
    std::ostream & ostr,
    const std::string & fileName,
    const std::string & libraryName,
    const std::string & packageName,
    const std::string & moduleName,
    const std::string & copyright,
    bool writeTimestamp = true
);

Variables

ACTION static

static const std::string ACTION;

AUTHENTICATED static

static const std::string AUTHENTICATED;

CACHEEXPIRETIME static

static const std::string CACHEEXPIRETIME;

CACHING static

static const std::string CACHING;

CLASS static

static const std::string CLASS;

CONSUMES static

static const std::string CONSUMES;

CONTENT_TYPE static

static const std::string CONTENT_TYPE;

CPPFILEEXTENSION static

static const std::string CPPFILEEXTENSION;

DIRECTION static

static const std::string DIRECTION;

FAULT static

static const std::string FAULT;

FILTER static

static const std::string FILTER;

FORMAT static

static const std::string FORMAT;

GENERATED static

static const std::string GENERATED;

HEADER static

static const std::string HEADER;

HFILEEXTENSION static

static const std::string HFILEEXTENSION;

IN static

static const std::string IN;

LENGTH static

static const std::string LENGTH;

MANDATORY static

static const std::string MANDATORY;

NAME static

static const std::string NAME;

NAMESPACE static

static const std::string NAMESPACE;

ONEWAY static

static const std::string ONEWAY;

OPTIONAL static

static const std::string OPTIONAL;

ORDER static

static const std::string ORDER;

PATH static

static const std::string PATH;

PERMISSION static

static const std::string PERMISSION;

PRIVATE static

static const std::string PRIVATE;

PRODUCES static

static const std::string PRODUCES;

PROPERTYEND static

static const std::string PROPERTYEND;

PROPERTYENDELEM static

static const std::string PROPERTYENDELEM;

PROPERTYSTART static

static const std::string PROPERTYSTART;

PROPERTYSTARTELEM static

static const std::string PROPERTYSTARTELEM;

PROTECTED static

static const std::string PROTECTED;

PUBLIC static

static const std::string PUBLIC;

REMOTE static

static const std::string REMOTE;

REPLY static

static const std::string REPLY;

REQUEST static

static const std::string REQUEST;

RETURN static

static const std::string RETURN;

SERIALIZE static

static const std::string SERIALIZE;

STATIC static

static const std::string STATIC;

SYNCHRONIZED static

static const std::string SYNCHRONIZED;

TYPE static

static const std::string TYPE;

TYPE_VOID static

static const std::string TYPE_VOID;

VAL_ASSIGNMENT static

static const std::string VAL_ASSIGNMENT;

VAL_ATTR static

static const std::string VAL_ATTR;

VAL_ELEM static

static const std::string VAL_ELEM;

VAL_FALSE static

static const std::string VAL_FALSE;

VAL_INFINITE static

static const std::string VAL_INFINITE;

VAL_SEPARATOR static

static const std::string VAL_SEPARATOR;

VAL_TRUE static

static const std::string VAL_TRUE;

VIRTUAL static

static const std::string VIRTUAL;

Securely control IoT edge devices from anywhere   Connect a Device