class AttributesParser

Library: CppParser
Package: Attributes
Header: Poco/CppParser/AttributesParser.h


A parser for POCO-style C++ attributes.

Using a special comment syntax, C++ declarations for structs/classes, functions, types, etc. can be annotated with attributes.

Attributes always come immediately before the symbol that is being annotated, and are written inside special comments with the syntax:

//@ <attrDecl>[,<attrDec>...]

where <attrDecl> is


<name> is a valid C++ identifier, or two identifiers separated by a period (struct accessor notation). <value> is a string, integer, identifier, bool literal, or a complex value in the form


Member Summary

Member Functions: isEOF, isIdentifier, isLiteral, isOperator, next, parse, parseAttribute, parseAttributes, parseComplexAttribute, parseIdentifier, setAttribute



    Attributes & attrs,
    std::istream & istr

Creates the AttributesParser.




Destroys the AttributesParser.

Member Functions


void parse();

Parses attributes.

isEOF protected static inline

static bool isEOF(
    const Poco::Token * pToken

isIdentifier protected static inline

static bool isIdentifier(
    const Poco::Token * pToken

isLiteral protected static inline

static bool isLiteral(
    const Poco::Token * pToken

isOperator protected static inline

static bool isOperator(
    const Poco::Token * pToken,
    int kind

next protected inline

const Poco::Token * next();

parseAttribute protected

const Poco::Token * parseAttribute(
    const Poco::Token * pNext

parseAttributes protected

const Poco::Token * parseAttributes(
    const Poco::Token * pNext

parseComplexAttribute protected

const Poco::Token * parseComplexAttribute(
    const Token * pNext,
    const std::string & id

parseIdentifier protected

const Poco::Token * parseIdentifier(
    const Poco::Token * pNext,
    std::string & id

setAttribute protected

void setAttribute(
    const std::string & name,
    const std::string & value