ALox  V. 2402 R. 0
Home ALox for C++ ALox for C# ALox for Java Download
Public Methods | Protected Fields | Protected Methods | Private Methods | List of all members
ScopeDump Class Reference
Collaboration diagram for ScopeDump:
[legend]

Class Description


This class is an internal helper to export current scope values. It was extracted from class Lox to keep that class clean from this somehow 'cluttered' code.

The current purpose of this class is to write information into an AString buffer. This is used by method Lox.State. In the future, other export formats, like JSON might be implemented here.

Note
As this is a pure internal helper class. Documentation may be limited.

Public Methods

 ScopeDump (Dictionary< int, String > threadDictionary, String noKeyHashKey, AString target, int maxKeyLength=10)
 
int writeScopeDomains (ScopeStore< AString > store, int indentSpaces)
 
int writeScopePrefixes (ScopeStore< Object > store, int indentSpaces)
 
int writeStoreMap< T > (ScopeStore< Dictionary< AString, T >> store)
 

Protected Fields

AString key = new AString()
 
int maxKeyLength
 
String noKeyHashKey
 
AString target
 
AString tempAS = new AString()
 
Dictionary< int, String > threadDictionary
 

Protected Methods

AString storeKeyToScope (AString key)
 
AString storeThreadToScope (Thread thread)
 

Private Methods

int writeStoreMapHelper< T > (Dictionary< AString, T > map, String prefix)
 

Constructor & Destructor Documentation

◆ ScopeDump()

ScopeDump ( Dictionary< int, String >  threadDictionary,
String  noKeyHashKey,
AString  target,
int  maxKeyLength = 10 
)
inline

Constructor

Parameters
threadDictionaryUser-defined threads names.
noKeyHashKeyString to identify global keys.
targetTarget string to write to.
maxKeyLengthThe start value for the maximum length of a key.

Member Function Documentation

◆ storeKeyToScope()

AString storeKeyToScope ( AString  key)
inlineprotected

Helper method to write a ScopeStores' source related scope key as scope information.

Parameters
keyThe key of the StringTree that is to be "translated".
Returns
The target to allow concatenated calls.

◆ storeThreadToScope()

AString storeThreadToScope ( Thread  thread)
inlineprotected

Helper method to write thread information.

Parameters
threadThe thread in question
Returns
The target to allow concatenated calls.

◆ writeScopeDomains()

int writeScopeDomains ( ScopeStore< AString store,
int  indentSpaces 
)
inline

Writes the contents of the ScopeStore used for Scope Domains

Parameters
storeThe store to use
indentSpacesThe number of spaces to add at the beginning of each line.
Returns
The total number of Scope Domains written.

◆ writeScopePrefixes()

int writeScopePrefixes ( ScopeStore< Object >  store,
int  indentSpaces 
)
inline

Writes the contents of the ScopeStore used for Prefix Logables

Parameters
storeThe store to use
indentSpacesThe number of spaces to add at the beginning of each line.
Returns
The total number of Prefix Logables written.

◆ writeStoreMap< T >()

int writeStoreMap< T > ( ScopeStore< Dictionary< AString, T >>  store)
inline

Writes hash tables stored in a ScopeStore. Keys are AStrings. Value types currently supported are Object and int (in C# different method).

Parameters
storeThe store to use.
Returns
The total number of hash table entries written.

◆ writeStoreMapHelper< T >()

int writeStoreMapHelper< T > ( Dictionary< AString, T >  map,
String  prefix 
)
inlineprivate

Helper method.

Parameters
mapThe map to use
prefixA prefix string for each line
Returns
The number of objects written

Member Data Documentation

◆ key

AString key = new AString()
protected

Temporary, reused string

◆ maxKeyLength

int maxKeyLength
protected

The maximum length of a key. Adjusts (increases) over lifecycle.

◆ noKeyHashKey

String noKeyHashKey
protected

String to identify global keys.

◆ target

AString target
protected

The target to write to

◆ tempAS

AString tempAS = new AString()
protected

Temporary, reused string

◆ threadDictionary

Dictionary<int, String> threadDictionary
protected

User-defined threads names.


The documentation for this class was generated from the following file: