Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
onlyoffice_core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
onlyoffice_core
Commits
95d9d8bc
Commit
95d9d8bc
authored
Jan 12, 2017
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NSString: + stringWithUtf8Buffer method
parent
dce0b43c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
DesktopEditor/common/Mac/NSString+StringUtils.h
DesktopEditor/common/Mac/NSString+StringUtils.h
+1
-0
DesktopEditor/common/Mac/NSString+StringUtils.mm
DesktopEditor/common/Mac/NSString+StringUtils.mm
+12
-1
No files found.
DesktopEditor/common/Mac/NSString+StringUtils.h
View file @
95d9d8bc
...
...
@@ -44,6 +44,7 @@
@interface
NSString
(
StringUtils
)
+
(
id
)
stringWithWString
:(
const
std
::
wstring
&
)
string
;
+
(
id
)
stringWithAString
:(
const
std
::
string
&
)
string
;
+
(
id
)
stringWithUtf8Buffer
:(
const
char
*
)
string
length
:(
size_t
)
len
;
+
(
NSMutableArray
*
)
stringsArray
:(
const
std
::
vector
<
std
::
wstring
>&
)
sources
;
-
(
std
::
wstring
)
stdwstring
;
-
(
std
::
string
)
stdstring
;
...
...
DesktopEditor/common/Mac/NSString+StringUtils.mm
View file @
95d9d8bc
...
...
@@ -30,6 +30,17 @@
encoding:
CFStringConvertEncodingToNSStringEncoding
(
kCFStringEncodingUTF8
)];
}
+
(
id
)
stringWithUtf8Buffer
:(
const
char
*
)
string
length
:(
size_t
)
len
{
if
(
len
<
1
)
{
return
@""
;
}
return
[[
NSString
alloc
]
initWithBytes
:
string
length:
len
*
sizeof
(
char
)
encoding:
CFStringConvertEncodingToNSStringEncoding
(
kCFStringEncodingUTF8
)];
}
+
(
NSMutableArray
*
)
stringsArray
:(
const
std
::
vector
<
std
::
wstring
>&
)
sources
{
size_t
count
=
sources
.
size
();
NSMutableArray
*
array
=
[
NSMutableArray
arrayWithCapacity
:
count
];
...
...
@@ -51,4 +62,4 @@
return
std
::
string
((
char
*
)
data
.
bytes
,
data
.
length
);
}
@end
\ No newline at end of file
@end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment