*this = static_cast<const YCHAR*>(strSrc);
}
+protected:
+ /* helper function */
+ template <typename T_CHAR>
+ void LoadFromPtr_(_In_opt_z_ const T_CHAR* pszSrc)
+ {
+ if (pszSrc == NULL)
+ return;
+ if (IS_INTRESOURCE(pszSrc))
+ LoadString(LOWORD(pszSrc));
+ else
+ *this = pszSrc;
+ }
+
+public:
CStringT(_In_opt_z_ const XCHAR* pszSrc) :
- CThisSimpleString( StringTraits::GetDefaultManager() )
+ CThisSimpleString(StringTraits::GetDefaultManager())
{
- // FIXME: Check whether pszSrc is not a resource string ID!
- *this = pszSrc;
+ LoadFromPtr_(pszSrc);
}
- CStringT(
- _In_opt_z_ const XCHAR* pszSrc,
- _In_ IAtlStringMgr* pStringMgr) :
- CThisSimpleString( pStringMgr )
+ CStringT(_In_opt_z_ const XCHAR* pszSrc,
+ _In_ IAtlStringMgr* pStringMgr) : CThisSimpleString(pStringMgr)
{
- // FIXME: Check whether pszSrc is not a resource string ID!
- *this = pszSrc;
+ LoadFromPtr_(pszSrc);
}
CStringT(_In_opt_z_ const YCHAR* pszSrc) :
- CThisSimpleString( StringTraits::GetDefaultManager() )
+ CThisSimpleString(StringTraits::GetDefaultManager())
{
- // FIXME: Check whether pszSrc is not a resource string ID!
- *this = pszSrc;
+ LoadFromPtr_(pszSrc);
}
- CStringT(
- _In_opt_z_ const YCHAR* pszSrc,
- _In_ IAtlStringMgr* pStringMgr) :
- CThisSimpleString( pStringMgr )
+ CStringT(_In_opt_z_ const YCHAR* pszSrc,
+ _In_ IAtlStringMgr* pStringMgr) : CThisSimpleString(pStringMgr)
{
- // FIXME: Check whether pszSrc is not a resource string ID!
- *this = pszSrc;
+ LoadFromPtr_(pszSrc);
}
- CStringT(
- _In_reads_z_(nLength) const XCHAR* pch,
- _In_ int nLength) :
+ CStringT(_In_reads_z_(nLength) const XCHAR* pch,
+ _In_ int nLength) :
CThisSimpleString(pch, nLength, StringTraits::GetDefaultManager())
{
}
- CStringT(
- _In_reads_z_(nLength) const YCHAR* pch,
- _In_ int nLength) :
+ CStringT(_In_reads_z_(nLength) const YCHAR* pch,
+ _In_ int nLength) :
CThisSimpleString(pch, nLength, StringTraits::GetDefaultManager())
{
}
return *this;
}
+ CStringT& operator+=(_In_ XCHAR ch)
+ {
+ CThisSimpleString::operator+=(ch);
+ return *this;
+ }
+
BOOL LoadString(_In_ UINT nID)
{
return LoadString(_AtlBaseModule.GetResourceInstance(), nID);