CString -> RString
This commit is contained in:
@@ -19,7 +19,7 @@ void LocalizedString::RefreshLocalizedStrings()
|
|||||||
(*p)->Refresh();
|
(*p)->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
CString LocalizedString::LocalizeString( const CString &sSection, const CString &sName )
|
RString LocalizedString::LocalizeString( const RString &sSection, const RString &sName )
|
||||||
{
|
{
|
||||||
ASSERT( g_pfnLocalizer );
|
ASSERT( g_pfnLocalizer );
|
||||||
return g_pfnLocalizer( sSection, sName );
|
return g_pfnLocalizer( sSection, sName );
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class LocalizedString
|
|||||||
public:
|
public:
|
||||||
static void RegisterLocalizer( RString (*pfnLocalizer)(const RString&,const RString&) );
|
static void RegisterLocalizer( RString (*pfnLocalizer)(const RString&,const RString&) );
|
||||||
static void RefreshLocalizedStrings();
|
static void RefreshLocalizedStrings();
|
||||||
static CString LocalizeString( const CString &sSection, const CString &sName );
|
static RString LocalizeString( const RString &sSection, const RString &sName );
|
||||||
|
|
||||||
|
|
||||||
LocalizedString( const RString &sSection, const RString &sName );
|
LocalizedString( const RString &sSection, const RString &sName );
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ void LuaReference::ReRegister()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LuaExpression::SetFromExpression( const CString &sExpression )
|
void LuaExpression::SetFromExpression( const RString &sExpression )
|
||||||
{
|
{
|
||||||
m_sExpression = "return " + sExpression;
|
m_sExpression = "return " + sExpression;
|
||||||
Register();
|
Register();
|
||||||
@@ -182,7 +182,7 @@ void LuaExpression::Register()
|
|||||||
LUA->Release( L );
|
LUA->Release( L );
|
||||||
}
|
}
|
||||||
|
|
||||||
CString LuaData::Serialize() const
|
RString LuaData::Serialize() const
|
||||||
{
|
{
|
||||||
/* Call Serialize(t), where t is our referenced object. */
|
/* Call Serialize(t), where t is our referenced object. */
|
||||||
Lua *L = LUA->Get();
|
Lua *L = LUA->Get();
|
||||||
@@ -201,7 +201,7 @@ CString LuaData::Serialize() const
|
|||||||
const char *pString = lua_tostring( L, -1 );
|
const char *pString = lua_tostring( L, -1 );
|
||||||
ASSERT_M( pString != NULL, "Serialize() didn't return a string" );
|
ASSERT_M( pString != NULL, "Serialize() didn't return a string" );
|
||||||
|
|
||||||
CString sRet = pString;
|
RString sRet = pString;
|
||||||
lua_pop( L, 1 );
|
lua_pop( L, 1 );
|
||||||
|
|
||||||
LUA->Release( L );
|
LUA->Release( L );
|
||||||
@@ -209,12 +209,12 @@ CString LuaData::Serialize() const
|
|||||||
return sRet;
|
return sRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaData::LoadFromString( const CString &s )
|
void LuaData::LoadFromString( const RString &s )
|
||||||
{
|
{
|
||||||
Lua *L = LUA->Get();
|
Lua *L = LUA->Get();
|
||||||
|
|
||||||
/* Restore the serialized data by evaluating it. */
|
/* Restore the serialized data by evaluating it. */
|
||||||
CString sError;
|
RString sError;
|
||||||
if( !LuaHelpers::RunScript( L, s, "serialization", sError, 1 ) )
|
if( !LuaHelpers::RunScript( L, s, "serialization", sError, 1 ) )
|
||||||
{
|
{
|
||||||
/* Serialize() should never return an invalid script. Drop the failed
|
/* Serialize() should never return an invalid script. Drop the failed
|
||||||
@@ -253,7 +253,7 @@ LuaTable::LuaTable()
|
|||||||
LUA->Release( L );
|
LUA->Release( L );
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaTable::Set( Lua *L, const CString &sKey )
|
void LuaTable::Set( Lua *L, const RString &sKey )
|
||||||
{
|
{
|
||||||
int iTop = lua_gettop( L );
|
int iTop = lua_gettop( L );
|
||||||
this->PushSelf( L );
|
this->PushSelf( L );
|
||||||
@@ -263,7 +263,7 @@ void LuaTable::Set( Lua *L, const CString &sKey )
|
|||||||
lua_settop( L, iTop-1 ); // remove all of the above
|
lua_settop( L, iTop-1 ); // remove all of the above
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaTable::Unset( Lua *L, const CString &sKey )
|
void LuaTable::Unset( Lua *L, const RString &sKey )
|
||||||
{
|
{
|
||||||
lua_pushnil( L );
|
lua_pushnil( L );
|
||||||
Set( L, sKey );
|
Set( L, sKey );
|
||||||
|
|||||||
@@ -58,14 +58,14 @@ private:
|
|||||||
class LuaExpression: public LuaReference
|
class LuaExpression: public LuaReference
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LuaExpression( const CString &sExpression = "" ) { if( sExpression != "" ) SetFromExpression( sExpression ); }
|
LuaExpression( const RString &sExpression = "" ) { if( sExpression != "" ) SetFromExpression( sExpression ); }
|
||||||
void SetFromExpression( const CString &sExpression );
|
void SetFromExpression( const RString &sExpression );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void Register();
|
virtual void Register();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CString m_sExpression;
|
RString m_sExpression;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Reference a trivially restorable Lua object (any object that Serialize can handle).
|
/* Reference a trivially restorable Lua object (any object that Serialize can handle).
|
||||||
@@ -73,14 +73,14 @@ private:
|
|||||||
class LuaData: public LuaReference
|
class LuaData: public LuaReference
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual CString Serialize() const;
|
virtual RString Serialize() const;
|
||||||
virtual void LoadFromString( const CString &s );
|
virtual void LoadFromString( const RString &s );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void BeforeReset();
|
virtual void BeforeReset();
|
||||||
virtual void Register();
|
virtual void Register();
|
||||||
|
|
||||||
CString m_sSerializedData;
|
RString m_sSerializedData;
|
||||||
bool m_bWasSet;
|
bool m_bWasSet;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -91,10 +91,10 @@ public:
|
|||||||
|
|
||||||
/* Set a key by the given name to a value on the stack, and pop the value
|
/* Set a key by the given name to a value on the stack, and pop the value
|
||||||
* off the stack. */
|
* off the stack. */
|
||||||
void Set( Lua *L, const CString &sKey );
|
void Set( Lua *L, const RString &sKey );
|
||||||
|
|
||||||
/* Unset the given key (set it to nil). */
|
/* Unset the given key (set it to nil). */
|
||||||
void Unset( Lua *L, const CString &sKey );
|
void Unset( Lua *L, const RString &sKey );
|
||||||
|
|
||||||
/* Set a key on the stack to a value on the stack; push the key first. Pop
|
/* Set a key on the stack to a value on the stack; push the key first. Pop
|
||||||
* both the key and the value off the stack. */
|
* both the key and the value off the stack. */
|
||||||
|
|||||||
Reference in New Issue
Block a user