slang namespace
Root namespace.
Classes
- class AssignmentExpression
- Represents an assignment expression.
- class AssignmentPatternExpressionBase
- Base class for assignment pattern expressions.
- struct AssociativeArray
- Represents a SystemVerilog associative array, for use during constant evaluation.
- class AssociativeArrayType
- Represents an unpacked array that provides associative lookup.
-
template<typename TDerived, bool VisitStatements, bool VisitExpressions>struct ASTVisitor
- class Bag
- class BinaryExpression
- Represents a binary operator expression.
-
template<typename T>class bitmask
- class BlockStatement
- Represents a sequential or parallel block statement.
- struct BufferID
- class BumpAllocator
- class CallExpression
- Represents a subroutine call.
- class CHandleType
- Represents storage for pointers passed using the DPI (a "C" compatible handle).
- class ClassBuilder
- A helper class for constructing class types programmatically.
- class ClassType
- Represents a class definition type.
- class CommandLine
- class Compilation
- struct CompilationOptions
- Contains various options that can control compilation behavior.
- class CompilationUnitSymbol
- The root of a single compilation unit.
- class ConcatenationExpression
- Represents a concatenation expression.
- class ConditionalConstraint
- Represents a constraint defined by an if-else condition.
- class ConditionalExpression
- Represents a conditional operator expression.
- struct ConstantRange
- class ConstantValue
- class ConstraintBlockSymbol
- Represents a named constraint block declaration within a class.
- class ConstraintList
- Represents a list of constraints.
- struct ConstTokenOrSyntax
- A token or a constant syntax node.
- class ContinuousAssignSymbol
- Represents a continuous assignment statement.
- class ConversionExpression
- Represents a type conversion expression (implicit or explicit).
- class CopyClassExpression
- Represents a
new
expression that copies a class instance. -
template<typename T>class CopyPtr
- class CVConstIterator
- class CVIterator
- class DataTypeExpression
- class DeclaredType
- class Diagnostic
- Wraps up a reported diagnostic along with location in source and any arguments.
- class DiagnosticEngine
- class Diagnostics
- A collection of diagnostics.
- class DisableSoftConstraint
- Represents a constraint that disables a soft random variable.
- class DistExpression
- class DynamicArrayType
- Represents a dynamically sized unpacked array.
- class ElabSystemTaskSymbol
- Represents an elaboration system task, such as $error or $warning.
- class ElementSelectExpression
- Represents a single element selection expression.
- class EmptyArgumentExpression
- class EmptyMemberSymbol
- class EmptyStatement
- Represents an empty statement, used as a placeholder or an anchor for attributes.
- class EnumType
- Represents an enumerated type.
- class EnumValueSymbol
- Represents an enumerated value / member.
- class ErrorType
- class EvalContext
- class EventType
- class ExplicitImportSymbol
- Represents an explicit import from a package.
- class Expression
- The base class for all expressions in SystemVerilog.
- class ExpressionConstraint
- Represents a constraint defined by a logical expression.
- class FieldSymbol
- Represents a field member of a struct or union.
- class FixedSizeUnpackedArrayType
- class FloatingType
- class ForeachConstraint
- Represents a constraint that iterates over the elements of an array.
- class FormalArgumentSymbol
- Represents a formal argument in subroutine (task or function).
- class ForwardingTypedefSymbol
-
template<typename Fn>class function_ref
- class GenerateBlockArraySymbol
- Represents an array of generate blocks, as generated by a loop generate construct.
- class GenerateBlockSymbol
- class GenericClassDefSymbol
- class GenvarSymbol
- Represents a genvar declaration.
- class HierarchicalReferenceExpression
- class HierarchicalValueExpression
- Represents an expression that references a named value via hierarchical path.
- class ImplicationConstraint
- Represents a constraint defined by an implication.
- class InsideExpression
- Represents a set membership operator expression.
- class InstanceSymbol
- Base class for module, interface, and program instance symbols.
- class IntegerLiteral
- Represents an integer literal.
- class IntegralType
- class InterfacePortSymbol
- class InvalidExpression
- class InvalidStatement
-
template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T*, typename ReferenceT = T&>class iterator_facade
-
template<typename TIterator>class iterator_range
- A range represented by an interator pair, begin and end.
- class IteratorSymbol
- Represents an iterator variable created for array manipulation methods.
- class JsonWriter
- class Lexer
- struct LexerOptions
- Contains various options that can control lexing behavior.
- struct logic_t
- class Lookup
- Centralized functionality for looking up symbols by name in the AST.
- class LookupLocation
- struct LookupResult
- A structure that contains the results of a name lookup operation.
- class LValue
- class LValueReferenceExpression
- class MemberAccessExpression
- Represents an access of a structure variable's members.
- class MethodBuilder
- A helper class for constructing method symbols programmatically.
- class MinTypMaxExpression
- Represents a min:typ:max expression.
- class ModportPortSymbol
- Represents a single port specifier in a modport declaration.
- class ModportSymbol
- Represents a modport within an interface definition.
- class NamedValueExpression
- Represents an expression that references a named value.
- class NetSymbol
- Represents a net declaration.
- class NetType
- class NewArrayExpression
- Represents a new[] expression that creates a dynamic array.
- class NewClassExpression
- Represents a
new
expression that creates a class instance. -
template<typename T>class not_null
- class NullLiteral
- Represents a null literal.
- class NullType
- struct NumericTokenFlags
- Various flags for numeric tokens.
- class OpenRangeExpression
- class OS
- A collection of various OS-specific utility functions.
- class PackageSymbol
- A SystemVerilog package construct.
- class PackedArrayType
- class PackedStructType
- Represents a packed structure of members.
- class PackedUnionType
- Represents a packed union of members.
- class ParameterSymbol
- Represents a parameter value.
- class Parser
- Implements a full syntax parser for SystemVerilog.
- class ParserBase
- struct ParserOptions
- Contains various options that can control parsing behavior.
- class PortSymbol
- class PredefinedIntegerType
- Represents the predefined integer types, which are essentially predefined vector types.
- class Preprocessor
- struct PreprocessorOptions
- Contains various options that can control preprocessing behavior.
- class QueueType
- Represents an unpacked array that provides queue semantics.
- class RangeSelectExpression
- Represents a range selection expression.
- struct real_t
- class RealLiteral
- Represents a real number literal.
- class ReplicatedAssignmentPatternExpression
- Represents a replicated assignment pattern expression.
- class ReplicationExpression
- Represents a replication expression.
- class RootSymbol
- Represents the entirety of a design, along with all contained compilation units.
-
template<typename T, typename Index>class SafeIndexedVector
- class ScalarType
- Represents the single-bit scalar types.
- class Scope
-
template<typename F>class ScopeGuard
- class ScriptSession
-
template<typename T>class SeparatedSyntaxList
- struct shortreal_t
- class SimpleAssignmentPatternExpression
- Represents an assignment pattern expression.
- class SimpleSystemSubroutine
-
template<typename K, typename V, size_t N, typename Entry = ska::detailv3::sherwood_v3_entry<std::pair<K, V>>, typename Alloc = StackAllocator<Entry, N>>class SmallMap
-
template<typename T, size_t N, typename Entry = ska::detailv3::sherwood_v3_entry<T>, typename Alloc = StackAllocator<Entry, N>>class SmallSet
-
template<typename T>class SmallVector
-
template<typename T, size_t N>class SmallVectorSized
- class SolveBeforeConstraint
- Represents a constraint that enforces ordering of solving variables.
- struct SourceBuffer
- class SourceLocation
- class SourceManager
- class SourceRange
- Combines a pair of source locations that denote a range of source text.
- class Statement
- The base class for all statements in SystemVerilog.
- class StatementBinder
- class StatementList
- Represents a list of statements.
- class StreamingConcatenationExpression
- Represents a streaming concatenation.
- class StringLiteral
- Represents a string literal.
-
template<typename T>class StringTable
- class StringType
- Represents an ASCII string type.
- class StructuredAssignmentPatternExpression
- Represents an assignment pattern expression.
- class SubroutineSymbol
- Represents a subroutine (task or function).
- class SVInt
- class SVIntStorage
- struct SVQueue
- Represents a SystemVerilog queue, for use during constant evaluation.
- class Symbol
- class SyntaxFacts
-
template<typename T>class SyntaxList
- A syntax node that represents a list of child syntax nodes.
- class SyntaxListBase
- A base class for syntax nodes that represent a list of items.
- class SyntaxNode
- Base class for all syntax nodes.
- class SyntaxPrinter
-
template<typename TDerived>class SyntaxRewriter
- class SyntaxTree
-
template<typename TDerived>class SyntaxVisitor
- class TimeLiteral
- Represents a time literal.
- struct TimeScale
- struct TimeScaleValue
- A combination of a unit and magnitude for a time scale value.
- class Token
- class TokenList
- A syntax node that represents a list of child tokens.
- struct TokenOrSyntax
- A token or a syntax node.
-
template<typename TNode>struct TokenOrSyntaxBase
- A base class template for a sum type representing either a token or a syntax node.
- class TransparentMemberSymbol
- class Trivia
- class Type
- class TypeAliasType
- Represents a type alias, which is introduced via a typedef or type parameter.
-
template<typename T>class TypedBumpAllocator
- class UnaryExpression
- Represents a unary operator expression.
- class UnbasedUnsizedIntegerLiteral
- Represents an unbased unsized integer literal, which fills all bits in an expression.
- class UniquenessConstraint
- Represents a constraint that enforces uniqueness of variables.
- class UnknownModuleSymbol
- class UnpackedStructType
- Represents an unpacked structure of members.
- class UnpackedUnionType
- Represents an unpacked union of members.
- class ValueExpressionBase
- Common base class for both NamedValueExpression and HierarchicalValueExpression.
- class ValueSymbol
- class VariableSymbol
- Represents a variable declaration.
- class VersionInfo
- Provides access to compile-time generated version info about the library.
- class VoidType
- class WildcardImportSymbol
Enums
- enum class BindFlags { None = 0, Constant = 1 << 0, NoHierarchicalNames = 1 << 1, InsideConcatenation = 1 << 2, UnevaluatedBranch = 1 << 3, AllowDataType = 1 << 4, EnumInitializer = 1 << 5, NoAttributes = 1 << 6, AssignmentAllowed = 1 << 7, ProceduralStatement = 1 << 8, StaticInitializer = 1 << 9, StreamingAllowed = 1 << 10, TopLevelStatement = 1 << 11 }
- Specifies flags that control expression and statement binding.
- enum class EvalFlags: uint8_t { None = 0, IsScript = 1, IsVerifying = 2, CacheResults = 4 }
- Various flags that can be applied to a constant expression evaluation.
- enum class MinTypMax { Min, Typ, Max }
- enum class DiagnosticSeverity { Ignored, Note, Warning, Error, Fatal }
- enum class LiteralBase: uint8_t { Binary, Octal, Decimal, Hex }
- Specifies the base of an integer (for converting to/from a string)
- enum class TimeUnit: uint8_t { Seconds, Milliseconds, Microseconds, Nanoseconds, Picoseconds, Femtoseconds }
- Scale unit for a time value.
- enum class TimeScaleMagnitude: uint8_t { One = 1, Ten = 10, Hundred = 100 }
- enum class KeywordVersion: uint8_t { v1364_1995 = 0, v1364_2001_noconfig = 1, v1364_2001 = 2, v1364_2005 = 3, v1800_2005 = 4, v1800_2009 = 5, v1800_2012 = 6, v1800_2017 = 7 }
- enum class TriviaKind: uint8_t { Unknown, Whitespace, EndOfLine, LineComment, BlockComment, DisabledText, SkippedTokens, SkippedSyntax, Directive }
- The kind of trivia we've stored.
- enum class LookupFlags { None = 0, Constant = 1, Type = 2, AllowDeclaredAfter = 4, DisallowWildcardImport = 8, NoUndeclaredError = 16, TypedefTarget = 32, NoParentScope = 64 }
- Additional modifiers for a lookup operation.
- enum class MethodFlags: uint16_t { None = 0, Virtual = 1 << 0, Pure = 1 << 1, Static = 1 << 2, Constructor = 1 << 3, InterfaceImport = 1 << 4, DPIImport = 1 << 5, DPIContext = 1 << 6, NotConst = 1 << 7, Randomize = 1 << 8 }
- Specifies various flags that can apply to subroutines.
- enum class SymbolIndex: uint32_t { }
- enum class IntegralFlags: uint8_t { Unsigned = 0, TwoState = 0, Signed = 1, FourState = 2, Reg = 4 }
- Specifies possible traits for integral types.
Typedefs
- using bitwidth_t = uint32_t
- A type that can represent the largest possible bit width of a SystemVerilog integer.
Functions
- auto countLeadingZeros32(uint32_t value) -> uint32_t
- auto countLeadingZeros64(uint64_t value) -> uint32_t
- auto checkedAddS32(int32_t a, int32_t b) -> std::optional<int32_t>
- auto checkedSubS32(int32_t a, int32_t b) -> std::optional<int32_t>
- auto checkedMulU32(uint32_t a, uint32_t b) -> std::optional<uint32_t>
- auto clog2(const SVInt& v) -> uint32_t
- Returns the ceiling of the log_2 of the value. If value is zero, returns zero.
- ENUM(VariableLifetime, LIFETIME)
- Specifies the storage lifetime of a variable.
- ENUM(Visibility, VISIBILITY)
- Specifies the visibility of class members.
- ENUM(ArgumentDirection, DIRECTION)
- Specifies behavior of an argument passed to a subroutine.
- ENUM(ProceduralBlockKind, BLOCK)
- Specifies possible procedural block kinds.
- ENUM(StatementBlockKind, BLOCK)
- Specifies possible statement block kinds.
- ENUM(DefinitionKind, DEF)
- Specifies possible definition kinds.
- ENUM(UnconnectedDrive, UD)
- Specifies possible unconnected drive settings.
- ENUM(EdgeKind, EDGE)
- Specifies possible edge kinds.
- ENUM(SubroutineKind, SRK)
- Specifies possible subroutine kinds.
- ENUM(AssertionKind, ASK)
- Specifies possible assertion kinds.
- ENUM(ElabSystemTaskKind, ELAB)
- Specifies possible elaboration system task kinds.
- ENUM(RandMode, MODE)
- Specifies possible assertion kinds.
- auto xxhash(const void* input, size_t len) -> size_t
- Hashes the provided input using the xxhash XXH3 algorithm.
-
template<typename T, typename... Rest>void hash_combine(size_t& seed, const T& v, Rest... rest)
-
template<typename T>auto make_range(T begin, T end) -> iterator_
range<T> - Constructs an iterator_
range from two provided iterators (inferring the types involved). -
template<typename TContainer>auto make_reverse_range(TContainer&& container) -> auto
- auto toStringView(span<char> text) -> string_view
- Converts a span of characters into a string_view.
- void uintToStr(SmallVector<char>& buffer, uint32_t value)
- Converts the provided value into a string, storing it into buffer.
- void uintToStr(SmallVector<char>& buffer, uint64_t value)
- Converts the provided value into a string, storing it into buffer.
- auto strToInt(string_view str, size_t* pos = nullptr, int base = 10) -> optional<int32_t>
- auto strToUInt(string_view str, size_t* pos = nullptr, int base = 10) -> optional<uint32_t>
- auto strToDouble(string_view str, size_t* pos = nullptr) -> optional<double>
- auto editDistance(string_view left, string_view right, bool allowReplacements = true, int maxDistance = 0) -> int
- auto widen(string_view str) -> string_view
- Widens the provided UTF8 string into UTF16 wchars.
- auto narrow(string_view str) -> string_view
- Widens the provided UTF16 string into UTF8.
Enum documentation
enum class slang:: BindFlags
#include <slang/binding/BindContext.h>
Specifies flags that control expression and statement binding.
Enumerators | |
---|---|
None |
No special binding behavior specified. |
Constant |
The binding is for a constant expression, so report an error if it's not constant for some reason. |
NoHierarchicalNames |
No hierarchical references are allowed to symbols. This is implied by Constant but can be specified on its own if the expression doesn't need to be fully constant. |
InsideConcatenation |
The expression is inside a concatenation; this enables slightly different binding rules. |
UnevaluatedBranch |
The expression is inside the unevaluated side of a conditional branch. This is used to avoid issuing warnings for things that won't happen. |
AllowDataType |
Allow the expression to also be a data type; used in a few places like the first argument to system methods like $bits |
EnumInitializer |
The expression being bound is an enum value initializer. |
NoAttributes |
Attributes are disallowed on expressions in this context. |
AssignmentAllowed |
Assignment is allowed in this context. This flag is cleared for nested subexpressions, unless they are directly parenthesized. |
ProceduralStatement |
Expression is inside a procedural statement. This means that modifying variables via assignments and increment/decrement expressions is allowed. |
StaticInitializer |
Expression is for a static variable's initializer. References to automatic variables will be disallowed. |
StreamingAllowed |
Streaming operator is allowed in assignment target, assignment source, bit-stream casting argument, or stream expressions of another streaming concatenation. This flag is cleared for nested subexpressions, unless they are directly parenthesized. |
TopLevelStatement |
This is the first expression appearing as an expression statement; potentially this indicates whether a subroutine invocation is as a task (if set) or as a function (unset). Cleared for nested subexpressions. |
enum class slang:: EvalFlags: uint8_t
#include <slang/binding/EvalContext.h>
Various flags that can be applied to a constant expression evaluation.
Enumerators | |
---|---|
None |
No special flags specified. |
IsScript |
This evaluation is happening inside of a script, so some language rules should be relaxed. |
IsVerifying |
This evaluation is happening to verify the const-ness of an expression, not to figure out a final result. |
CacheResults |
The results of the evaluation can be cached in each expression's |
enum class slang:: MinTypMax
#include <slang/compilation/Compilation.h>
Specifies which set of min:typ:max expressions should be used during compilation.
Enumerators | |
---|---|
Min |
Use the "min" delay expressions. |
Typ |
Use the "typical" delay expressions. |
Max |
Use the "max" delay expressions. |
enum class slang:: DiagnosticSeverity
#include <slang/diagnostics/Diagnostics.h>
The severity of a given diagnostic. This is not tied to the diagnostic itself; it can be configured on a per-diagnostic basis at runtime.
enum class slang:: LiteralBase: uint8_t
#include <slang/numeric/SVInt.h>
Specifies the base of an integer (for converting to/from a string)
enum class slang:: TimeUnit: uint8_t
#include <slang/numeric/Time.h>
Scale unit for a time value.
enum class slang:: TimeScaleMagnitude: uint8_t
#include <slang/numeric/Time.h>
As allowed by SystemVerilog, time scales can be expressed in one of only a few magnitudes.
enum class slang:: KeywordVersion: uint8_t
#include <slang/parsing/LexerFacts.h>
Different restricted sets of keywords that can be set using the `begin_keywords directive. The values of the enum correspond to indexes to allKeywords[] in LexerFacts.cpp
enum class slang:: TriviaKind: uint8_t
#include <slang/parsing/Token.h>
The kind of trivia we've stored.
enum class slang:: LookupFlags
#include <slang/symbols/Lookup.h>
Additional modifiers for a lookup operation.
Enumerators | |
---|---|
None |
No special modifiers. |
Constant |
The lookup is occurring in a constant context. This adds an additional restriction that the symbols cannot be referenced by hierarchical path. |
Type |
A lookup for a type name, as opposed to a value. These names cannot be hierarchical but can be package or class scoped. |
AllowDeclaredAfter |
Usually lookups require that the found symbol be declared before the lookup location. This flag removes that restriction. |
DisallowWildcardImport |
Don't search through wildcard imports to satisfy the lookup. |
NoUndeclaredError |
Don't report an error if the lookup is for a simple identifier that cannot be found. |
TypedefTarget |
The lookup is for a typedef target type, which has a special exemption to allow scoped access to incomplete forward class types. |
NoParentScope |
The lookup should not continue looking into parent scopes if the name is not found in the initial search scope. |
enum class slang:: MethodFlags: uint16_t
#include <slang/symbols/SubroutineSymbols.h>
Specifies various flags that can apply to subroutines.
Enumerators | |
---|---|
None |
No specific flags specified. |
Virtual |
The method is virtual. |
Pure |
The method is 'pure' virtual, meaning it requires an implementation in derived classes. |
Static |
The method is static, meaning it is invocable without an object instance handle. |
Constructor |
The method is a class constructor. |
InterfaceImport |
The method is imported into an interface instance. |
DPIImport |
The method is a DPI import. |
DPIContext |
The method is a DPI import marked 'context'. |
NotConst |
The method is known not to be constant, even if it otherwise meets all of the requirements for a constant function. Used for built-in methods only. |
Randomize |
This method is a std::randomize built-in. These are declared as normal subroutines so they can be found via name lookup, and then a special case translates the calls into the appropriate system subroutine call. |
enum class slang:: SymbolIndex: uint32_t
#include <slang/symbols/Symbol.h>
A numeric index that can be used to compare the relative ordering of symbols within a single lexical scope.
enum class slang:: IntegralFlags: uint8_t
#include <slang/types/Type.h>
Specifies possible traits for integral types.
Enumerators | |
---|---|
Unsigned |
The type is unsigned. This is the default. |
TwoState |
The type is two state. This is the default. |
Signed |
The type is signed. |
FourState |
The type is four state. |
Reg |
The type used the 'reg' keyword instead of 'logic'; they are semantically identical but preserve the distinction to allow more useful messaging. |
Typedef documentation
using slang:: bitwidth_t = uint32_t
#include <slang/numeric/SVInt.h>
A type that can represent the largest possible bit width of a SystemVerilog integer.
Function documentation
uint32_t slang:: countLeadingZeros32(uint32_t value)
#include <slang/numeric/MathUtils.h>
If value is zero, returns 32. Otherwise, returns the number of zeros, starting from the MSB.
uint32_t slang:: countLeadingZeros64(uint64_t value)
#include <slang/numeric/MathUtils.h>
If value is zero, returns 64. Otherwise, returns the number of zeros, starting from the MSB.
std::optional<int32_t> slang:: checkedAddS32(int32_t a,
int32_t b)
#include <slang/numeric/MathUtils.h>
Performs an addition of two signed 32-bit integers and returns the result if it does not overflow. If it does, nullopt is returned instead.
std::optional<int32_t> slang:: checkedSubS32(int32_t a,
int32_t b)
#include <slang/numeric/MathUtils.h>
Performs a subtraction of two signed 32-bit integers and returns the result if it does not overflow. If it does, nullopt is returned instead.
std::optional<uint32_t> slang:: checkedMulU32(uint32_t a,
uint32_t b)
#include <slang/numeric/MathUtils.h>
Performs a multiplication of two unsigned 32-bit integers and returns the result if it does not overflow. If it does, nullopt is returned instead.
uint32_t slang:: clog2(const SVInt& v)
#include <slang/numeric/SVInt.h>
Returns the ceiling of the log_2 of the value. If value is zero, returns zero.
slang:: ENUM(VariableLifetime,
LIFETIME)
#include <slang/symbols/SemanticFacts.h>
Specifies the storage lifetime of a variable.
slang:: ENUM(Visibility,
VISIBILITY)
#include <slang/symbols/SemanticFacts.h>
Specifies the visibility of class members.
slang:: ENUM(ArgumentDirection,
DIRECTION)
#include <slang/symbols/SemanticFacts.h>
Specifies behavior of an argument passed to a subroutine.
slang:: ENUM(ProceduralBlockKind,
BLOCK)
#include <slang/symbols/SemanticFacts.h>
Specifies possible procedural block kinds.
slang:: ENUM(StatementBlockKind,
BLOCK)
#include <slang/symbols/SemanticFacts.h>
Specifies possible statement block kinds.
slang:: ENUM(DefinitionKind,
DEF)
#include <slang/symbols/SemanticFacts.h>
Specifies possible definition kinds.
slang:: ENUM(UnconnectedDrive,
UD)
#include <slang/symbols/SemanticFacts.h>
Specifies possible unconnected drive settings.
slang:: ENUM(EdgeKind,
EDGE)
#include <slang/symbols/SemanticFacts.h>
Specifies possible edge kinds.
slang:: ENUM(SubroutineKind,
SRK)
#include <slang/symbols/SemanticFacts.h>
Specifies possible subroutine kinds.
slang:: ENUM(AssertionKind,
ASK)
#include <slang/symbols/SemanticFacts.h>
Specifies possible assertion kinds.
slang:: ENUM(ElabSystemTaskKind,
ELAB)
#include <slang/symbols/SemanticFacts.h>
Specifies possible elaboration system task kinds.
slang:: ENUM(RandMode,
MODE)
#include <slang/symbols/SemanticFacts.h>
Specifies possible assertion kinds.
size_t slang:: xxhash(const void* input,
size_t len)
#include <slang/util/Hash.h>
Hashes the provided input using the xxhash XXH3 algorithm.
#include <slang/util/Hash.h>
template<typename T, typename... Rest>
void slang:: hash_combine(size_t& seed,
const T& v,
Rest... rest)
Hash combining function, based on the function from Boost. It hashes the provided v object and combines it with the previous hash value in seed.
#include <slang/util/Iterator.h>
template<typename T>
iterator_ range<T> slang:: make_range(T begin,
T end)
Constructs an iterator_
#include <slang/util/Iterator.h>
template<typename TContainer>
auto slang:: make_reverse_range(TContainer&& container)
Constructs a reversed iterator_
string_view slang:: toStringView(span<char> text)
#include <slang/util/String.h>
Converts a span of characters into a string_view.
void slang:: uintToStr(SmallVector<char>& buffer,
uint32_t value)
#include <slang/util/String.h>
Converts the provided value into a string, storing it into buffer.
void slang:: uintToStr(SmallVector<char>& buffer,
uint64_t value)
#include <slang/util/String.h>
Converts the provided value into a string, storing it into buffer.
optional<int32_t> slang:: strToInt(string_view str,
size_t* pos = nullptr,
int base = 10)
#include <slang/util/String.h>
Returns | the converted value, or nullopt if conversion fails (invalid string, overflow, etc). |
---|
Parses the provided str in the specified base into a signed integer. If pos is non-null, it will be set to point to the first character in the source string that was not part of the conversion.
optional<uint32_t> slang:: strToUInt(string_view str,
size_t* pos = nullptr,
int base = 10)
#include <slang/util/String.h>
Returns | the converted value, or nullopt if conversion fails (invalid string, overflow, etc). |
---|
Parses the provided str in the specified base into an unsigned integer. If pos is non-null, it will be set to point to the first character in the source string that was not part of the conversion.
optional<double> slang:: strToDouble(string_view str,
size_t* pos = nullptr)
#include <slang/util/String.h>
Returns | the converted value, or nullopt if conversion fails (invalid string, overflow, etc). |
---|
Parses the provided str into a floating point value. If pos is non-null, it will be set to point to the first character in the source string that was not part of the conversion.
int slang:: editDistance(string_view left,
string_view right,
bool allowReplacements = true,
int maxDistance = 0)
#include <slang/util/String.h>
Determines the number of edits to the left string that are required to change it into the right string. If allowReplacements is true, characters can be substituted as needed. Otherwise, only swaps are allowed.
If maxDistance is >0 and the computed distance is at least that much, give up and return maxDistance + 1.
string_view slang:: widen(string_view str)
#include <slang/util/String.h>
Widens the provided UTF8 string into UTF16 wchars.
string_view slang:: narrow(string_view str)
#include <slang/util/String.h>
Widens the provided UTF16 string into UTF8.