template <class ComponentType>
class IdentifierBase
Defined at line 76 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
Base class for identifiers that have different types of components. Different languages might
want to represent different aspects of an identifier. This class encapsulates the core
hierarchical part of an identifier.
Code in the symbols directory must use "Identifier" which contains opaque strings as components.
The "expr" library adds a "ParsedIdentifier" which has more C++-aware parsing of template types.
See those classes for more.
The ComponentType must be copyable and moveable and implement:
- Construction from simple name:
ComponentType(const std::string
&
)
- Conversion to a string:
std::string GetName(bool include_debug)
- Comparison:
operator==
operator!=
operator
<
TODO(brettw) there is currently an annoying amount of duplicating between Identifier[Base] and
ParsedIdentifier, and also a fair bit of converting back-and-forth. We should consider moving
ParsedIdentifier to symbols and using that everywhere (renamed to Identifier), and having a
"parse" callback function for the higher-level "expr" layer to inject its full parser into the
lower-layer symbol directory.
Public Methods
void IdentifierBase<ComponentType> (Qualification qual)
Defined at line 80 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
void IdentifierBase<ComponentType> (ComponentType comp)
Makes an identifier from a single component. Without the qualification means relative.
Defined at line 83 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
void IdentifierBase<ComponentType> (Qualification qual, ComponentType comp)
Defined at line 85 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
void IdentifierBase<ComponentType> (const std::string & name)
Construction of a relative identifier from a simple single-name string. This string is passed
to the underlying component's constructor.
Defined at line 90 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
template <class InputIterator>
void IdentifierBase<ComponentType> (Qualification qual, InputIterator first, InputIterator last)
Makes an identifier over a range of components.
Defined at line 95 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
bool EqualsIgnoringQualification (const IdentifierBase<ComponentType> & other)
Comparisons. "==" compares everything for exact equality, "EqualsIgnoringQualification"
checks that everything is equal except the global/relative qualification flag.
Defined at line 100 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
bool operator== (const IdentifierBase<ComponentType> & other)
Defined at line 103 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
bool operator!= (const IdentifierBase<ComponentType> & other)
Defined at line 106 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
bool operator< (const IdentifierBase<ComponentType> & other)
For map/set lookups.
Defined at line 109 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
std::vector<ComponentType> & components ()
Defined at line 115 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
const std::vector<ComponentType> & components ()
Defined at line 116 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
bool empty ()
Defined at line 118 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
void AppendComponent (ComponentType c)
Appends a single component.
Defined at line 121 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
void Append (IdentifierBase<ComponentType> other)
Appends the components from the other identifier to this one.
Defined at line 124 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
Qualification qualification ()
Defined at line 129 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
void set_qualification (Qualification q)
Defined at line 130 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
IdentifierBase<ComponentType> GetScope ()
Returns a new identifier that's the scope of this one. The scope is everything but the last
component. The qualification remains unchanged.
If there is only one component, the resulting identifier will be empty (still leaving the
qualification unchanged). Examples:
"foo::bar<int>::baz" -> "foo::bar<int>"
"::foo::bar::baz" -> "::foo::bar"
"foo" -> ""
"" -> ""
"::foo" -> "::"
"::" -> "::"
Defined at line 143 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
std::string GetFullName ()
Returns the full name with all components concatenated together, including or omitting the
global qualifier (leading "::"), if any.
Defined at line 152 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
std::string GetFullNameNoQual ()
Defined at line 153 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
std::string GetDebugName ()
Returns a form for debugging where the parsing is more visible.
Defined at line 156 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h
const char * GetSeparator ()
Returns the separator string for components. This is currently always "::" but is exposed here
as a getter to avoid hardcoding it everywhere and to allow us to do language-specific
separators in the future.
Defined at line 161 of file ../../src/developer/debug/zxdb/symbols/identifier_base.h