Skip to content

Instantly share code, notes, and snippets.

@hotwatermorning
Last active December 14, 2015 01:59
Show Gist options
  • Save hotwatermorning/5010090 to your computer and use it in GitHub Desktop.
Save hotwatermorning/5010090 to your computer and use it in GitHub Desktop.
debugger visualizer for boost::string_ref.
;------------------------------------------------------------------------------
; boost::string_ref
;------------------------------------------------------------------------------
boost::basic_string_ref<char,*> {
children (
#(
#([raw] : [$c.ptr_,!]),
#array(expr : $c.ptr_[$i], size : $c.len_)
)
)
stringview(
#if ($c.ptr_ == 0) (
"(nullptr)"
) #elif ($c.len_ == 0) (
"(empty)"
) #else (
; Preview raw string
[$c.ptr_,sb]
; ptr_ may not be null-terminated.
; Therefore previewing the string as array-format may be more well-mannered
; but it has less readability and less performance.
;#array(expr : $c.ptr_[$i], size : $c.len_)
)
)
preview (
#if ($c.ptr_ == 0) (
#("(nullptr)")
) #elif ($c.len_ == 0) (
#("(empty)")
) #else (
#("[", $c.len_, "](", $c.ptr_, ")")
)
)
}
boost::basic_string_ref<unsigned short,*>|boost::basic_string_ref<wchar_t,*> {
children (
#(
#([raw] : [$c.ptr_,!]),
#array(expr : $c.ptr_[$i], size : $c.len_)
)
)
stringview(
#if ($c.ptr_ == 0) (
"(nullptr)"
) #elif ($c.len_ == 0) (
"(empty)"
) #else (
; Preview raw string
[$c.ptr_,sb]
; ptr_ may not be null-terminated.
; Therefore previewing the string as array-format may be more well-mannered
; but it has less readability and less performance.
;#array(expr : $c.ptr_[$i], size : $c.len_)
)
)
preview (
#if ($c.ptr_ == 0) (
#("(nullptr)")
) #elif ($c.len_ == 0) (
#("(empty)")
) #else (
#("[", $c.len_, "](", $c.ptr_, ")")
)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment