📄 scopebase.h
字号:
// @(#)root/reflex:$Name: $:$Id: ScopeBase.h,v 1.10 2006/09/14 14:39:12 roiser Exp $// Author: Stefan Roiser 2004// Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved.//// Permission to use, copy, modify, and distribute this software for any// purpose is hereby granted without fee, provided that this copyright and// permissions notice appear in all copies and derivatives.//// This software is provided "as is" without express or implied warranty.#ifndef ROOT_Reflex_ScopeBase#define ROOT_Reflex_ScopeBase// Include files#include "Reflex/Kernel.h"#include "Reflex/Scope.h"#include "Reflex/internal/OwnedPropertyList.h"#include <vector>namespace ROOT { namespace Reflex { // forward declarations class Scope; class ScopeName; class Namespace; class Class; class Member; class OwnedMember; class TypeTemplate; class MemberTemplate; class OwnedMemberTemplate; class Type; class DictionaryGenerator; /** * @class ScopeBase ScopeBase.h Reflex/ScopeBase.h * @author Stefan Roiser * @date 24/11/2003 * @ingroup Ref */ class RFLX_API ScopeBase { public: /** constructor within a At*/ ScopeBase( const char * scope, TYPE scopeType ); /** destructor */ virtual ~ScopeBase(); /** * operator Scope will return the corresponding Scope object * @return Scope corresponding to this ScopeBase */ operator const Scope & () const; /** * the operator Type will return a corresponding Type object to the At if * applicable (i.e. if the Scope is also a Type e.g. Class, Union, Enum) */ operator const Type & () const; /** * nthBase will return the nth BaseAt class information * @param nth nth BaseAt class * @return pointer to BaseAt class information */ virtual const Base & BaseAt( size_t nth ) const; /** * BaseSize will return the number of BaseAt classes * @return number of BaseAt classes */ virtual size_t BaseSize() const; virtual Base_Iterator Base_Begin() const; virtual Base_Iterator Base_End() const; virtual Reverse_Base_Iterator Base_RBegin() const; virtual Reverse_Base_Iterator Base_REnd() const; /** * nthDataMember will return the nth data MemberAt of the At * @param nth data MemberAt * @return pointer to data MemberAt */ const Member & DataMemberAt( size_t nth ) const; /** * DataMemberByName will return the MemberAt with Name * @param Name of data MemberAt * @return data MemberAt */ const Member & DataMemberByName( const std::string & nam ) const; /** * DataMemberSize will return the number of data members of this At * @return number of data members */ size_t DataMemberSize() const; Member_Iterator DataMember_Begin() const; Member_Iterator DataMember_End() const; Reverse_Member_Iterator DataMember_RBegin() const; Reverse_Member_Iterator DataMember_REnd() const; /** * DeclaringScope will return a pointer to the At of this one * @return pointer to declaring At */ const Scope & DeclaringScope() const; /** * nthFunctionMember will return the nth function MemberAt of the At * @param nth function MemberAt * @return pointer to function MemberAt */ const Member & FunctionMemberAt( size_t nth ) const; /** * FunctionMemberByName will return the MemberAt with the Name, * optionally the signature of the function may be given * @param Name of function MemberAt * @param signature of the MemberAt function * @return function MemberAt */ const Member & FunctionMemberByName( const std::string & name, const Type & signature ) const; /** * FunctionMemberSize will return the number of function members of * this type * @return number of function members */ size_t FunctionMemberSize() const; Member_Iterator FunctionMember_Begin() const; Member_Iterator FunctionMember_End() const; Reverse_Member_Iterator FunctionMember_RBegin() const; Reverse_Member_Iterator FunctionMember_REnd() const; /** * GenerateDict will produce the dictionary information of this type * @param generator a reference to the dictionary generator instance */ virtual void GenerateDict(DictionaryGenerator &generator) const; /** * GlobalScope will return the global scope representation\ * @return global scope */ static const Scope & GlobalScope(); /** * IsClass returns true if the At represents a Class * @return true if At represents a Class */ bool IsClass() const; /** * IsEnum returns true if the At represents a Enum * @return true if At represents a Enum */ bool IsEnum() const; /** * IsNamespace returns true if the At represents a Namespace * @return true if At represents a Namespace */ bool IsNamespace() const; /** * IsPrivate will check if the scope access is private * @return true if scope access is private */ virtual bool IsPrivate() const; /** * IsProtected will check if the scope access is protected * @return true if scope access is protected */ virtual bool IsProtected() const; /** * IsPublic will check if the scope access is public * @return true if scope access is public */ virtual bool IsPublic() const; /** * IsTemplateInstance returns true if the At represents a * ClassTemplateInstance * @return true if At represents a InstantiatedTemplateClass */ bool IsTemplateInstance() const; /** * IsTopScope will return true if the current At is the top * (Empty) namespace * @return true if current sope is top namespace */ bool IsTopScope() const; /** * IsUnion returns true if the At represents a Union * @return true if At represents a */ bool IsUnion() const; /** * LookupMember will lookup a member in the current scope * @param nam the string representation of the member to lookup * @param current the current scope * @return if a matching member is found return it, otherwise return empty member */ const Member & LookupMember( const std::string & nam, const Scope & current ) const; /** * LookupType will lookup a type in the current scope * @param nam the string representation of the type to lookup * @param current the current scope * @return if a matching type is found return it, otherwise return empty type */ const Type & LookupType( const std::string & nam, const Scope & current ) const; /** * LookupType will lookup a scope in the current scope * @param nam the string representation of the scope to lookup * @param current the current scope * @return if a matching scope is found return it, otherwise return empty scope */ const Scope & LookupScope( const std::string & nam, const Scope & current ) const; /** * MemberByName will return the first MemberAt with a given Name * @param Name MemberAt Name * @return pointer to MemberAt */ const Member & MemberByName( const std::string & name, const Type & signature ) const; /** * MemberAt will return the nth MemberAt of the At * @param nth MemberAt * @return pointer to nth MemberAt */ const Member & MemberAt( size_t nth ) const; Member_Iterator Member_Begin() const; Member_Iterator Member_End() const; Reverse_Member_Iterator Member_RBegin() const; Reverse_Member_Iterator Member_REnd() const; /** * MemberSize will return the number of members * @return number of members */ size_t MemberSize() const; /** * MemberTemplateAt will return the nth MemberAt template of this At * @param nth MemberAt template * @return nth MemberAt template */ const MemberTemplate & MemberTemplateAt( size_t nth ) const; /** * MemberTemplateSize will return the number of MemberAt templates in this socpe * @return number of defined MemberAt templates */ size_t MemberTemplateSize() const; /** * MemberTemplateByName will return the member template representation in this * scope * @param string representing the member template to look for * @return member template representation of the looked up member */ const MemberTemplate & MemberTemplateByName( const std::string & nam ) const; MemberTemplate_Iterator MemberTemplate_Begin() const; MemberTemplate_Iterator MemberTemplate_End() const; Reverse_MemberTemplate_Iterator MemberTemplate_RBegin() const; Reverse_MemberTemplate_Iterator MemberTemplate_REnd() const; /** * Name will return the Name of the At * @return Name of At */ virtual std::string Name( unsigned int mod = 0 ) const; /** * Properties will return a pointer to the PropertyNth list attached * to this item * @return pointer to PropertyNth list */ virtual const PropertyList & Properties() const; /** * At will return the At Object of this ScopeBase * @return corresponding Scope */ const Scope & ThisScope() const; /** * ScopeType will return which kind of At is represented * @return At of At */ TYPE ScopeType() const; /** * ScopeTypeAsString will return the string representation of the enum * representing the current Scope (e.g. "CLASS") * @return string representation of enum for Scope */ std::string ScopeTypeAsString() const; /** * SubScopeAt will return a pointer to a sub-scopes
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -