libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
GblPattern Struct Reference

#include <gimbal_pattern.h>

Related Symbols

(Note that these are not member symbols.)

Lifetime Management

Methods for creating, referencing, and unreferencing patterns

const GblPatternGblPattern_create (const char *pRegExp)
 
const GblPatternGblPattern_ref (const GblPattern *pSelf)
 
GblRefCount GblPattern_unref (const GblPattern *pSelf)
 
GblRefCount GblPattern_refCount (const GblPattern *pSelf)
 
GblRefCount GblPattern_totalCount (void)
 
Properties and Operators

Methods for getters and basic operations

int GblPattern_compare (const GblPattern *pSelf, const GblPattern *pRhs)
 
GblBool GblPattern_equals (const GblPattern *pSelf, const GblPattern *pRhs)
 
size_t GblPattern_bytes (const GblPattern *pSelf)
 
const char * GblPattern_string (const GblPattern *pSelf, GblStringBuffer *pBuff)
 
Matching

Methods for generic pattern matching

GblBool GblPattern_match (const GblPattern *pSelf, const char *pString, GblStringView *pMatch, int *pCount)
 
GblBool GblPattern_matchStr (const char *pRegExp, const char *pString, GblStringView *pMatch, int *pCount)
 
Inverse Matching

Methods for returning non matches

GblBool GblPattern_matchNot (const GblPattern *pSelf, const char *pString, GblStringView *pMatch, int *pCount)
 
GblBool GblPattern_matchNotStr (const char *pRegExp, const char *pString, GblStringView *pMatch, int *pCount)
 
Exact Matching

Methods for checking exact matches

GblBool GblPattern_matchExact (const GblPattern *pSelf, const char *pString)
 
GblBool GblPattern_matchExactStr (const char *pRegExp, const char *pString)
 
Match Counting

Methods used for counting matches

size_t GblPattern_matchCount (const GblPattern *pSelf, const char *pString)
 
size_t GblPattern_matchCountStr (const char *pRegExp, const char *pString)
 

Detailed Description

Opaque structure containing a compiled regular expression.

GblPattern is the compiled version of a regular expression string, produced by GblPattern_create(). It is faster than working with raw regular expression strings, since preprocessing has already been done.

It is advised that when you are repeatedly using the same regular expression, you store it and use it as a GblPattern.

Note
GblPattern is a reference-counted shared pointer type.

Friends And Related Symbol Documentation

◆ GblPattern_create()

const GblPattern * GblPattern_create ( const char *  pRegExp)
related

Compiles the given regular expression into a pre-processed GblPattern.

◆ GblPattern_ref()

const GblPattern * GblPattern_ref ( const GblPattern pSelf)
related

Returns a new reference to an existing pattern, incrementing its refcount.

◆ GblPattern_unref()

GblRefCount GblPattern_unref ( const GblPattern pSelf)
related

Releases a reference to a pattern, deallocating it upon reaching zero.

◆ GblPattern_refCount()

GblRefCount GblPattern_refCount ( const GblPattern pSelf)
related

Returns the number of active references held to the given compiled pattern.

◆ GblPattern_totalCount()

GblRefCount GblPattern_totalCount ( void  )
related

Returns the total number of active, allocated, compiled regex patterns.

◆ GblPattern_compare()

int GblPattern_compare ( const GblPattern pSelf,
const GblPattern pRhs 
)
related

Compares two different compiled patterns to see if they are equivalent regexes.

◆ GblPattern_equals()

GblBool GblPattern_equals ( const GblPattern pSelf,
const GblPattern pRhs 
)
related

Compares two different compiled patterns for exact value equality of their regexes.

◆ GblPattern_bytes()

size_t GblPattern_bytes ( const GblPattern pSelf)
related

Counts the total size of a compiled pattern and returns it in bytes.

◆ GblPattern_string()

const char * GblPattern_string ( const GblPattern pSelf,
GblStringBuffer pBuff 
)
related

Reconstructs an approximate string representation of the compiled pattern.

◆ GblPattern_match()

GblBool GblPattern_match ( const GblPattern pSelf,
const char *  pString,
GblStringView pMatch,
int *  pCount 
)
related

Finds the numbered match given by pCount, or 1 if NULL.

GblPattern_match() searches through pString for substrings which match the pattern given by pSelf. When it has found the number of matches equal to the value given by pCount (or 1 if pCount is NULL), pMatch is set to the substring of the final match (or ignored when NULL) and GBL_TRUE is returned. If the match could not be found, GBL_FALSE is returned.

Note
When pCount points to a value of 0, no matches are expected to be found. If a match is found, GBL_FALSE is returned, otherwise GBL_TRUE is returned (inverted from normal).
When pCount points to a value of -1, all matches are searched, with pMatch being updated to point to the final one and pCount being updated to store the final number of matches.
Parameters
pSelfThe precompiled regular expression pattern
pStringThe input string to search for matches within
pMatch(Optional) Output used to hold the final match substring
pCount(Optional, defaults to 1) Number of matches to find
Return values
GBL_FALSEThe requested match number wasn't found.
GBL_TRUEThe requested match number was found.
See also
GblPattern_matchNot()

◆ GblPattern_matchStr()

GblBool GblPattern_matchStr ( const char *  pRegExp,
const char *  pString,
GblStringView pMatch,
int *  pCount 
)
related

Dynamically-compiled string-based version of GblPattern_match()

◆ GblPattern_matchNot()

GblBool GblPattern_matchNot ( const GblPattern pSelf,
const char *  pString,
GblStringView pMatch,
int *  pCount 
)
related

Behaves like GblPattern_match() except searching for NON-MATCHES.

◆ GblPattern_matchNotStr()

GblBool GblPattern_matchNotStr ( const char *  pRegExp,
const char *  pString,
GblStringView pMatch,
int *  pCount 
)
related

Dynamically-compiled string-based version of GblPattern_matchNot()

◆ GblPattern_matchExact()

GblBool GblPattern_matchExact ( const GblPattern pSelf,
const char *  pString 
)
related

Returns GBL_TRUE if the given string EXACTLY matches the given pattern or GBL_FALSE otherwise.

◆ GblPattern_matchExactStr()

GblBool GblPattern_matchExactStr ( const char *  pRegExp,
const char *  pString 
)
related

Dynamically compiled string-based version of GblPattern_matchExact()

◆ GblPattern_matchCount()

size_t GblPattern_matchCount ( const GblPattern pSelf,
const char *  pString 
)
related

Returns the number of pattern matches found in pString.

◆ GblPattern_matchCountStr()

size_t GblPattern_matchCountStr ( const char *  pRegExp,
const char *  pString 
)
related

Dynamically compiled, string-based version of GblPattern_matchExact()


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