Mercurial > projects > dwt-linux
comparison dwt/internal/mozilla/nsStringAPI.d @ 298:eec6ddb07873
More xpcom/mozilla port
author | John Reimer<terminal.node@gmail.com> |
---|---|
date | Sun, 10 Aug 2008 22:25:43 -0700 |
parents | 3dfa75c74ed2 |
children | 3f4a5c7d138f |
comparison
equal
deleted
inserted
replaced
297:2f204a4aebc6 | 298:eec6ddb07873 |
---|---|
71 alias nsAString nsEmbedString; | 71 alias nsAString nsEmbedString; |
72 alias nsACString nsEmbedCString; | 72 alias nsACString nsEmbedCString; |
73 | 73 |
74 struct nsAString | 74 struct nsAString |
75 { | 75 { |
76 static nsAString opCall(wchar[] s) | 76 static nsAString opCall(wchar[] s) |
77 { | 77 { |
78 nsAString result; | 78 nsAString result; |
79 NS_StringSetData(&result, cast(PRUnichar*)s, uint.max); | 79 NS_StringSetData(&result, cast(PRUnichar*)s, uint.max); |
80 return result; | 80 return result; |
81 } | 81 } |
82 | 82 |
83 static wchar[] getString16( nsAString* str ) | 83 static wchar[] toString16( nsAString* str ) |
84 { | 84 { |
85 wchar* buffer = null; | 85 wchar* buffer = null; |
86 PRBool terminated; | 86 PRBool terminated; |
87 uint len = NS_StringGetData(str, &buffer, &terminated); | 87 uint len = NS_StringGetData(str, &buffer, &terminated); |
88 return buffer[0 .. len].dup; | 88 return buffer[0 .. len].dup; |
89 } | 89 } |
90 | 90 |
91 private: | 91 static char[] toString( nsAString* str ) |
92 { | |
93 return Utf.toString( nsAString.toString16( str ) ); | |
94 } | |
95 | |
96 private: | |
92 void *v; | 97 void *v; |
93 } | 98 } |
94 | 99 |
95 struct nsACString | 100 struct nsACString |
96 { | 101 { |
179 | 184 |
180 ******************************************************************************/ | 185 ******************************************************************************/ |
181 | 186 |
182 struct nsDependentSubstring_external{} | 187 struct nsDependentSubstring_external{} |
183 struct nsDependentCSubstring_external{} | 188 struct nsDependentCSubstring_external{} |
184 | |
185 /****************************************************************************** | |
186 | |
187 ******************************************************************************/ | |
188 | |
189 PRUint32 strlen_PRUnichar ( PRUnichar* str ) | |
190 { | |
191 PRUint32 len = 0; | |
192 if (str !is null) | |
193 while (*(lparg0++) != 0) len++; | |
194 ret len; | |
195 } |