Corrected mesh manager's use of hashmap. Added CStrW support to JS/GUI interface. Added error checking to CStr::Left/Right to make bugs more obvious.

This was SVN commit r1456.
This commit is contained in:
Ykkrosh
2004-12-05 18:26:43 +00:00
parent 761261880a
commit ffb5f87857
6 changed files with 31 additions and 12 deletions
@@ -1,4 +1,4 @@
// $Id: JSInterface_IGUIObject.cpp,v 1.15 2004/09/06 11:28:30 philip Exp $
// $Id$
#include "precompiled.h"
@@ -173,11 +173,20 @@ JSBool JSI_IGUIObject::getProperty(JSContext* cx, JSObject* obj, jsval id, jsval
{
CStr value;
GUI<CStr>::GetSetting(e, propName, value);
// Create a garbage-collectable copy of the string
// Create a garbage-collectible copy of the string
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, value.c_str() ));
break;
}
case GUIST_CStrW:
{
CStrW value;
GUI<CStrW>::GetSetting(e, propName, value);
// Create a garbage-collectible copy of the string
*vp = STRING_TO_JSVAL(JS_NewUCStringCopyZ(cx, value.utf16().c_str() ));
break;
}
// TODO Gee: (2004-09-01) EAlign and EVAlign too.
default:
@@ -220,6 +229,13 @@ JSBool JSI_IGUIObject::setProperty(JSContext* cx, JSObject* obj, jsval id, jsval
break;
}
case GUIST_CStrW:
{
utf16string value (JS_GetStringChars(JS_ValueToString(cx, *vp)));
GUI<CStrW>::SetSetting(e, propName, value);
break;
}
case GUIST_CGUIString:
{
std::wstring value;