Poco::CppParser

class Symbol

File Information

Library: CppParser
Package: SymbolTable
Header: Poco/CppParser/Symbol.h

Description

This is the base class for all symbols in the symbol table.

Every symbol has a unique ID (int) and a namespace (which may be null).

Inheritance

Known Derived Classes: Parameter, NameSpace, TypeDef, TypeAlias, Enum, Decl, Struct, BuiltIn, EnumValue, Function, Variable

Member Summary

Member Functions: addDocumentation, attrs, extractName, fullName, getAccess, getAttributeList, getAttributes, getDocumentation, getFile, getLibrary, getLineNumber, getOrder, getPackage, hasAttr, id, isIdent, isPrivate, isProtected, isPublic, kind, name, nameSpace, setAccess, setAttributeList, setAttributes, setDocumentation, setFile, setLibrary, setLineNumber, setOrder, setPackage, toString

Enumerations

Access

ACC_PUBLIC

public access

ACC_PROTECTED

protected access

ACC_PRIVATE

private access

Kind

SYM_ENUM

An enumeration

SYM_ENUM_VALUE

An enumeration value

SYM_FUNCTION

A (member) function

SYM_NAMESPACE

A namespace

SYM_PARAMETER

A function parameter

SYM_STRUCT

A struct or class

SYM_TYPEDEF

A typedef

SYM_TYPEALIAS

A type alias (using)

SYM_BUILTIN

A built-in type

SYM_VARIABLE

A (member) variable

Constructors

Symbol

Symbol();

Creates the Symbol and assigns the symbol a unique ID.

Symbol

Symbol(
    const std::string & name,
    NameSpace * pNameSpace = 0
);

Creates the Symbol and assigns the symbol a unique ID.

Destructor

~Symbol virtual

virtual ~Symbol();

Destroys the Symbol.

Member Functions

addDocumentation

void addDocumentation(
    const std::string & text
);

Adds text to the symbol's documentation.

attrs inline

const Attributes & attrs() const;

Returns the symbol's attributes.

attrs

Attributes & attrs();

Returns the symbol's attributes.

extractName static

static std::string extractName(
    const std::string & decl
);

Extracts the name from the declaration.

fullName

std::string fullName() const;

Returns the symbol's fully qualified name.

getAccess inline

Access getAccess() const;

Returns the symbol's access.

getAttributeList inline

const std::string & getAttributeList() const;

Returns the C++11 attribute list, or an empty string if the symbol does not have one.

getAttributes

const Attributes & getAttributes() const;

Returns the symbol's attributes.

getDocumentation inline

const std::string & getDocumentation() const;

Returns the symbol's documentation.

getFile inline

const std::string & getFile() const;

Returns the file where the symbol is defined.

getLibrary inline

const std::string & getLibrary() const;

Returns the symbol's library.

getLineNumber inline

int getLineNumber() const;

Returns the line number of the symbol's declaration.

getOrder inline

std::size_t getOrder() const;

Returns the order of the symbol within its container.

getPackage inline

const std::string & getPackage() const;

Returns the symbol's package.

id inline

int id() const;

Returns the symbol's unique ID.

isPrivate inline

bool isPrivate() const;

Returns true iff the symbol is public.

isProtected inline

bool isProtected() const;

Returns true iff the symbol is public.

isPublic inline

bool isPublic() const;

Returns true iff the symbol is public.

kind virtual

virtual Kind kind() const = 0;

Returns the symbol's kind.

name inline

const std::string & name() const;

Returns the symbol's (local) name.

nameSpace inline

NameSpace * nameSpace() const;

Returns the symbol's namespace which may be null.

setAccess

void setAccess(
    Access v
);

Sets the symbol's access.

setAttributeList

void setAttributeList(
    const std::string & attrs
);

Sets the C++11 attribute list, e.g. "

setAttributes

void setAttributes(
    const Attributes & attrs
);

Sets the symbol's attributes.

setDocumentation

void setDocumentation(
    const std::string & text
);

Sets the symbol's documentation.

setFile

void setFile(
    const std::string & path
);

Sets the file where the symbol is declared.

setLibrary

void setLibrary(
    const std::string & library
);

Sets the symbol's library.

setLineNumber

void setLineNumber(
    int line
);

Sets the line number of the symbol's declaration.

setOrder

void setOrder(
    std::size_t order
);

Sets the order of the symbol within its container.

Currently only used for struct/class members.

setPackage

void setPackage(
    const std::string & package
);

Sets the symbol's package.

toString virtual

virtual std::string toString() const = 0;

Returns a string representation of the symbol.

hasAttr protected static

static bool hasAttr(
    const std::string & decl,
    const std::string & attr
);

isIdent protected static

static bool isIdent(
    char c
);