From c226b00dad2eacb9a81b0781cea70498b1981c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl-Henrik=20Sk=C3=A5rstedt?= Date: Thu, 26 May 2016 22:28:32 -0700 Subject: [PATCH] Added visual studio natvis for struse class --- struse.h | 7 ++++--- struse.natvis | 12 ++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 struse.natvis diff --git a/struse.h b/struse.h index 75e8f8a..d31ec7a 100644 --- a/struse.h +++ b/struse.h @@ -75,8 +75,8 @@ protected: public: strref() { clear(); } - strref(const char *str); - strref(char *str) : strref((const char*)str) {} + strref(const char *str) { set(str); } + strref(char *str) { set((const char*)str); } strref(const char *str, strl_t len) : string(str), length(len) {} strref(const char *str, int len) : string(str), length(strl_t(len)) {} strref(char *str, int len) : string((const char*)str), length(strl_t(len)) {} @@ -84,6 +84,7 @@ public: bool valid() const { return string && length; } void clear() { string = nullptr; length = 0; } + void set(const char *str); const char* get() const { return string; } const uint8_t* get_u() const { return (const uint8_t*)string; } strl_t get_len() const { return length; } @@ -1370,7 +1371,7 @@ void strref::writeln() } // construct a strref from const char* -strref::strref(const char *str) +void strref::set(const char *str) { if (!str || !*str) { string = nullptr; diff --git a/struse.natvis b/struse.natvis new file mode 100644 index 0000000..4485775 --- /dev/null +++ b/struse.natvis @@ -0,0 +1,12 @@ + + + + {string,[length]s} + + + {string,[length]s} + + + {string_ptr,[string_length]s} + + \ No newline at end of file