From b126def60fc5280d40bc25db86748ed798c8548d Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Mon, 21 Dec 2020 15:15:54 +0200 Subject: Add two debug output helper functions Change-Id: I38a234e6f4a3fc5e0f17cfd9a0068d2081b6c654 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108099 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tor Lillqvist Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108100 Tested-by: Tor Lillqvist --- vcl/inc/quartz/utils.h | 2 ++ vcl/quartz/utils.cxx | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'vcl') diff --git a/vcl/inc/quartz/utils.h b/vcl/inc/quartz/utils.h index a2a39f2605d2..759e47f72f2b 100644 --- a/vcl/inc/quartz/utils.h +++ b/vcl/inc/quartz/utils.h @@ -38,6 +38,8 @@ OUString GetOUString( CFStringRef ); OUString GetOUString( const NSString* ); CFStringRef CreateCFString( const OUString& ); NSString* CreateNSString( const OUString& ); +OUString NSStringArrayToOUString(NSArray* array); +OUString NSDictionaryKeysToOUString(NSDictionary* dict); std::ostream &operator <<(std::ostream& s, const CGRect &rRect); std::ostream &operator <<(std::ostream& s, const CGPoint &rPoint); diff --git a/vcl/quartz/utils.cxx b/vcl/quartz/utils.cxx index cc18eb0d409f..0182ec118886 100644 --- a/vcl/quartz/utils.cxx +++ b/vcl/quartz/utils.cxx @@ -85,6 +85,32 @@ NSString* CreateNSString( const OUString& rStr ) return [[NSString alloc] initWithCharacters: reinterpret_cast(rStr.getStr()) length: rStr.getLength()]; } +OUString NSStringArrayToOUString(NSArray* array) +{ + OUString result = "["; + OUString sep; + for (unsigned i = 0; i < [array count]; i++) + { + result = result + sep + OUString::fromUtf8([[array objectAtIndex:i] UTF8String]); + sep = ","; + } + result = result + "]"; + return result; +} + +OUString NSDictionaryKeysToOUString(NSDictionary* dict) +{ + OUString result = "{"; + OUString sep; + for (NSString *key in dict) + { + result = result + sep + OUString::fromUtf8([key UTF8String]); + sep = ","; + } + result = result + "}"; + return result; +} + std::ostream &operator <<(std::ostream& s, const CGRect &rRect) { #ifndef SAL_LOG_INFO -- cgit