OpenCore
1.0.4
OpenCore Bootloader
|
#include <Base.h>
#include <Library/BaseLib.h>
#include <Library/BaseOverflowLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PrintLib.h>
#include <Library/OcStringLib.h>
Go to the source code of this file.
Functions | |
BOOLEAN | IsAsciiPrint (IN CHAR8 Char) |
INTN | IsAsciiAlpha (IN CHAR8 Char) |
INTN | IsAsciiSpace (IN CHAR8 Char) |
BOOLEAN | IsAsciiNumber (IN CHAR8 Char) |
VOID | AsciiUefiSlashes (IN OUT CHAR8 *String) |
VOID | AsciiUnixSlashes (IN OUT CHAR8 *String) |
CHAR16 * | AsciiStrCopyToUnicode (IN CONST CHAR8 *AsciiString, IN UINTN Length) |
BOOLEAN | AsciiUint64ToLowerHex (OUT CHAR8 *Buffer, IN UINT32 BufferSize, IN UINT64 Value) |
EFI_STATUS EFIAPI | OcAsciiSafeSPrint (OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString,...) |
INTN EFIAPI | OcAsciiStrniCmp (IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString, IN UINTN Length) |
BOOLEAN EFIAPI | OcAsciiEndsWith (IN CONST CHAR8 *String, IN CONST CHAR8 *SearchString, IN BOOLEAN CaseInsensitiveMatch) |
BOOLEAN EFIAPI | OcAsciiStartsWith (IN CONST CHAR8 *String, IN CONST CHAR8 *SearchString, IN BOOLEAN CaseInsensitiveMatch) |
CHAR8 *EFIAPI | OcAsciiStriStr (IN CONST CHAR8 *String, IN CONST CHAR8 *SearchString) |
CHAR8 *EFIAPI | OcAsciiStrChr (IN CONST CHAR8 *String, IN CHAR8 Char) |
CHAR8 *EFIAPI | OcAsciiStrrChr (IN CONST CHAR8 *String, IN CHAR8 Char) |
BOOLEAN | OcAsciiStringNPrintable (IN CONST CHAR8 *String, IN UINTN Number) |
EFI_STATUS EFIAPI | OcAsciiStrToRawGuid (IN CONST CHAR8 *String, OUT GUID *Guid) |
VOID | AsciiFilterString (IN OUT CHAR8 *String, IN BOOLEAN SingleLine) |
VOID EFIAPI | OcAsciiPrintBuffer (IN OUT CHAR8 **AsciiBuffer, IN OUT UINTN *AsciiBufferSize, IN CONST CHAR8 *FormatString,...) |
CHAR8 * | OcAsciiToLower (CHAR8 *Str) |
Copyright (C) 2016 - 2018, The HermitCrabs Lab. All rights reserved.
All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Definition in file OcAsciiLib.c.
VOID AsciiFilterString | ( | IN OUT CHAR8 * | String, |
IN BOOLEAN | SingleLine ) |
Filter string from unprintable characters.
[in,out] | String | String to filter. |
[in] | SingleLine | Enforce only one line. |
Definition at line 480 of file OcAsciiLib.c.
CHAR16 * AsciiStrCopyToUnicode | ( | IN CONST CHAR8 * | AsciiString, |
IN UINTN | Length ) |
Convert null terminated ascii string to unicode.
[in] | String1 | A pointer to the ascii string to convert to unicode. |
[in] | Length | Length or 0 to calculate the length of the ascii string to convert. |
A | pointer to the converted unicode string allocated from pool. |
Definition at line 119 of file OcAsciiLib.c.
VOID AsciiUefiSlashes | ( | IN OUT CHAR8 * | String | ) |
Convert path with mixed slashes to UEFI slashes (\).
[in,out] | String | Path. |
Definition at line 86 of file OcAsciiLib.c.
BOOLEAN AsciiUint64ToLowerHex | ( | OUT CHAR8 * | Buffer, |
IN UINT32 | BufferSize, | ||
IN UINT64 | Value ) |
Convert 64-bit unsigned integer to a nul-terminated hex string.
[out] | Buffer | Destination buffer. |
[in] | BufferSize | Destination buffer size in bytes. |
[in] | Value | Value to convert. |
TRUE | on fit |
Definition at line 150 of file OcAsciiLib.c.
VOID AsciiUnixSlashes | ( | IN OUT CHAR8 * | String | ) |
Convert path with mixed slashes to Unix slashes (/).
[in,out] | String | Path. |
Definition at line 99 of file OcAsciiLib.c.
INTN IsAsciiAlpha | ( | IN CHAR8 | Char | ) |
Check if character is alphabetical.
[in] | Char | The ascii character to check if is alphabetical. |
TRUE,if | character is alphabetical. |
Definition at line 49 of file OcAsciiLib.c.
BOOLEAN IsAsciiNumber | ( | IN CHAR8 | Char | ) |
Check if character is a number.
[in] | Char | The ascii character to check if is number. |
TRUE,if | character is a number. |
Definition at line 78 of file OcAsciiLib.c.
BOOLEAN IsAsciiPrint | ( | IN CHAR8 | Char | ) |
Check if character is printable
[in] | Char | The ascii character to check if is printable. |
TRUE,if | character is printable. |
Definition at line 33 of file OcAsciiLib.c.
INTN IsAsciiSpace | ( | IN CHAR8 | Char | ) |
Check if character is a white space character.
[in] | Char | The ascii character to check if is white space. |
TRUE,if | character is a white space character. |
Definition at line 65 of file OcAsciiLib.c.
BOOLEAN EFIAPI OcAsciiEndsWith | ( | IN CONST CHAR8 * | String, |
IN CONST CHAR8 * | SearchString, | ||
IN BOOLEAN | CaseInsensitiveMatch ) |
Check if ASCII string ends with another ASCII string.
[in] | String | A pointer to a Null-terminated ASCII string. |
[in] | SearchString | A pointer to a Null-terminated ASCII string to compare against String. |
[in] | CaseInsensitiveMatch | Perform case-insensitive comparison. |
TRUE | if String ends with SearchString. |
Definition at line 265 of file OcAsciiLib.c.
VOID EFIAPI OcAsciiPrintBuffer | ( | IN OUT CHAR8 ** | AsciiBuffer, |
IN OUT UINTN * | AsciiBufferSize, | ||
IN CONST CHAR8 * | FormatString, | ||
... ) |
Write formatted ASCII strings to buffers.
[in,out] | AsciiBuffer | A pointer to the output buffer for the produced Null-terminated ASCII string. |
[in,out] | AsciiBufferSize | The size, in bytes, of the output buffer specified by AsciiBuffer. |
[in] | FormatString | A Null-terminated ASCII format string. |
[in] | ... | Variable argument list whose contents are accessed based on the format string specified by FormatString. |
Definition at line 510 of file OcAsciiLib.c.
EFI_STATUS EFIAPI OcAsciiSafeSPrint | ( | OUT CHAR8 * | StartOfBuffer, |
IN UINTN | BufferSize, | ||
IN CONST CHAR8 * | FormatString, | ||
... ) |
Alternative to AsciiSPrint, which checks that the buffer can contain all the characters.
[out] | StartOfBuffer | A pointer to the output buffer for the produced Null-terminated ASCII string. |
[in] | BufferSize | The size, in bytes, of the output buffer specified by StartOfBuffer. |
[in] | FormatString | A Null-terminated ASCII format string. |
[in] | ... | Variable argument list whose contents are accessed based on the format string specified by FormatString. |
EFI_SUCCESS | When data was printed to supplied buffer. |
EFI_OUT_OF_RESOURCES | When supplied buffer cannot contain all the characters. |
Definition at line 190 of file OcAsciiLib.c.
BOOLEAN EFIAPI OcAsciiStartsWith | ( | IN CONST CHAR8 * | String, |
IN CONST CHAR8 * | SearchString, | ||
IN BOOLEAN | CaseInsensitiveMatch ) |
Check if ASCII string starts with another ASCII string.
[in] | String | A pointer to a Null-terminated ASCII string. |
[in] | SearchString | A pointer to a Null-terminated ASCII string to compare against String. |
[in] | CaseInsensitiveMatch | Perform case-insensitive comparison. |
TRUE | if String starts with SearchString. |
Definition at line 291 of file OcAsciiLib.c.
CHAR8 *EFIAPI OcAsciiStrChr | ( | IN CONST CHAR8 * | String, |
IN CHAR8 | Char ) |
Returns a pointer to the first occurrence of Char in a Null-terminated ASCII string.
If String is NULL, then ASSERT().
If PcdMaximumAsciiStringLength is not zero, and String contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT().
[in] | String | The pointer to a Null-terminated ASCII string. |
[in] | Char | Character to be located. |
NULL | If Char cannot be found in String. |
Definition at line 369 of file OcAsciiLib.c.
BOOLEAN OcAsciiStringNPrintable | ( | IN CONST CHAR8 * | String, |
IN UINTN | Number ) |
Check if a string up to N bytes is ASCII-printable.
[in] | String | String to be checked. |
[in] | Number | Number of bytes to scan. |
TRUE | If String within Number bytes is all ASCII-printable. |
Definition at line 418 of file OcAsciiLib.c.
CHAR8 *EFIAPI OcAsciiStriStr | ( | IN CONST CHAR8 * | String, |
IN CONST CHAR8 * | SearchString ) |
Returns the first occurrence of a Null-terminated ASCII sub-string in a Null-terminated ASCII string through a case insensitive comparison.
This function scans the contents of the Null-terminated ASCII string specified by String and returns the first occurrence of SearchString. If SearchString is not found in String, then NULL is returned. If the length of SearchString is zero, then String is returned.
If String is NULL, then ASSERT(). If SearchString is NULL, then ASSERT().
If PcdMaximumAsciiStringLength is not zero, and SearchString or String contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT().
[in] | String | The pointer to a Null-terminated ASCII string. |
[in] | SearchString | The pointer to a Null-terminated ASCII string to search for. |
NULL | If the SearchString does not appear in String. |
Definition at line 327 of file OcAsciiLib.c.
INTN EFIAPI OcAsciiStrniCmp | ( | IN CONST CHAR8 * | FirstString, |
IN CONST CHAR8 * | SecondString, | ||
IN UINTN | Length ) |
Compares up to a specified length the contents of two Null-terminated ASCII strings using case insensitive comparisons, and returns the difference between the first mismatched ASCII characters.
This function compares the Null-terminated ASCII string FirstString to the Null-terminated ASCII string SecondString using case insensitive comparisons. At most, Length ASCII characters will be compared. If Length is 0, then 0 is returned. If FirstString is identical to SecondString, then 0 is returned. Otherwise, the value returned is the first mismatched upper case ASCII character in SecondString subtracted from the first mismatched upper case ASCII character in FirstString.
If Length > 0 and FirstString is NULL, then ASSERT(). If Length > 0 and SecondString is NULL, then ASSERT(). TODO If PcdMaximumAsciiStringLength is not zero, and Length is greater than PcdMaximumAsciiStringLength, then ASSERT(). If PcdMaximumAsciiStringLength is not zero, and FirstString contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT(). If PcdMaximumAsciiStringLength is not zero, and SecondString contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT().
[in] | FirstString | A pointer to a Null-terminated ASCII string. |
[in] | SecondString | A pointer to a Null-terminated ASCII string. |
[in] | Length | The maximum number of ASCII characters to compare. |
==0 | FirstString is identical to SecondString using case insensitive comparisons. |
others | FirstString is not identical to SecondString using case insensitive comparisons. |
Definition at line 226 of file OcAsciiLib.c.
CHAR8 *EFIAPI OcAsciiStrrChr | ( | IN CONST CHAR8 * | String, |
IN CHAR8 | Char ) |
Returns a pointer to the last occurrence of Char in a Null-terminated ASCII string.
If String is NULL, then ASSERT().
If PcdMaximumAsciiStringLength is not zero, and String contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT().
[in] | String | The pointer to a Null-terminated ASCII string. |
[in] | Char | Character to be located. |
NULL | If Char cannot be found in String. |
Definition at line 392 of file OcAsciiLib.c.
EFI_STATUS EFIAPI OcAsciiStrToRawGuid | ( | IN CONST CHAR8 * | String, |
OUT GUID * | Guid ) |
Convert a Null-terminated ASCII GUID string to a value of type EFI_GUID with RFC 4122 (raw) encoding.
[in] | String | Pointer to a Null-terminated ASCII string. |
[out] | Guid | Pointer to the converted GUID. |
EFI_SUCCESS | Guid is translated from String. |
EFI_INVALID_PARAMETER | If String is NULL. If Data is NULL. |
EFI_UNSUPPORTED | If String is not as the above format. |
Definition at line 458 of file OcAsciiLib.c.
CHAR8 * OcAsciiToLower | ( | CHAR8 * | Str | ) |
Convert a null-terminated ASCII string, in-place, to all lowercase. Then return it.
Str | The null-terminated string to be converted to all lowercase. |
Definition at line 555 of file OcAsciiLib.c.