ObjQt  Diff

Differences From Artifact [0c44cda950]:

To Artifact [5b64399c2b]:


19
20
21
22
23
24
25
26

27
28
29
30
31

32
33
34


35
36

37
38
39
40
41
42
43


44
45
46

47
48
49
50
51
52
19
20
21
22
23
24
25

26
27
28
29
30

31
32


33
34
35

36
37
38
39
40
41


42
43
44
45

46
47
48
49
50
51
52







-
+




-
+

-
-
+
+

-
+





-
-
+
+


-
+






 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import "OFString+QString.h"

@implementation OFString (QString)
+ stringWithQString: (const QString&)qString
+ stringWithQString: (const QString &)qString
{
	return [[[self alloc] initWithQString: qString] autorelease];
}

- initWithQString: (const QString&)qString
- initWithQString: (const QString &)qString
{
	static_assert(sizeof(QChar) == sizeof(of_char16_t),
	    "QChar and of_char16_t have a different size!");
	static_assert(sizeof(QChar) == sizeof(char16_t),
	    "QChar and char16_t have a different size!");

	return [self initWithUTF16String: (of_char16_t*)qString.data()
	return [self initWithUTF16String: (char16_t *)qString.data()
				  length: qString.length()];
}

- (QString)qString
{
	static_assert(sizeof(of_char16_t) == sizeof(QChar),
	    "of_char16_t and QChar have a different size!");
	static_assert(sizeof(char16_t) == sizeof(QChar),
	    "char16_t and QChar have a different size!");

	void *pool = objc_autoreleasePoolPush();
	QString ret = QString((QChar*)[self UTF16String]);
	QString ret = QString((QChar *)[self UTF16String]);

	objc_autoreleasePoolPop(pool);

	return ret;
}
@end