-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of ssh://github.com/gnustep/libs-base
- Loading branch information
Showing
6 changed files
with
229 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** Category for converting Windows Strings | ||
Copyright (C) 1998 Free Software Foundation, Inc. | ||
Written by: Hugo Melder <[email protected]> | ||
Created: July 2024 | ||
This file is part of the GNUstep Base Library. | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2 of the License, or (at your option) any later version. | ||
This library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public | ||
License along with this library; if not, write to the Free | ||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
Boston, MA 02110 USA. | ||
*/ | ||
|
||
#import <Foundation/NSString.h> | ||
|
||
#include <wchar.h> | ||
|
||
/** | ||
* Converts a wchar_t list to an array of strings. | ||
* The list is NULL-delimited and terminated by two NULL (wchar_t) characters. | ||
* | ||
* The encoding is Unicode (UTF-16LE). | ||
*/ | ||
@interface NSString (Win32Additions) | ||
|
||
+ (GS_GENERIC_CLASS(NSArray, NSString *) *) arrayFromWCharList: (wchar_t *)list | ||
length: (unsigned long)length; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** Category for converting Windows Strings | ||
Copyright (C) 1998 Free Software Foundation, Inc. | ||
Written by: Hugo Melder <[email protected]> | ||
Created: July 2024 | ||
This file is part of the GNUstep Base Library. | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2 of the License, or (at your option) any later version. | ||
This library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public | ||
License along with this library; if not, write to the Free | ||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
Boston, MA 02110 USA. | ||
*/ | ||
|
||
#import "NSString+Win32Additions.h" | ||
|
||
@implementation NSString (Win32Additions) | ||
|
||
+ (GS_GENERIC_CLASS(NSArray, NSString *) *) arrayFromWCharList: (wchar_t *)list | ||
length: (unsigned long)length | ||
{ | ||
NSString *string; | ||
GS_GENERIC_CLASS(NSArray, NSString *) * array; | ||
|
||
string = [[NSString alloc] initWithBytes: list | ||
length: (length - 2) * sizeof(wchar_t) | ||
encoding: NSUTF16LittleEndianStringEncoding]; | ||
|
||
array = [string componentsSeparatedByString: @"\0"]; | ||
RELEASE(string); | ||
|
||
return array; | ||
} | ||
|
||
@end |