1
0
forked from 0ad/0ad

Fix CStr numeric constructors on 32-bit platforms.

Remove unnecessary assignment operators.

This was SVN commit r8926.
This commit is contained in:
Ykkrosh 2011-02-16 21:14:08 +00:00
parent 0da7e822ff
commit 3d997365d8
4 changed files with 11 additions and 97 deletions

View File

@ -710,7 +710,7 @@ CStrW CNetServerWorker::DeduplicatePlayerName(const CStrW& original)
if (unique) if (unique)
return name; return name;
name = original + L" (" + CStrW((unsigned long)id++) + L")"; name = original + L" (" + CStrW(id++) + L")";
} }
} }

View File

@ -78,7 +78,7 @@ const std::vector<ProfileColumn>& CNetStatsTable::GetColumns()
CScopeLock lock(m_Mutex); CScopeLock lock(m_Mutex);
for (size_t i = 0; i < m_LatchedData.size(); ++i) for (size_t i = 0; i < m_LatchedData.size(); ++i)
m_ColumnDescriptions.push_back(ProfileColumn("Peer "+CStr((unsigned long)i), 80)); m_ColumnDescriptions.push_back(ProfileColumn("Peer "+CStr(i), 80));
} }
return m_ColumnDescriptions; return m_ColumnDescriptions;
} }

View File

@ -101,20 +101,12 @@ CStr CStr::Repeat(const CStr& String, size_t Reps)
std::tstringstream ss; \ std::tstringstream ss; \
ss << Number; \ ss << Number; \
ss >> *this; \ ss >> *this; \
} \
\
CStr& CStr::operator=(T Number) \
{ \
std::tstringstream ss; \
ss << Number; \
ss >> *this; \
return *this; \
} }
NUM_TYPE(int) NUM_TYPE(i32)
NUM_TYPE(long) NUM_TYPE(i64)
NUM_TYPE(unsigned int) NUM_TYPE(u32)
NUM_TYPE(unsigned long) NUM_TYPE(u64)
NUM_TYPE(float) NUM_TYPE(float)
NUM_TYPE(double) NUM_TYPE(double)

View File

@ -167,49 +167,14 @@ public:
CStrW FromUTF8() const; CStrW FromUTF8() const;
#endif #endif
/** // Construct from string representation of number
* Alternate Constructor CStr(i32 Number);
* CStr(u32 Number);
* @param int Number integer to be used for initialization CStr(i64 Number);
**/ CStr(u64 Number);
CStr(int Number);
/**
* Alternate Constructor
*
* @param unsigned int Number unsigned integer to be used for initialization
**/
CStr(unsigned int Number);
/**
* Alternate Constructor
*
* @param long Number long to be used for initialization
**/
CStr(long Number);
/**
* Alternate Constructor
*
* @param unsigned long Number unsigned long to be used for initialization
**/
CStr(unsigned long Number);
/**
* Alternate Constructor
*
* @param float Number float to be used for initialization
**/
CStr(float Number); CStr(float Number);
/**
* Alternate Constructor
*
* @param double Number double to be used for initialization
**/
CStr(double Number); CStr(double Number);
/**
* Destructor
*
**/
//~CStr() {};
// Conversions: // Conversions:
/** /**
@ -437,49 +402,6 @@ public:
// Overloaded operations // Overloaded operations
/**
* Set the CStr equal to an integer.
*
* @param int Number integer to convert to a CStr.
* @return CStr
**/
CStr& operator=(int Number);
/**
* Set the CStr equal to a long.
*
* @param long Number long to convert to a CStr.
* @return CStr
**/
CStr& operator=(long Number);
/**
* Set the CStr equal to an unsigned integer.
*
* @param unsigned int Number unsigned int to convert to a CStr.
* @return CStr
**/
CStr& operator=(unsigned int Number);
/**
* Set the CStr equal to an unsigned long.
*
* @param unsigned long Number unsigned long to convert to a CStr.
* @return CStr
**/
CStr& operator=(unsigned long Number);
/**
* Set the CStr equal to a float.
*
* @param float Number float to convert to a CStr.
* @return CStr
**/
CStr& operator=(float Number);
/**
* Set the CStr equal to a double.
*
* @param double Number double to convert to a CStr.
* @return CStr
**/
CStr& operator=(double Number);
CStr operator+(const CStr& Str); CStr operator+(const CStr& Str);
CStr operator+(const tchar* Str); CStr operator+(const tchar* Str);
#ifndef _UNICODE #ifndef _UNICODE