1
0
forked from 0ad/0ad

while working on cstr, search and destroy made "CStr &x" -> "CStr& x". didn't intend to hit gui code, but ok :)

This was SVN commit r534.
This commit is contained in:
janwas 2004-06-18 14:07:06 +00:00
parent a2fdd3e190
commit 4258ba245d
14 changed files with 74 additions and 74 deletions

View File

@ -215,7 +215,7 @@ CGUI::~CGUI()
//-------------------------------------------------------------------
// Functions
//-------------------------------------------------------------------
IGUIObject *CGUI::ConstructObject(const CStr &str)
IGUIObject *CGUI::ConstructObject(const CStr& str)
{
if (m_ObjectTypes.count(str) > 0)
return (*m_ObjectTypes[str])();
@ -332,7 +332,7 @@ void CGUI::Draw()
glPopMatrix();
}
void CGUI::DrawSprite(const CStr &SpriteName,
void CGUI::DrawSprite(const CStr& SpriteName,
const float &Z,
const CRect &Rect,
const CRect &Clipping)
@ -457,7 +457,7 @@ void CGUI::UpdateObjects()
m_pAllObjects = AllObjects;
}
bool CGUI::ObjectExists(const CStr &Name) const
bool CGUI::ObjectExists(const CStr& Name) const
{
return m_pAllObjects.count(Name) != 0;
}
@ -473,7 +473,7 @@ struct SGenerateTextImage
// TODO Gee: CRect => CPoint ?
void SetupSpriteCall(const bool &Left, SGUIText::SSpriteCall &SpriteCall,
const int &width, const int &y,
const CSize &Size, const CStr &TextureName,
const CSize &Size, const CStr& TextureName,
const int &BufferZone)
{
// TODO Gee: Temp hardcoded values
@ -500,7 +500,7 @@ struct SGenerateTextImage
};
SGUIText CGUI::GenerateText(const CGUIString &string, /*const CColor &Color, */
const CStr &Font, const int &Width, const int &BufferZone)
const CStr& Font, const int &Width, const int &BufferZone)
{
SGUIText Text; // object we're generating
@ -771,7 +771,7 @@ void CGUI::DrawText(const SGUIText &Text, const CColor &DefaultColor,
}
}
void CGUI::ReportParseError(const CStr &str, ...)
void CGUI::ReportParseError(const CStr& str, ...)
{
// Print header
if (m_Errors==0)

View File

@ -108,7 +108,7 @@ public:
* @param Rect Position and Size
* @param Clipping The sprite shouldn't be drawn outside this rectangle
*/
void DrawSprite(const CStr &SpriteName, const float &Z,
void DrawSprite(const CStr& SpriteName, const float &Z,
const CRect &Rect, const CRect &Clipping=CRect());
/**
@ -151,7 +151,7 @@ public:
* @param Name String name of object
* @return true if object exists
*/
bool ObjectExists(const CStr &Name) const;
bool ObjectExists(const CStr& Name) const;
/**
* The GUI needs to have all object types inputted and
@ -168,7 +168,7 @@ public:
*
* @see CGUI#ConstructObject()
*/
void AddObjectType(const CStr &str, ConstructObjectFunction pFunc) { m_ObjectTypes[str] = pFunc; }
void AddObjectType(const CStr& str, ConstructObjectFunction pFunc) { m_ObjectTypes[str] = pFunc; }
/**
* Update Resolution, should be called every time the resolution
@ -197,7 +197,7 @@ public:
* @param BufferZone space between text and edge, and space between text and images.
*/
SGUIText GenerateText(const CGUIString &Text, /*const CColor &Color, */
const CStr &Font, const int &Width, const int &BufferZone);
const CStr& Font, const int &Width, const int &BufferZone);
private:
/**
@ -228,7 +228,7 @@ private:
*
* @param str Error message
*/
void ReportParseError(const CStr &str, ...);
void ReportParseError(const CStr& str, ...);
/**
* You input the name of the object type, and let's
@ -238,7 +238,7 @@ private:
* @param str Name of object type
* @return Newly constructed IGUIObject (but constructed as a subclass)
*/
IGUIObject *ConstructObject(const CStr &str);
IGUIObject *ConstructObject(const CStr& str);
//--------------------------------------------------------
/** @name XML Reading Xerces C++ specific subroutines

View File

@ -84,7 +84,7 @@ struct SGUIMessage
{
SGUIMessage() {}
SGUIMessage(const EGUIMessageType &_type) : type(_type) {}
SGUIMessage(const EGUIMessageType &_type, const CStr &_value) : type(_type), value(_value) {}
SGUIMessage(const EGUIMessageType &_type, const CStr& _value) : type(_type), value(_value) {}
~SGUIMessage() {}
/**

View File

@ -30,7 +30,7 @@ void CGUIString::SFeedback::Reset()
}
void CGUIString::GenerateTextCall(SFeedback &Feedback,
const CStr &DefaultFont, /*const CColor &DefaultColor,*/
const CStr& DefaultFont, /*const CColor &DefaultColor,*/
const int &from, const int &to) const
{
// Reset width and height, because they will be determined with incrementation
@ -159,7 +159,7 @@ void CGUIString::GenerateTextCall(SFeedback &Feedback,
}
}
bool CGUIString::TextChunk::Tag::SetTagType(const CStr &tagtype)
bool CGUIString::TextChunk::Tag::SetTagType(const CStr& tagtype)
{
CStr _tagtype = tagtype.UpperCase();
@ -208,7 +208,7 @@ bool CGUIString::TextChunk::Tag::SetTagType(const CStr &tagtype)
return false;
}
void CGUIString::SetValue(const CStr &str)
void CGUIString::SetValue(const CStr& str)
{
// clear
m_TextChunks.clear();

View File

@ -187,7 +187,7 @@ public:
* @param tagtype TagType by string, like 'IMG' for [IMG]
* @return True if m_TagType was set.
*/
bool SetTagType(const CStr &tagtype);
bool SetTagType(const CStr& tagtype);
/**
* In [B=Hello][/B]
@ -255,7 +255,7 @@ public:
* Set the value, the string will automatically
* be parsed when set.
*/
void SetValue(const CStr &str);
void SetValue(const CStr& str);
/**
* Get String, without tags
@ -277,7 +277,7 @@ public:
* @param to to chacter n.
*/
void GenerateTextCall(SFeedback &Feedback,
const CStr &DefaultFont, /*const CColor &DefaultColor,*/
const CStr& DefaultFont, /*const CColor &DefaultColor,*/
const int &from, const int &to) const;
/**

View File

@ -11,14 +11,14 @@ gee@pyro.nu
using namespace std;
template <typename T>
bool __ParseString(const CStr &Value, T &tOutput)
bool __ParseString(const CStr& Value, T &tOutput)
{
// TODO Gee: Unsupported, report error/warning
return false;
}
template <>
bool __ParseString<bool>(const CStr &Value, bool &Output)
bool __ParseString<bool>(const CStr& Value, bool &Output)
{
if (Value == CStr(_T("true")))
Output = true;
@ -32,21 +32,21 @@ bool __ParseString<bool>(const CStr &Value, bool &Output)
}
template <>
bool __ParseString<int>(const CStr &Value, int &Output)
bool __ParseString<int>(const CStr& Value, int &Output)
{
Output = Value.ToInt();
return true;
}
template <>
bool __ParseString<float>(const CStr &Value, float &Output)
bool __ParseString<float>(const CStr& Value, float &Output)
{
Output = Value.ToFloat();
return true;
}
template <>
bool __ParseString<CRect>(const CStr &Value, CRect &Output)
bool __ParseString<CRect>(const CStr& Value, CRect &Output)
{
// Use the parser to parse the values
CParser parser;
@ -77,13 +77,13 @@ bool __ParseString<CRect>(const CStr &Value, CRect &Output)
}
template <>
bool __ParseString<CClientArea>(const CStr &Value, CClientArea &Output)
bool __ParseString<CClientArea>(const CStr& Value, CClientArea &Output)
{
return Output.SetClientArea(Value);
}
template <>
bool __ParseString<CColor>(const CStr &Value, CColor &Output)
bool __ParseString<CColor>(const CStr& Value, CColor &Output)
{
// Use the parser to parse the values
CParser parser;
@ -118,7 +118,7 @@ bool __ParseString<CColor>(const CStr &Value, CColor &Output)
}
template <>
bool __ParseString<CGUIString>(const CStr &Value, CGUIString &Output)
bool __ParseString<CGUIString>(const CStr& Value, CGUIString &Output)
{
const char * buf = Value;
@ -134,7 +134,7 @@ CClientArea::CClientArea() : pixel(0,0,0,0), percent(0,0,0,0)
{
}
CClientArea::CClientArea(const CStr &Value)
CClientArea::CClientArea(const CStr& Value)
{
SetClientArea(Value);
}
@ -156,7 +156,7 @@ CRect CClientArea::GetClientArea(const CRect &parent) const
return client;
}
bool CClientArea::SetClientArea(const CStr &Value)
bool CClientArea::SetClientArea(const CStr& Value)
{
// Get value in STL string format
string _Value = (const TCHAR*)Value;
@ -272,7 +272,7 @@ bool CClientArea::SetClientArea(const CStr &Value)
//--------------------------------------------------------
// Utilities implementation
//--------------------------------------------------------
IGUIObject * CInternalCGUIAccessorBase::GetObjectPointer(CGUI &GUIinstance, const CStr &Object)
IGUIObject * CInternalCGUIAccessorBase::GetObjectPointer(CGUI &GUIinstance, const CStr& Object)
{
// if (!GUIinstance.ObjectExists(Object))
// return NULL;
@ -280,7 +280,7 @@ IGUIObject * CInternalCGUIAccessorBase::GetObjectPointer(CGUI &GUIinstance, cons
return GUIinstance.m_pAllObjects.find(Object)->second;
}
const IGUIObject * CInternalCGUIAccessorBase::GetObjectPointer(const CGUI &GUIinstance, const CStr &Object)
const IGUIObject * CInternalCGUIAccessorBase::GetObjectPointer(const CGUI &GUIinstance, const CStr& Object)
{
// if (!GUIinstance.ObjectExists(Object))
// return NULL;

View File

@ -34,28 +34,28 @@ class CClientArea;
class CGUIString;
template <typename T>
bool __ParseString(const CStr &Value, T &tOutput);
bool __ParseString(const CStr& Value, T &tOutput);
template <>
bool __ParseString<bool>(const CStr &Value, bool &Output);
bool __ParseString<bool>(const CStr& Value, bool &Output);
template <>
bool __ParseString<int>(const CStr &Value, int &Output);
bool __ParseString<int>(const CStr& Value, int &Output);
template <>
bool __ParseString<float>(const CStr &Value, float &Output);
bool __ParseString<float>(const CStr& Value, float &Output);
template <>
bool __ParseString<CRect>(const CStr &Value, CRect &Output);
bool __ParseString<CRect>(const CStr& Value, CRect &Output);
template <>
bool __ParseString<CClientArea>(const CStr &Value, CClientArea &Output);
bool __ParseString<CClientArea>(const CStr& Value, CClientArea &Output);
template <>
bool __ParseString<CColor>(const CStr &Value, CColor &Output);
bool __ParseString<CColor>(const CStr& Value, CColor &Output);
template <>
bool __ParseString<CGUIString>(const CStr &Value, CGUIString &Output);
bool __ParseString<CGUIString>(const CStr& Value, CGUIString &Output);
/**
* @author Gustav Larsson
@ -69,7 +69,7 @@ class CClientArea
{
public:
CClientArea();
CClientArea(const CStr &Value);
CClientArea(const CStr& Value);
/// Pixel modifiers
CRect pixel;
@ -97,7 +97,7 @@ public:
* @return true if success, false if failure. If false then the client area
* will be unchanged.
*/
bool SetClientArea(const CStr &Value);
bool SetClientArea(const CStr& Value);
};
//--------------------------------------------------------
@ -119,10 +119,10 @@ class CInternalCGUIAccessorBase
{
protected:
/// Get object pointer
static IGUIObject * GetObjectPointer(CGUI &GUIinstance, const CStr &Object);
static IGUIObject * GetObjectPointer(CGUI &GUIinstance, const CStr& Object);
/// const version
static const IGUIObject * GetObjectPointer(const CGUI &GUIinstance, const CStr &Object);
static const IGUIObject * GetObjectPointer(const CGUI &GUIinstance, const CStr& Object);
/// Wrapper for ResetStates
static void QueryResetting(IGUIObject *pObject);
@ -156,7 +156,7 @@ public:
* @param Setting Setting by name
* @param Value Stores value here, note type T!
*/
static PS_RESULT GetSetting(const IGUIObject *pObject, const CStr &Setting, T &Value)
static PS_RESULT GetSetting(const IGUIObject *pObject, const CStr& Setting, T &Value)
{
if (pObject == NULL)
return PS_OBJECT_FAIL;
@ -183,7 +183,7 @@ public:
* @param Setting Setting by name
* @param Value Sets value to this, note type T!
*/
static PS_RESULT SetSetting(IGUIObject *pObject, const CStr &Setting, const T &Value)
static PS_RESULT SetSetting(IGUIObject *pObject, const CStr& Setting, const T &Value)
{
if (pObject == NULL)
return PS_OBJECT_FAIL;
@ -222,8 +222,8 @@ public:
* Can safely be removed.
*/
static PS_RESULT GetSetting(
const CStr &Object,
const CStr &Setting, T &Value)
const CStr& Object,
const CStr& Setting, T &Value)
{
return GetSetting(g_GUI, Object, Setting, Value);
}
@ -238,8 +238,8 @@ public:
* @param Value Stores value here, note type T!
*/
static PS_RESULT GetSetting(
const CGUI &GUIinstance, const CStr &Object,
const CStr &Setting, T &Value)
const CGUI &GUIinstance, const CStr& Object,
const CStr& Setting, T &Value)
{
if (!GUIinstance.ObjectExists(Object))
return PS_OBJECT_FAIL;
@ -256,7 +256,7 @@ public:
* Can safely be removed.
*/
static PS_RESULT SetSetting(
const CStr &Object, const CStr &Setting, const T &Value)
const CStr& Object, const CStr& Setting, const T &Value)
{
return SetSetting(g_GUI, Object, Setting, Value);
}
@ -275,8 +275,8 @@ public:
* @param Value Sets value to this, note type T!
*/
static PS_RESULT SetSetting(
CGUI &GUIinstance, const CStr &Object,
const CStr &Setting, const T &Value)
CGUI &GUIinstance, const CStr& Object,
const CStr& Setting, const T &Value)
{
if (!GUIinstance.ObjectExists(Object))
return PS_OBJECT_FAIL;
@ -300,7 +300,7 @@ public:
* @param sec Secondary sprite if Primary should fail
* @return Resulting string
*/
static CStr FallBackSprite(const CStr &prim, const CStr &sec)
static CStr FallBackSprite(const CStr& prim, const CStr& sec)
{
// CStr() == empty string, null
return ((prim!=CStr())?(prim):(sec));
@ -333,7 +333,7 @@ public:
*
* @see _mem_ParseString()
*/
static bool ParseString(const CStr &Value, T &tOutput)
static bool ParseString(const CStr& Value, T &tOutput)
{
return __ParseString<T>(Value, tOutput);
}

View File

@ -93,10 +93,10 @@ CColor IGUIButtonBehavior::ChooseColor()
void IGUIButtonBehavior::DrawButton(const CRect &rect,
const float &z,
const CStr &sprite,
const CStr &sprite_over,
const CStr &sprite_pressed,
const CStr &sprite_disabled)
const CStr& sprite,
const CStr& sprite_over,
const CStr& sprite_pressed,
const CStr& sprite_disabled)
{
if (GetGUI())
{

View File

@ -74,10 +74,10 @@ public:
*/
void DrawButton(const CRect &rect,
const float &z,
const CStr &sprite,
const CStr &sprite_over,
const CStr &sprite_pressed,
const CStr &sprite_disabled);
const CStr& sprite,
const CStr& sprite_over,
const CStr& sprite_pressed,
const CStr& sprite_disabled);
/**
* Choosing which color of the following according to

View File

@ -135,7 +135,7 @@ void IGUIObject::Destroy()
m_Settings[Name].m_pSetting = new type(); \
break;
void IGUIObject::AddSetting(const EGUISettingType &Type, const CStr &Name)
void IGUIObject::AddSetting(const EGUISettingType &Type, const CStr& Name)
{
// Is name already taken?
if (m_Settings.count(Name) >= 1)
@ -201,7 +201,7 @@ void IGUIObject::UpdateMouseOver(IGUIObject * const &pMouseOver)
}
}
bool IGUIObject::SettingExists(const CStr &Setting) const
bool IGUIObject::SettingExists(const CStr& Setting) const
{
// Because GetOffsets will direct dynamically defined
// classes with polymorifsm to respective ms_SettingsInfo
@ -222,7 +222,7 @@ bool IGUIObject::SettingExists(const CStr &Setting) const
GUI<type>::SetSetting(this, Setting, _Value); \
}
void IGUIObject::SetSetting(const CStr &Setting, const CStr &Value)
void IGUIObject::SetSetting(const CStr& Setting, const CStr& Value)
{
if (!SettingExists(Setting))
{
@ -299,7 +299,7 @@ void IGUIObject::UpdateCachedSize()
}
void IGUIObject::LoadStyle(CGUI &GUIinstance, const CStr &StyleName)
void IGUIObject::LoadStyle(CGUI &GUIinstance, const CStr& StyleName)
{
// Fetch style
if (GUIinstance.m_Styles.count(StyleName)==1)

View File

@ -159,7 +159,7 @@ public:
CStr GetName() const { return m_Name; }
/// Get object name
void SetName(const CStr &Name) { m_Name = Name; }
void SetName(const CStr& Name) { m_Name = Name; }
/**
* Adds object and its children to the map, it's name being the
@ -213,7 +213,7 @@ public:
* @param Setting setting name
* @return True if settings exist.
*/
bool SettingExists(const CStr &Setting) const;
bool SettingExists(const CStr& Setting) const;
/**
* All sizes are relative to resolution, and the calculation
@ -253,7 +253,7 @@ public:
*
* @throws PS_RESULT
*/
void SetSetting(const CStr &Setting, const CStr &Value);
void SetSetting(const CStr& Setting, const CStr& Value);
//@}
protected:
@ -275,7 +275,7 @@ protected:
* @param Type Setting type
* @param Name Setting reference name
*/
void AddSetting(const EGUISettingType &Type, const CStr &Name);
void AddSetting(const EGUISettingType &Type, const CStr& Name);
/**
* Calls Destroy on all children, and deallocates all memory.
@ -307,7 +307,7 @@ protected:
* @param GUIinstance Reference to the GUI
* @param StyleName Style by name
*/
void LoadStyle(CGUI &GUIinstance, const CStr &StyleName);
void LoadStyle(CGUI &GUIinstance, const CStr& StyleName);
/**
* Loads a style.

View File

@ -282,7 +282,7 @@ public:
* Set Scroll bar style string
* @param style String with scroll bar style reference name
*/
void SetScrollBarStyle(const CStr &style) { m_ScrollBarStyle = style; }
void SetScrollBarStyle(const CStr& style) { m_ScrollBarStyle = style; }
/**
* Get style used by the scrollbar

View File

@ -50,7 +50,7 @@ void SetGUI(CGUI * const &pGUI)
scrollbar->SetGUI(m_pGUI);
}
*/
const SGUIScrollBarStyle * IGUIScrollBarOwner::GetScrollBarStyle(const CStr &style) const
const SGUIScrollBarStyle * IGUIScrollBarOwner::GetScrollBarStyle(const CStr& style) const
{
if (!GetGUI())
{

View File

@ -67,7 +67,7 @@ public:
/**
* Interface for the m_ScrollBar to use.
*/
virtual const SGUIScrollBarStyle *GetScrollBarStyle(const CStr &style) const;
virtual const SGUIScrollBarStyle *GetScrollBarStyle(const CStr& style) const;
/**
* Add a scroll-bar