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
~Utility();
Member Functions
createFiles
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 std::string createInclude(
const Poco::CppParser::Struct * pStruct,
bool usePocoIncludes
);
Creates an include path for the given struct.
createInclude
static std::string createInclude(
const std::string & filePath,
bool flatInclude
);
Creates an include path for the given filePath.
createIncludeGuard
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 std::string extractTemplateFromClassDecl(
const Poco::CppParser::Struct * pStruct
);
Extracts the template name from the class.
handleBaseClassesInclude
static void handleBaseClassesInclude(
const Poco::CppParser::Struct * pStruct,
CodeGenerator & gen
);
Includes all files for the parents
handleInclude
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 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 bool hasAnyRemoteProperty(
const Poco::CppParser::Struct * pStruct
);
Checks if a class or a single PUBLIC method of it has remote properties.
resolveParamDecl
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 std::string resolveType(
const Poco::CppParser::NameSpace * pSym,
const std::string & name
);
Resolves types by appending namespaces to them
resolveTypeImpl
static std::string resolveTypeImpl(
const Poco::CppParser::NameSpace * pSym,
const std::string & name
);
Resolves types by appending namespaces to them
writeAccess
static void writeAccess(
std::ostream & ostr,
Poco::CppParser::Symbol::Access acc
);
Writes string version of the Access.
writeAttributes
static void writeAttributes(
std::ostream & out,
const Poco::CppParser::Attributes & attrs,
int indent
);
writeClassDeclaration
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 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 void writeDocumentation(
std::ostream & out,
const std::string & docu,
int indent
);
writeInclude
static void writeInclude(
std::ostream & ostr,
const std::string & libraryName,
const std::string & fileName
);
Writes an include.
writeIncludeGuard
static void writeIncludeGuard(
std::ostream & ostr,
const std::string & libraryName,
const std::string & fileName
);
Writes an includeguard: ie. #ifndef xy #define xy
writeLines
static void writeLines(
std::ostream & ostr,
const std::vector < std::string > & lines,
bool appendNewLine
);
Writes code lines to the output stream.
writeNameSpaceBegin
static void writeNameSpaceBegin(
std::ostream & out,
const std::string & nameSpace
);
Starts the namespace
writeNameSpaceEnd
static void writeNameSpaceEnd(
std::ostream & out,
const std::string & nameSpace
);
Ends the namespace
writeStdHeader
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 const std::string ACTION;
AUTHENTICATED
static const std::string AUTHENTICATED;
CACHEEXPIRETIME
static const std::string CACHEEXPIRETIME;
CACHING
static const std::string CACHING;
CLASS
static const std::string CLASS;
CONSUMES
static const std::string CONSUMES;
CONTENT_TYPE
static const std::string CONTENT_TYPE;
CPPFILEEXTENSION
static const std::string CPPFILEEXTENSION;
DIRECTION
static const std::string DIRECTION;
FAULT
static const std::string FAULT;
FILTER
static const std::string FILTER;
FORMAT
static const std::string FORMAT;
GENERATED
static const std::string GENERATED;
HEADER
static const std::string HEADER;
HFILEEXTENSION
static const std::string HFILEEXTENSION;
IN
static const std::string IN;
LENGTH
static const std::string LENGTH;
MANDATORY
static const std::string MANDATORY;
NAME
static const std::string NAME;
NAMESPACE
static const std::string NAMESPACE;
ONEWAY
static const std::string ONEWAY;
OPTIONAL
static const std::string OPTIONAL;
ORDER
static const std::string ORDER;
PATH
static const std::string PATH;
PERMISSION
static const std::string PERMISSION;
PRIVATE
static const std::string PRIVATE;
PRODUCES
static const std::string PRODUCES;
PROPERTYEND
static const std::string PROPERTYEND;
PROPERTYENDELEM
static const std::string PROPERTYENDELEM;
PROPERTYSTART
static const std::string PROPERTYSTART;
PROPERTYSTARTELEM
static const std::string PROPERTYSTARTELEM;
PROTECTED
static const std::string PROTECTED;
PUBLIC
static const std::string PUBLIC;
REMOTE
static const std::string REMOTE;
REPLY
static const std::string REPLY;
REQUEST
static const std::string REQUEST;
RETURN
static const std::string RETURN;
SERIALIZE
static const std::string SERIALIZE;
STATIC
static const std::string STATIC;
SYNCHRONIZED
static const std::string SYNCHRONIZED;
TYPE
static const std::string TYPE;
TYPE_VOID
static const std::string TYPE_VOID;
VAL_ASSIGNMENT
static const std::string VAL_ASSIGNMENT;
VAL_ATTR
static const std::string VAL_ATTR;
VAL_ELEM
static const std::string VAL_ELEM;
VAL_FALSE
static const std::string VAL_FALSE;
VAL_INFINITE
static const std::string VAL_INFINITE;
VAL_SEPARATOR
static const std::string VAL_SEPARATOR;
VAL_TRUE
static const std::string VAL_TRUE;
VIRTUAL
static const std::string VIRTUAL;
XSDTYPE
static const std::string XSDTYPE;