Log Views
PBLogView
Opaque object handle:
This is a subclass of PBElement. You can safely cast from PBLogView to PBElement. To cast from PBElement to PBLogView, call PBLogViewCast; this performs a runtime assertion to check the cast is possible. This function is thread-safe.
This object maintains an internal reference count. When the reference count reaches zero, the object will be automatically deallocated. To increment the reference count, call PBElementRetain; to decrement the reference count, call PBElementRelease. These functions are thread-safe.
PBLogViewFlags
Enumeration/bitset of type uint32_t:
Constants
PBLogView_ALLOW_SELECTION
PBLogView_ALLOW_SELECTION = 1<<7
Allow the user to select and copy the text in the view.
Or any of the values from PBElementFlags.
PBLogViewAttribute
Enumeration/bitset of type uint8_t:
Constants
PBLogViewAttribute_DEFAULT
PBLogViewAttribute_DEFAULT = 7
The default set of attributes.
PBLogViewAttribute_BOLD
PBLogViewAttribute_BOLD = 1<<7
Increase the text's weight.
PBLogViewAttribute_UNDERLINE
PBLogViewAttribute_UNDERLINE = 1<<6
Reserved.
PBLogViewAttribute_COLOR_MASK
PBLogViewAttribute_COLOR_MASK = 7
The bitmask of the attributes containing the text color.
PBLogViewProcessInputFlags
Enumeration/bitset of type uint32_t:
Constants
PBLogViewProcessInput_CONVERT_TO_HEX
PBLogViewProcessInput_CONVERT_TO_HEX = 1<<0
Append each byte as a hexadecimal string.
PBLogViewProcessInput_PARSE_ANSI_ESCAPE_SEQUENCES
PBLogViewProcessInput_PARSE_ANSI_ESCAPE_SEQUENCES = 1<<1
Parse ANSI escape codes to automatically apply attributes to the input. Only a small subset of escape sequences are currently supported. Some state is tracked across calls to PBLogViewProcessInput for this to work. PBLogViewClear does not reset this state.
PBMessageLogViewParseAPC
Structure: A message sent when an APC string is processed by the log view. That is, it may be sent during a call to PBLogViewProcessInput with the flag PBLogViewProcessInput_PARSE_ANSI_ESCAPE_SEQUENCES set. It is not safe to recurse into PBLogViewProcessInput while processing this message.
Fields
string (referenced string): The APC string.
isFinal (bool
): True if this message concludes the APC string. Otherwise, the next APC message will contain a continuation of this string.
PBLogViewCreate
Function:
Syntax (C/C++)
PBLogViewPtr _Nullable PBLogViewCreate(PBScrollViewRef parent,
PBLogViewFlags flags);
Syntax (Python)
LogViewCreate(parent, flags) -> (logView)
Parameters and Return Values
[in] parent (referenced PBScrollView):
[in] flags (PBLogViewFlags):
[out] logView (nullable owned PBLogView):
PBLogViewAppend
Function:
Syntax (C/C++)
void PBLogViewAppend(PBLogViewRef view, uint8_t character,
PBLogViewAttribute attribute);
Syntax (Python)
LogViewAppend(view, character, attribute)
Parameters and Return Values
[in] view (referenced PBLogView):
[in] character (uint8_t
):
[in] attribute (PBLogViewAttribute):
PBLogViewProcessInput
Function:
Syntax (C/C++)
void PBLogViewProcessInput(PBLogViewRef view, ConstStr inputString,
PBLogViewProcessInputFlags flags);
Syntax (Python)
LogViewProcessInput(view, inputString, flags)
Parameters and Return Values
[in] view (referenced PBLogView):
[in] inputString (referenced string):
[in] flags (PBLogViewProcessInputFlags):
PBLogViewClear
Function:
Syntax (C/C++)
void PBLogViewClear(PBLogViewRef view);
Syntax (Python)
LogViewClear(view)
Parameters and Return Values
[in] view (referenced PBLogView):
PBLogViewRefresh
Function:
Syntax (C/C++)
void PBLogViewRefresh(PBLogViewRef view);
Syntax (Python)
LogViewRefresh(view)
Parameters and Return Values
[in] view (referenced PBLogView):
PBLogViewGetContents
Function:
Syntax (C/C++)
MutStr PBLogViewGetContents(PBLogViewRef view);
Syntax (Python)
LogViewGetContents(view) -> (string)
Parameters and Return Values
[in] view (referenced PBLogView):
[out] string (owned string):
PBLogViewGetContentAttributes
Function:
Syntax (C/C++)
MutStr PBLogViewGetContentAttributes(PBLogViewRef view);
Syntax (Python)
LogViewGetContentAttributes(view) -> (attributes)
Parameters and Return Values
[in] view (referenced PBLogView):
[out] attributes (owned string): Each byte in the string gives a PBLogViewAttribute.
Discussion
The returned string will have the same length as the string returned by PBLogViewGetContents.
See Also
PBLogViewGetCurrentRowIndex
Function:
Syntax (C/C++)
uint64_t PBLogViewGetCurrentRowIndex(PBLogViewRef view);
Syntax (Python)
LogViewGetCurrentRowIndex(view) -> (rowIndex)
Parameters and Return Values
[in] view (referenced PBLogView):
[out] rowIndex (uint64_t
):
PBLogViewScrollToRowByIndex
Function:
Syntax (C/C++)
void PBLogViewScrollToRowByIndex(PBLogViewRef view, uint64_t rowIndex);
Syntax (Python)
LogViewScrollToRowByIndex(view, rowIndex)
Parameters and Return Values
[in] view (referenced PBLogView):
[in] rowIndex (uint64_t
):
PBLogViewSetTextStyle
Function:
Syntax (C/C++)
void PBLogViewSetTextStyle(PBLogViewRef view, PBTextStyleRef textStyle);
Syntax (Python)
LogViewSetTextStyle(view, textStyle)
Parameters and Return Values
[in] view (referenced PBLogView):
[in] textStyle (referenced PBTextStyle):
PBLogViewFindText
Function:
Syntax (C/C++)
bool PBLogViewFindText(PBLogViewRef logView, ConstStr needle, uintptr_t fromByte,
uintptr_t toByte, PBTextDocumentFindTextFlags flags,
/* output */ uintptr_t * __restrict index);
Syntax (Python)
LogViewFindText(logView, needle, fromByte, toByte, flags) -> (didFind, index)
Parameters and Return Values
[in] logView (referenced PBLogView):
[in] needle (referenced string):
[in] fromByte (uintptr_t
):
[in] toByte (uintptr_t
):
[in] flags (PBTextDocumentFindTextFlags):
[out] didFind (bool
):
[out] index (uintptr_t
):
PBLogViewSelect
Function: Set the range of selected text in a log view.
Syntax (C/C++)
void PBLogViewSelect(PBLogViewRef logView, uintptr_t anchor, uintptr_t caret,
PBEnsureVisibleMode ensureVisibleMode);
Syntax (Python)
LogViewSelect(logView, anchor, caret, ensureVisibleMode)
Parameters and Return Values
[in] logView (referenced PBLogView): The log view object.
[in] anchor (uintptr_t
): The position of the selection anchor, in bytes from the start of the buffer.
[in] caret (uintptr_t
): The position of the selection caret, in bytes from the start of the buffer.
[in] ensureVisibleMode (PBEnsureVisibleMode): Scroll any ancestor scroll views if necessary to ensure that the new selection is visible in the window.
Discussion
The offsets are automatically clamped to the range of the document.
If the log view does not have the PBLogView_ALLOW_SELECTION flag, this function does nothing.
Note that by default the text selection is not displayed unless the PBLogView is focused; see PBElementFocus.
PBLogViewGetSelection
Function: Get the range of selected text in a log view.
Syntax (C/C++)
void PBLogViewGetSelection(PBLogViewRef logView,
/* output */ uintptr_t * __restrict anchor,
/* output */ uintptr_t * __restrict caret);
Syntax (Python)
LogViewGetSelection(logView) -> (anchor, caret)
Parameters and Return Values
[in] logView (referenced PBLogView): The log view object.
[out] anchor (uintptr_t
): The position of the selection anchor, in bytes from the start of the buffer.
[out] caret (uintptr_t
): The position of the selection caret, in bytes from the start of the buffer.
PBLogViewGetContentsLength
Function:
Syntax (C/C++)
uintptr_t PBLogViewGetContentsLength(PBLogViewRef logView);
Syntax (Python)
LogViewGetContentsLength(logView) -> (textLengthInBytes)
Parameters and Return Values
[in] logView (referenced PBLogView):
[out] textLengthInBytes (uintptr_t
): The number of bytes in the buffer.