bux API Reference 1.9.0
Static library of whatever are seen required in general purpose but not directly supported from Modern C++. Or whatever reusable originated from my side projects.
Loading...
Searching...
No Matches
bux Namespace Reference

THE common namespace of bux library. More...

Namespaces

namespace  GLR
 
namespace  Helper_
 
namespace  LR1
 
namespace  user
 Function prototypes declared in this subnamespace are required to be implemented by user so that functions declared under namespace bux in the same header can be linked properly without errors.
 

Classes

struct  C_ActionRet
 
class  C_AutoNode
 
struct  C_AutoSinkHolderT
 
struct  C_AutoSinkHolderT< T_Sink >
 
class  C_DFA
 
class  C_DtorFreeStack
 Safe instantiation for types which's destructor does exactly nothing. More...
 
class  C_EntryLog
 Log on both declaration point and end of block scope with an unique id. More...
 
struct  C_ErrorOrIndex
 
class  C_EZArgs
 
struct  C_FA_Traits
 
struct  C_IMemBufAsMember
 
class  C_IMemStreamT
 
class  C_IntegerLex
 
class  C_Intervals
 
struct  C_KVPair
 
struct  C_LexDataT
 Render any copyable "type" token attribute on the fly. More...
 
struct  C_LexInfoT
 
struct  C_LexTraits
 
struct  C_LexTraits< C_LexUTF32 >
 
struct  C_LexUTF32
 
class  C_MBCStr
 
class  C_NewNode
 
class  C_NFA
 
class  C_NfaState
 
struct  C_OMemBufAsMemberT
 
class  C_OMemStreamT
 
struct  C_OstreamHolder
 
class  C_ParaLog
 
class  C_ParserLogCount
 
class  C_ParserOStreamCount
 
class  C_PartialOrdering
 
class  C_PathFmtLogSnap
 
class  C_PersistedSnapHolder
 
class  C_Queue
 
class  C_RawQueue
 
class  C_ReenterableLogger
 
class  C_ReenterableLoggerInside
 
class  C_ResourceStack
 If ctor of type T properly handles ownership transfer, so does C_ResourceStack<T> More...
 
struct  C_RetLvalT
 
class  C_ScannerImpl
 
class  C_Screener
 
class  C_ScreenerNo
 
struct  C_SourcePos
 
class  C_SpinCacheT
 
class  C_SpinLock
 
class  C_Stack
 A much more succinct substitute of std::stack<std::vector<T> > More...
 
class  C_StackBase
 Any given type is safely instantiated even though C_DtorFreeStack<T> does better for bytewise types. More...
 
class  C_SyncLogger
 
class  C_UnicodeIn
 
class  C_UseLog
 
struct  C_Void
 
class  FC_GetRelLexT
 
struct  I_LexAttr
 
struct  I_Parser
 
struct  I_ReenterableLog
 Thread-unsafe implementation is preferred for performance. More...
 
struct  I_Scanner
 
struct  I_SnapT
 < Parasitic Type More...
 
class  I_SyncLog
 </// Thread safety is expected More...
 
struct  T_CoConst_
 
struct  T_CoConst_< T, false >
 
struct  T_CoConst_< T, true >
 
union  U_K2V
 

Concepts

concept  IntervalPt
 

Typedefs

using T_LexID = uint32_t
 
using C_IMemStream = C_IMemStreamT<char>
 
using C_OMemStream = C_OMemStreamT<char>
 
using T_StateID = unsigned
 
template<class T , template< class > class C_Ptr>
using F_GetProducedT = std::function<C_LexInfoT<T,C_Ptr> &(size_t)>
 
template<class T_Data , class T_Dep >
using T_CoConst = typename T_CoConst_<T_Data,std::is_const<T_Dep>::value>::type
 
using C_ReenterableOstream = C_ReenterableLogger<C_OstreamHolder>
 
using C_ReenterableOstreamSnap = C_ReenterableLogger<C_PersistedSnapHolder>
 
typedef std::uint32_t T_Utf32
 UTF-32 to cover the full range of codespace U+0000 ~ U+10FFFF.
 
typedef std::uint16_t T_Utf16
 UTF-16: You need T_Utf16[2] to hold full range of unicode.
 
typedef std::uint8_t T_Utf8
 UTF-8: You need T_Utf8[4] to hold full range of unicode.
 
typedef std::function< std::optional< char >()> FH_ReadChar
 

Enumerations

enum  { FA_OPTIONAL = 1<<0 , FA_REPEATABLE = 1<<1 }
 
enum  : uint32_t { TID_EOF = MIN_TOKEN_ID , ROOT_NID , TOKENGEN_LB }
 
enum  E_LogLevel {
  LL_FATAL , LL_ERROR , LL_WARNING , LL_INFO ,
  LL_VERBOSE
}
 
enum  E_MakeLinearPolicy { MLP_BREADTH_FIRST , MLP_DEPTH_FIRST }
 
enum  {
  MAX_UTF16 = 2 , MAX_UTF8 = 6 , MAX_UTF8_BMP = 3 , MAX_UTF8_VALID = 4 ,
  UIE_EOF = 0 , UIE_ILLFORMED_UNICODE = -1 , UIE_INCOMPLETE_UNICODE = -2 , UIE_NO_UNICODE_TRANSLATION = -3 ,
  UIE_INTERNAL = -9
}
 

Functions

std::string easy_escape (std::string_view src)
 
std::string easy_unescape (std::string_view src)
 
bool operator== (const C_SourcePos &a, const C_SourcePos &b) noexcept
 Equivalence relation.
 
bool operator< (const C_SourcePos &a, const C_SourcePos &b) noexcept
 Partial relation.
 
std::string asciiLiteral (uint32_t utf32)
 
std::string asciiLiteral (std::string_view utf8)
 
void addAsHex (std::string &dst, uint32_t ch32)
 
I_SyncLoglogger ()
 
std::ostream & stamp (const C_UseLog &u, E_LogLevel level)
 
std::ostream & timestamp (std::ostream &out, const std::chrono::time_zone *tz)
 
std::ostream & logTrace (std::ostream &out, const std::chrono::time_zone *tz)
 
std::string escseq2str (std::string s)
 
bool isIdentifier (std::string_view s) noexcept
 
size_t parseEscapeChar (std::string_view s, uint32_t &c, size_t pos)
 
size_t skipIdentifier (std::string_view s, size_t pos) noexcept
 
size_t read_size (const std::string &src, size_t &off) noexcept
 
std::tuple< std::string, size_t, boolload_hashed_str (std::istream &in)
 
size_t save_hashed_str (std::ostream &out, const std::string &s)
 
const char * ord_suffix (size_t i)
 
std::string expand_env (const char *s)
 
std::string _HRTN (const char *originalName)
 
std::string OXCPT (const std::exception &e)
 
std::string_view to_utf8 (T_Utf32 uc)
 
std::string to_utf8 (std::string_view s, T_Encoding codepage)
 
std::string to_utf8 (std::istream &in, T_Encoding codepage)
 
std::wstring BOM (const std::wstring &ws)
 
void getKeyPunch (std::string_view msg, int &key, const char *keyFilter)
 
void pressAKey ()
 
bool testWritability (const char *file)
 
std::filesystem::path search_dirs (const std::filesystem::path &in_path, const std::ranges::forward_range auto &dirs)
 
template<IntervalPt T, class charT , class traits = std::char_traits<charT>>
std::basic_ostream< charT, traits > & operator<< (std::basic_ostream< charT, traits > &out, const C_Intervals< T > &x)
 
template<class T >
auto createLex (const T &t)
 
template<class T >
auto createLex (T &t)
 
template<class T , class... T_Args>
auto createLex (T_Args &&...args)
 
template<class T_Key , class T_Value , class T_ValueOrSize , class T_Traits >
T_Value index2value (U_K2V< T_Key, T_Value > k2v, T_ValueOrSize valOrSz, T_LexID key)
 
template<class T >
auto & unlex (I_LexAttr &lex)
 
template<class T >
auto & unlex (const I_LexAttr &lex)
 
template<class T_Data , class T_Lex , template< class > class C_Ptr>
auto & unlex (const C_Ptr< T_Lex > &lex)
 
template<class T_Data , class T_Lex , template< class > class C_Ptr>
auto & unlex (const C_LexInfoT< T_Lex, C_Ptr > &lex)
 
template<class T_Data , class T_Lex , template< class > class C_Ptr>
T_CoConst< T_Data, T_Lex > * tryUnlex (const C_Ptr< T_Lex > &lex)
 
template<class T_Data , class T_Lex , template< class > class C_Ptr>
auto tryUnlex (const C_LexInfoT< T_Lex, C_Ptr > &lex)
 
template<class T_Lex , template< class > class C_Ptr>
int toInt (const C_LexInfoT< T_Lex, C_Ptr > &lex)
 
template<class C , class T >
void addUnique (C &c, T &&value)
 
template<std::integral T>
std::string fittestType (T lb, T ub)
 
template<class T >
addNoWrap (T a, T b)
 
template<class T >
int compareReturn (T a)
 
template<class T_LexCh >
auto toString (const T_LexCh *c, size_t start, size_t end) noexcept(noexcept(C_LexTraits< T_LexCh >::appendUTF8(std::declval< std::string & >(), T_LexCh())))
 
template<T_LexID _ID, class T_LexCh >
auto createCharLiteral (const T_LexCh *c, size_t n)
 
template<T_LexID _ID, class T_LexCh >
auto createDecNum (const T_LexCh *c, size_t n)
 
template<T_LexID _ID, class T_LexCh >
auto createHexNum (const T_LexCh *c, size_t n)
 
template<T_LexID _ID, class T_LexCh >
C_ActionRet createNothing (const T_LexCh *, size_t)
 
template<T_LexID _ID, class T_LexCh >
auto createOctNum (const T_LexCh *c, size_t n)
 
template<T_LexID _ID, class T_LexCh , size_t TRIMLEFT = 0, size_t TRIMRIGHT = 0>
auto createPlainString (const T_LexCh *c, size_t n)
 
template<T_LexID _ID, class T_LexCh , size_t TRIMLEFT = 0, size_t TRIMRIGHT = 0>
auto createEscapeString (const T_LexCh *c, size_t n)
 
template<class T_Char >
void scanFile (std::string_view filename, std::istream &in, I_Scanner< T_Char > &scanner, T_LexID endToken=TID_EOF, T_Encoding encoding=0)
 
template<class T >
void append (const T &src, std::string &dst)
 
template<class T >
void append_size_of (const T &src, std::string &dst)
 
template<class T >
void append (const T *src, size_t argN, std::string &dst)
 
template<class T >
void read (const std::string &src, size_t &off, T &data) noexcept
 
template<class T >
void read (const std::string &src, size_t &off, T *data, size_t count)
 
template<size_t N>
auto to_str (const std::array< char, N > &arr)
 
template<size_t N>
std::array< char, N > read_charr (const std::string &src, size_t &off) noexcept
 
template<size_t N, template< typename > class C>
void append (const C< std::array< char, N > > &src, std::string &dst)
 
template<size_t N, template< typename > class C>
void read (const std::string &src, size_t &off, C< std::array< char, N > > &data)
 
template<typename T >
auto to_utf8 (const T *ps, size_t size=0, T_Encoding codepage=0)
 
template<typename T >
auto to_utf8 (std::basic_string_view< T > s, T_Encoding codepage=0)
 
std::wstring BOM (const std::wstring_view &ws)
 
template<class T >
bool operator< (const C_Stack< T > &a, const C_Stack< T > &b) noexcept
 Lexical comparison.
 
template<class T >
bool operator== (const C_Stack< T > &a, const C_Stack< T > &b) noexcept
 
template<class T >
bool operator!= (const C_Stack< T > &a, const C_Stack< T > &b) noexcept
 
template<class T >
void operator+= (C_Stack< T > &a, const C_Stack< T > &b)
 
template<class T >
void operator+= (C_Stack< T > &out, const T *s)
 
template<class T >
void operator+= (C_ResourceStack< T > &a, C_StackBase< T > &b)
 
template<class T >
auto & operator<< (C_Stack< T > &a, const C_Stack< T > &b)
 
template<class T >
auto & operator<< (C_Stack< T > &out, const T *s)
 
template<class T >
auto & operator<< (C_ResourceStack< T > &a, C_StackBase< T > &b)
 
template<class T >
auto & operator<< (C_Stack< T > &out, const T &c)
 
template<class T >
auto & operator<< (C_ResourceStack< T > &out, T &t)
 
template<class T >
auto & operator<< (std::basic_ostream< T > &out, const C_Stack< T > &s)
 

Variables

constinit const uint32_t MIN_TOKEN_ID = 0x70000000
 

Detailed Description

THE common namespace of bux library.

Typedef Documentation

◆ C_IMemStream

Definition at line 56 of file MemIn.h.

◆ C_OMemStream

Definition at line 45 of file MemOut.h.

◆ C_ReenterableOstream

◆ C_ReenterableOstreamSnap

◆ F_GetProducedT

template<class T , template< class > class C_Ptr>
using bux::F_GetProducedT = std::function<C_LexInfoT<T,C_Ptr> &(size_t)>

Definition at line 20 of file ParserBase.h.

◆ FH_ReadChar

typedef std::function<std::optional<char>()> bux::FH_ReadChar

Definition at line 43 of file UnicodeCvt.h.

◆ T_CoConst

template<class T_Data , class T_Dep >
using bux::T_CoConst = typename T_CoConst_<T_Data,std::is_const<T_Dep>::value>::type

Definition at line 60 of file ParserBase.h.

◆ T_LexID

using bux::T_LexID = uint32_t

Definition at line 35 of file LexBase.h.

◆ T_StateID

using bux::T_StateID = unsigned

Definition at line 17 of file ParserBase.h.

◆ T_Utf16

typedef std::uint16_t bux::T_Utf16

UTF-16: You need T_Utf16[2] to hold full range of unicode.

Definition at line 40 of file UnicodeCvt.h.

◆ T_Utf32

typedef std::uint32_t bux::T_Utf32

UTF-32 to cover the full range of codespace U+0000 ~ U+10FFFF.

Definition at line 39 of file UnicodeCvt.h.

◆ T_Utf8

typedef std::uint8_t bux::T_Utf8

UTF-8: You need T_Utf8[4] to hold full range of unicode.

Definition at line 41 of file UnicodeCvt.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
FA_OPTIONAL 
FA_REPEATABLE 

Definition at line 38 of file FA.h.

◆ anonymous enum

anonymous enum : uint32_t
Enumerator
TID_EOF 
ROOT_NID 
TOKENGEN_LB 

Definition at line 1 of file LexBase.h.

◆ anonymous enum

anonymous enum
Enumerator
MAX_UTF16 
MAX_UTF8 
MAX_UTF8_BMP 
MAX_UTF8_VALID 
UIE_EOF 
UIE_ILLFORMED_UNICODE 
UIE_INCOMPLETE_UNICODE 
UIE_NO_UNICODE_TRANSLATION 
UIE_INTERNAL 

Definition at line 21 of file UnicodeCvt.h.

◆ E_LogLevel

Enumerator
LL_FATAL 

Error serious enough that the program should shut down immediately after reporting this.

LL_ERROR 

Error not serious enough that the program can continue to run.

LL_WARNING 

Situation that should be warned but should not have sabotaged anything already.

LL_INFO 

Information worth mentioning about the current status, be it normal or abnormal.

LL_VERBOSE 

More detailed or advanced information probably considered too much by some.

Definition at line 8 of file LogLevel.h.

◆ E_MakeLinearPolicy

Enumerator
MLP_BREADTH_FIRST 
MLP_DEPTH_FIRST 

Definition at line 11 of file PartialOrdering.h.

Function Documentation

◆ _HRTN()

std::string bux::_HRTN ( const char * originalName)
Parameters
[in]originalNameCompiler mangled or expanded type name, depending on which compiler you are using.
Returns
Human readable type name
Examples
test/hrtn.cpp.

Definition at line 70 of file StrUtil.cpp.

◆ addAsHex()

void bux::addAsHex ( std::string & dst,
uint32_t ch32 )

Definition at line 121 of file LexBase.cpp.

◆ addNoWrap()

template<class T >
T bux::addNoWrap ( T a,
T b )
inline

Definition at line 31 of file SafeArith.h.

◆ addUnique()

template<class C , class T >
void bux::addUnique ( C & c,
T && value )

Definition at line 68 of file PartialOrdering.h.

Referenced by bux::C_PartialOrdering< T >::getRelated(), bux::C_PartialOrdering< T >::getRelated(), and bux::C_PartialOrdering< T >::makeLinear().

Here is the caller graph for this function:

◆ append() [1/3]

template<size_t N, template< typename > class C>
void bux::append ( const C< std::array< char, N > > & src,
std::string & dst )

Definition at line 69 of file Serialize.h.

References append_size_of(), and to_str().

◆ append() [2/3]

template<class T >
void bux::append ( const T & src,
std::string & dst )

◆ append() [3/3]

template<class T >
void bux::append ( const T * src,
size_t argN,
std::string & dst )

Definition at line 27 of file Serialize.h.

◆ append_size_of()

template<class T >
void bux::append_size_of ( const T & src,
std::string & dst )

Definition at line 21 of file Serialize.h.

References append().

Referenced by append().

Here is the caller graph for this function:

◆ asciiLiteral() [1/2]

std::string bux::asciiLiteral ( std::string_view utf8)

Definition at line 105 of file LexBase.cpp.

References RUNTIME_ERROR.

◆ asciiLiteral() [2/2]

std::string bux::asciiLiteral ( uint32_t utf32)

◆ BOM() [1/2]

std::wstring bux::BOM ( const std::wstring & ws)

Definition at line 202 of file UnicodeCvt.cpp.

◆ BOM() [2/2]

std::wstring bux::BOM ( const std::wstring_view & ws)

◆ compareReturn()

template<class T >
int bux::compareReturn ( T a)
inline

Definition at line 37 of file SafeArith.h.

◆ createCharLiteral()

template<T_LexID _ID, class T_LexCh >
auto bux::createCharLiteral ( const T_LexCh * c,
size_t n )
nodiscard

Definition at line 103 of file ScannerBase.h.

References createLex(), parseEscapeChar(), RUNTIME_ERROR, and toString().

◆ createDecNum()

template<T_LexID _ID, class T_LexCh >
auto bux::createDecNum ( const T_LexCh * c,
size_t n )
nodiscard

Definition at line 114 of file ScannerBase.h.

References toString().

◆ createEscapeString()

template<T_LexID _ID, class T_LexCh , size_t TRIMLEFT = 0, size_t TRIMRIGHT = 0>
auto bux::createEscapeString ( const T_LexCh * c,
size_t n )
nodiscard

Definition at line 144 of file ScannerBase.h.

References createLex(), escseq2str(), and toString().

◆ createHexNum()

template<T_LexID _ID, class T_LexCh >
auto bux::createHexNum ( const T_LexCh * c,
size_t n )
nodiscard

Definition at line 120 of file ScannerBase.h.

References toString().

◆ createLex() [1/3]

template<class T >
auto bux::createLex ( const T & t)

Definition at line 205 of file LexBase.h.

Referenced by createCharLiteral(), createEscapeString(), and createPlainString().

Here is the caller graph for this function:

◆ createLex() [2/3]

template<class T >
auto bux::createLex ( T & t)

Definition at line 211 of file LexBase.h.

◆ createLex() [3/3]

template<class T , class... T_Args>
auto bux::createLex ( T_Args &&... args)

Definition at line 217 of file LexBase.h.

◆ createNothing()

template<T_LexID _ID, class T_LexCh >
C_ActionRet bux::createNothing ( const T_LexCh * ,
size_t  )
nodiscard

Definition at line 126 of file ScannerBase.h.

◆ createOctNum()

template<T_LexID _ID, class T_LexCh >
auto bux::createOctNum ( const T_LexCh * c,
size_t n )
nodiscard

Definition at line 132 of file ScannerBase.h.

References toString().

◆ createPlainString()

template<T_LexID _ID, class T_LexCh , size_t TRIMLEFT = 0, size_t TRIMRIGHT = 0>
auto bux::createPlainString ( const T_LexCh * c,
size_t n )
nodiscard

Definition at line 138 of file ScannerBase.h.

References createLex(), and toString().

◆ easy_escape()

std::string bux::easy_escape ( std::string_view src)

Replacement of curl_easy_escape() in curl library

Examples
test/test_ezscape.cpp.

Definition at line 13 of file EZScape.cpp.

◆ easy_unescape()

std::string bux::easy_unescape ( std::string_view src)

Replacement of curl_easy_unescape() in curl library

Examples
test/test_ezscape.cpp.

Definition at line 28 of file EZScape.cpp.

References THROW_AS.

◆ escseq2str()

std::string bux::escseq2str ( std::string s)
nodiscard

Definition at line 6 of file ScannerBase.cpp.

References parseEscapeChar(), and to_utf8().

Referenced by createEscapeString().

Here is the caller graph for this function:

◆ expand_env()

std::string bux::expand_env ( const char * s)
Parameters
[in]sInput string containing environment variables.
Returns
Expanded string
Examples
test/test_expand_env.cpp.

Definition at line 44 of file StrUtil.cpp.

◆ fittestType()

template<std::integral T>
std::string bux::fittestType ( T lb,
T ub )
Parameters
lbLower bound of value range
ubUpper bound of value range
Precondition
lb <= ub
Returns
Name of the fittest type
Examples
parsergen/ScannerGen/main.cpp.

Definition at line 14 of file Range2Type.h.

References HRTN.

◆ getKeyPunch()

void bux::getKeyPunch ( std::string_view msg,
int & key,
const char * keyFilter )

Definition at line 165 of file XConsole.cpp.

Referenced by testWritability().

Here is the caller graph for this function:

◆ index2value()

template<class T_Key , class T_Value , class T_ValueOrSize , class T_Traits >
T_Value bux::index2value ( U_K2V< T_Key, T_Value > k2v,
T_ValueOrSize valOrSz,
T_LexID key )

◆ isIdentifier()

bool bux::isIdentifier ( std::string_view s)
nodiscardnoexcept
Examples
parsergen/ScannerGen/main.cpp.

Definition at line 24 of file ScannerBase.cpp.

References skipIdentifier().

◆ load_hashed_str()

std::tuple< std::string, size_t, bool > bux::load_hashed_str ( std::istream & in)

Definition at line 19 of file Serialize.cpp.

◆ logger()

I_SyncLog & bux::logger ( )

◆ logTrace()

std::ostream & bux::logTrace ( std::ostream & out,
const std::chrono::time_zone * tz )
Parameters
outOutput stream to add trace(line prefix) to.
tzPointer to the time zone to convert system clock to. In case of nullptr, the timestamp will use system clock.
Returns
out

Log timestamp & thread id

Examples
test/smoke_timestamp.cpp.

Definition at line 62 of file LogStream.cpp.

References TID_, and timestamp().

Referenced by stamp().

Here is the caller graph for this function:

◆ operator!=()

template<class T >
bool bux::operator!= ( const C_Stack< T > & a,
const C_Stack< T > & b )
noexcept

Definition at line 301 of file Xtack.h.

◆ operator+=() [1/3]

template<class T >
void bux::operator+= ( C_ResourceStack< T > & a,
C_StackBase< T > & b )

◆ operator+=() [2/3]

template<class T >
void bux::operator+= ( C_Stack< T > & a,
const C_Stack< T > & b )

◆ operator+=() [3/3]

template<class T >
void bux::operator+= ( C_Stack< T > & out,
const T * s )

Definition at line 313 of file Xtack.h.

References bux::C_Stack< T >::push().

◆ operator<() [1/2]

bool bux::operator< ( const C_SourcePos & a,
const C_SourcePos & b )
noexcept

Partial relation.

Definition at line 90 of file LexBase.cpp.

◆ operator<() [2/2]

template<class T >
bool bux::operator< ( const C_Stack< T > & a,
const C_Stack< T > & b )
noexcept

Lexical comparison.

Definition at line 280 of file Xtack.h.

◆ operator<<() [1/7]

template<class T >
auto & bux::operator<< ( C_ResourceStack< T > & a,
C_StackBase< T > & b )

◆ operator<<() [2/7]

template<class T >
auto & bux::operator<< ( C_ResourceStack< T > & out,
T & t )

Definition at line 353 of file Xtack.h.

References bux::C_ResourceStack< T >::push().

◆ operator<<() [3/7]

template<class T >
auto & bux::operator<< ( C_Stack< T > & a,
const C_Stack< T > & b )

◆ operator<<() [4/7]

template<class T >
auto & bux::operator<< ( C_Stack< T > & out,
const T & c )

Definition at line 346 of file Xtack.h.

References bux::C_Stack< T >::push().

◆ operator<<() [5/7]

template<class T >
auto & bux::operator<< ( C_Stack< T > & out,
const T * s )

Definition at line 332 of file Xtack.h.

References bux::C_Stack< T >::push().

◆ operator<<() [6/7]

template<IntervalPt T, class charT , class traits = std::char_traits<charT>>
std::basic_ostream< charT, traits > & bux::operator<< ( std::basic_ostream< charT, traits > & out,
const C_Intervals< T > & x )

Definition at line 1 of file Intervals.h.

◆ operator<<() [7/7]

template<class T >
auto & bux::operator<< ( std::basic_ostream< T > & out,
const C_Stack< T > & s )

◆ operator==() [1/2]

bool bux::operator== ( const C_SourcePos & a,
const C_SourcePos & b )
noexcept

Equivalence relation.

Definition at line 83 of file LexBase.cpp.

◆ operator==() [2/2]

template<class T >
bool bux::operator== ( const C_Stack< T > & a,
const C_Stack< T > & b )
noexcept

Definition at line 294 of file Xtack.h.

◆ ord_suffix()

const char * bux::ord_suffix ( size_t i)
Parameters
[in]iOrdinal number
Return values
stif i == 1
ndif i == 2
rdif i == 3
thelse

Definition at line 24 of file StrUtil.cpp.

◆ OXCPT()

std::string bux::OXCPT ( const std::exception & e)
Parameters
[in]eInstance of std::exception descent
Returns
Printable form with reason

Definition at line 128 of file StrUtil.cpp.

References HRTN.

◆ parseEscapeChar()

size_t bux::parseEscapeChar ( std::string_view s,
uint32_t & c,
size_t pos )
nodiscard

Definition at line 30 of file ScannerBase.cpp.

References RUNTIME_ERROR.

Referenced by createCharLiteral(), and escseq2str().

Here is the caller graph for this function:

◆ pressAKey()

void bux::pressAKey ( )
Examples
parsergen/ParserGen/main.cpp.

Definition at line 183 of file XConsole.cpp.

◆ read() [1/3]

template<size_t N, template< typename > class C>
void bux::read ( const std::string & src,
size_t & off,
C< std::array< char, N > > & data )

Definition at line 85 of file Serialize.h.

References read_charr(), and read_size().

◆ read() [2/3]

template<class T >
void bux::read ( const std::string & src,
size_t & off,
T & data )
noexcept

Definition at line 35 of file Serialize.h.

Referenced by read_size().

Here is the caller graph for this function:

◆ read() [3/3]

template<class T >
void bux::read ( const std::string & src,
size_t & off,
T * data,
size_t count )

Definition at line 45 of file Serialize.h.

◆ read_charr()

template<size_t N>
std::array< char, N > bux::read_charr ( const std::string & src,
size_t & off )
noexcept

Definition at line 60 of file Serialize.h.

Referenced by read().

Here is the caller graph for this function:

◆ read_size()

size_t bux::read_size ( const std::string & src,
size_t & off )
noexcept

Definition at line 12 of file Serialize.cpp.

References read().

Referenced by read().

Here is the caller graph for this function:

◆ save_hashed_str()

size_t bux::save_hashed_str ( std::ostream & out,
const std::string & s )

Definition at line 27 of file Serialize.cpp.

◆ scanFile()

template<class T_Char >
void bux::scanFile ( std::string_view filename,
std::istream & in,
I_Scanner< T_Char > & scanner,
T_LexID endToken = TID_EOF,
T_Encoding encoding = 0 )

◆ search_dirs()

std::filesystem::path bux::search_dirs ( const std::filesystem::path & in_path,
const std::ranges::forward_range auto & dirs )

Definition at line 11 of file FsUtil.h.

◆ skipIdentifier()

size_t bux::skipIdentifier ( std::string_view s,
size_t pos )
nodiscardnoexcept

Definition at line 88 of file ScannerBase.cpp.

Referenced by isIdentifier().

Here is the caller graph for this function:

◆ stamp()

std::ostream & bux::stamp ( const C_UseLog & u,
E_LogLevel level )

◆ testWritability()

bool bux::testWritability ( const char * file)
Examples
parsergen/ScannerGen/main.cpp.

Definition at line 195 of file XConsole.cpp.

References append(), and getKeyPunch().

◆ timestamp()

std::ostream & bux::timestamp ( std::ostream & out,
const std::chrono::time_zone * tz )
Parameters
outOutput stream to add timestamp to.
[in]tzPointer to the time zone to convert system clock to. In case of nullptr, the timestamp will use system clock.
Returns
out

Write timestamp in format of "yyyy/mm/dd hh:mm:sss " to out.

Examples
test/smoke_timestamp.cpp.

Definition at line 32 of file LogStream.cpp.

Referenced by logTrace().

Here is the caller graph for this function:

◆ to_str()

template<size_t N>
auto bux::to_str ( const std::array< char, N > & arr)

Definition at line 54 of file Serialize.h.

Referenced by append().

Here is the caller graph for this function:

◆ to_utf8() [1/5]

template<typename T >
auto bux::to_utf8 ( const T * ps,
size_t size = 0,
T_Encoding codepage = 0 )

Definition at line 185 of file UnicodeCvt.h.

References bux::C_MBCStr::strU8().

◆ to_utf8() [2/5]

template<typename T >
auto bux::to_utf8 ( std::basic_string_view< T > s,
T_Encoding codepage = 0 )

Definition at line 187 of file UnicodeCvt.h.

References bux::C_MBCStr::strU8().

◆ to_utf8() [3/5]

std::string bux::to_utf8 ( std::istream & in,
T_Encoding codepage )
Parameters
inReference of input stream passed to ctor of C_UnicodeIn
codepageEncoding type of input stream passed to ctor of C_UnicodeIn. Value 0 means C_UnicodeIn should guess the finest.

HEADSUP: When codepage is 0 and in reference to a stream instance of type std::ifstream, the instance should be opened in binary mode with std::ios::binary for the case that the encoding is actually UTf-16(LE or BE) and input stream contains '\x1a' bytes (ascii EOF), e.g. as part of '\uff1a'. Or the input stream might hit EOF earlier than it should.

std::string load_file_as_u8string(const std::string &path)
{
std::ifstream in{path, std::ios::binary};
return bux::to_utf8(in);
}
std::string_view to_utf8(T_Utf32 uc)

Definition at line 172 of file UnicodeCvt.cpp.

References MAX_UTF8, and RUNTIME_ERROR.

◆ to_utf8() [4/5]

std::string bux::to_utf8 ( std::string_view s,
T_Encoding codepage )

Definition at line 167 of file UnicodeCvt.cpp.

References bux::C_MBCStr::strU8().

◆ to_utf8() [5/5]

std::string_view bux::to_utf8 ( T_Utf32 uc)

Definition at line 157 of file UnicodeCvt.cpp.

References MAX_UTF8, and RUNTIME_ERROR.

Referenced by bux::C_ScannerImpl< T_Input, T_State, T_Char, C_Traits >::add(), bux::C_LexTraits< C_LexUTF32 >::appendUTF8(), and escseq2str().

Here is the caller graph for this function:

◆ toInt()

template<class T_Lex , template< class > class C_Ptr>
int bux::toInt ( const C_LexInfoT< T_Lex, C_Ptr > & lex)

Definition at line 178 of file ParserBase.h.

References bux::C_IntegerLex::value().

◆ toString()

template<class T_LexCh >
auto bux::toString ( const T_LexCh * c,
size_t start,
size_t end )
nodiscardnoexcept

Definition at line 94 of file ScannerBase.h.

Referenced by createCharLiteral(), createDecNum(), createEscapeString(), createHexNum(), createOctNum(), and createPlainString().

Here is the caller graph for this function:

◆ tryUnlex() [1/2]

template<class T_Data , class T_Lex , template< class > class C_Ptr>
auto bux::tryUnlex ( const C_LexInfoT< T_Lex, C_Ptr > & lex)

Definition at line 172 of file ParserBase.h.

References bux::C_LexInfoT< T, C_Ptr >::m_attr, and tryUnlex().

◆ tryUnlex() [2/2]

template<class T_Data , class T_Lex , template< class > class C_Ptr>
T_CoConst< T_Data, T_Lex > * bux::tryUnlex ( const C_Ptr< T_Lex > & lex)
Examples
parsergen/example/BisonGLR/main.cpp.

Definition at line 163 of file ParserBase.h.

Referenced by bux::GLR::tryDupLex(), bux::GLR::tryDupLex(), and tryUnlex().

Here is the caller graph for this function:

◆ unlex() [1/4]

template<class T_Data , class T_Lex , template< class > class C_Ptr>
auto & bux::unlex ( const C_LexInfoT< T_Lex, C_Ptr > & lex)

Definition at line 157 of file ParserBase.h.

References bux::C_LexInfoT< T, C_Ptr >::m_attr, and unlex().

◆ unlex() [2/4]

template<class T_Data , class T_Lex , template< class > class C_Ptr>
auto & bux::unlex ( const C_Ptr< T_Lex > & lex)

Definition at line 151 of file ParserBase.h.

References bux::C_LexDataT< T_Data >::m_data.

◆ unlex() [3/4]

template<class T >
auto & bux::unlex ( const I_LexAttr & lex)

Definition at line 145 of file ParserBase.h.

◆ unlex() [4/4]

template<class T >
auto & bux::unlex ( I_LexAttr & lex)
Examples
JSON/src/ParseJSON.cpp, and parsergen/example/CalcInt/main.cpp.

Definition at line 139 of file ParserBase.h.

Referenced by bux::GLR::dupLex(), and unlex().

Here is the caller graph for this function:

Variable Documentation

◆ MIN_TOKEN_ID

const uint32_t bux::MIN_TOKEN_ID = 0x70000000
constinit