Skip to main content

Windows125xStringPointerAssertions

Short summary

This class provides assert statements for Windows-1252 and Windows-1251 strings. Used encoding is specified in Tc2_Utilities.GLOBAL_SBCS_TABLE global variable

Attention: All strings are handled as null-terminated byte streams

AccessAbstractFinalExtendsImplements
INTERNALNoNoAbstractStringPointerAssertionsIWindows125xStringPointerAssertions

UML Diagram

Properties

className

Type: CNM_AbstractObject.ClassName

This abstract property returns the class name of the concrete object,

Methods

contains

  • Parameters:
    • stringToCheck (POINTER TO BYTE): current string to check
    • searchString (POINTER TO BYTE): string must be found in stringToCheck
    • ignoreCases (BOOL): TRUE means ignore cases; FALSE means that cases must be equal too
    • message (AssertMessage): message if the assertion is false
    • sbcsType (Tc2_Utilities.E_SBCSType): used Single Byte Character Set (SBCS), is set in Tc2_Utilities.GLOBAL_SBCS_TABLE
  • Return type: VOID

This assertion method checks if the current string stringToCheck contains the search string searchString.

containsNo

  • Parameters:
    • stringToCheck (POINTER TO BYTE): current string to check
    • searchString (POINTER TO BYTE): string must be found in stringToCheck
    • ignoreCases (BOOL): TRUE means ignore cases; FALSE means that cases must be equal too
    • message (AssertMessage): message if the assertion is false
    • sbcsType (Tc2_Utilities.E_SBCSType): used Single Byte Character Set (SBCS), is set in Tc2_Utilities.GLOBAL_SBCS_TABLE
  • Return type: VOID

This assertion method checks if the current string stringToCheck doesn't contain the search string searchString.

endsWith

  • Parameters:
    • stringToCheck (POINTER TO BYTE): current string to check
    • end (POINTER TO BYTE): string must be the end of stringToCheck
    • ignoreCases (BOOL): TRUE means ignore cases; FALSE means that cases must be equal too
    • trim (BOOL): TRUE means truncation of spaces on the right side of stringToCheck
    • message (AssertMessage): message if the assertion is false
    • sbcsType (Tc2_Utilities.E_SBCSType): used Single Byte Character Set (SBCS), is set in Tc2_Utilities.GLOBAL_SBCS_TABLE
  • Return type: VOID

This assertion method checks if the current string stringToCheck ends with the string end.

freeMemory

  • Parameters:
    • stringAddress (POINTER TO BYTE): start address of the memory to free
    • freeAllocatedMemory (BOOL): TRUE means free the memory, FALSE means do not free the memory
  • Return type: VOID

This method is used to free allocated memory if needed

getNewUpperCaseString

  • Parameters:
    • stringAddress (POINTER TO BYTE): start address of the string to copy and capitalize
    • stringLength (UDINT): length of the string stringAddress
    • createNewUpperCaseString (BOOL): TRUE means meake a copy and capitalize it, FALSEmeans return juststringAddress`` and do nothing else
    • sbcsType (Tc2_Utilities.E_SBCSType): used Single Byte Character Set (SBCS), is set in Tc2_Utilities.GLOBAL_SBCS_TABLE
  • Return type: POINTER TO BYTE

this methods copy a string and returns the start address of new string,

getStringCopy

  • Parameters:
    • stringAddress (POINTER TO BYTE): string to copy
    • stringLength (UDINT): length of the string
  • Return type: POINTER TO BYTE

this methods copy a string and returns the start address of new string

getStringLength

  • Parameters:
    • stringAddress (POINTER TO BYTE): Start address of the string for which the length is to be determined
  • Return type: UDINT

this methods returns the length of a null-terminated string in bytes

isCharWhiteSpace

  • Parameters:
    • character (BYTE): character to check if it's whitespace
  • Return type: BOOL

this methods checks if a windows-1252 or a windows-1251 character is a whitespace character

isEqualTo

  • Parameters:
    • stringToCheck (POINTER TO BYTE): current string to check
    • expected (POINTER TO BYTE): stringToCheck must be equal to expected
    • ignoreCases (BOOL): TRUE means ignore cases; FALSE means that cases must be equal too
    • message (AssertMessage): message if the assertion is false
    • sbcsType (Tc2_Utilities.E_SBCSType): used Single Byte Character Set (SBCS), is set in Tc2_Utilities.GLOBAL_SBCS_TABLE
  • Return type: VOID

This assertion method checks if the current string stringToCheck is equal to expected.

isNotEqualTo

  • Parameters:
    • stringToCheck (POINTER TO BYTE): current string to check
    • unexpected (POINTER TO BYTE): stringToCheck must be not equal to expected
    • ignoreCases (BOOL): TRUE means ignore cases; FALSE means that cases must be equal too
    • message (AssertMessage): message if the assertion is false
    • sbcsType (Tc2_Utilities.E_SBCSType): used Single Byte Character Set (SBCS), is set in Tc2_Utilities.GLOBAL_SBCS_TABLE
  • Return type: VOID

This assertion method checks if the current string stringToCheck is not equal to unexpected.

lengthIsBetween

  • Parameters:
    • stringToCheck (POINTER TO BYTE): current string to check
    • minLength (UDINT): lower limit of the string length
    • maxLength (UDINT): upper limit of the string length
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current string stringToCheck length is between minLength and maxLength.

lengthIsExact

  • Parameters:
    • stringToCheck (POINTER TO BYTE): current string to check
    • expectedLength (UDINT): expected length of stringToCheck
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current string stringToCheck length is equal to expectedLength.

lengthIsMax

  • Parameters:
    • stringToCheck (POINTER TO BYTE): current string to check
    • maxLength (UDINT): upper limit of the length of stringToCheck
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current string stringToCheck length is equal or less than to maxLength.

lengthIsMin

  • Parameters:
    • stringToCheck (POINTER TO BYTE): current string to check
    • minLength (UDINT): lower limit of the length of stringToCheck
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current string stringToCheck length is equal or greater than to minLength.

startsWith

  • Parameters:
    • stringToCheck (POINTER TO BYTE): current string to check
    • start (POINTER TO BYTE): expected start of stringToCheck
    • ignoreCases (BOOL): TRUE means ignore cases; FALSE means that cases must be equal too
    • trim (BOOL): TRUE means truncation of spaces on the left side of stringToCheck
    • message (AssertMessage): message if the assertion is false
    • sbcsType (Tc2_Utilities.E_SBCSType): used Single Byte Character Set (SBCS), is set in Tc2_Utilities.GLOBAL_SBCS_TABLE
  • Return type: VOID

This assertion method checks if the current string stringToCheck starts with string start.

trimLeft

  • Parameters:
    • stringAddress (POINTER TO BYTE): start address of the string
    • stringLength (UDINT): length of the string stringAddress
    • trimString (BOOL): TRUE means remove the whitespace, FALSE means do not remove the whitespace
  • Return type: VOID

This method is used to remove the whitespace from the start of the string.

trimRight

  • Parameters:
    • stringAddress (POINTER TO BYTE): start address of the string
    • stringLength (UDINT): length of the string stringAddress
    • trimString (BOOL): TRUE means remove the whitespace, FALSE means do not remove the whitespace
  • Return type: VOID

This method is used to remove the whitespace from the end of the string.

upperCase

  • Parameters:
    • stringAddress (POINTER TO BYTE): string to ucase
    • stringLength (UDINT): length of the string
    • sbcsType (Tc2_Utilities.E_SBCSType): used Single Byte Character Set (SBCS), is set in Tc2_Utilities.GLOBAL_SBCS_TABLE
  • Return type: VOID

This method converts the lowercase letters in an 8 bit windows-1252 or windows-1251

upperCase1251

  • Parameters:
    • stringAddress (POINTER TO BYTE): string to ucase
    • stringLength (UDINT): length of the string
  • Return type: VOID

This method converts the lowercase letters in an 8 bit windows-1251

upperCase1252

  • Parameters:
    • stringAddress (POINTER TO BYTE): string to ucase
    • stringLength (UDINT): length of the string
  • Return type: VOID

This method converts the lowercase letters in an 8 bit windows-1252

Code

Declaration

{attribute 'reflection'}
FUNCTION_BLOCK INTERNAL Windows125xStringPointerAssertions EXTENDS AbstractStringPointerAssertions IMPLEMENTS IWindows125xStringPointerAssertions