[ATL]
[reactos.git] / reactos / sdk / lib / atl / cstringt.h
index 2e7460b..f6338a7 100644 (file)
@@ -326,48 +326,52 @@ public:
         *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())
     {
     }
@@ -449,6 +453,12 @@ public:
         return *this;
     }
 
+    CStringT& operator+=(_In_ XCHAR ch)
+    {
+        CThisSimpleString::operator+=(ch);
+        return *this;
+    }
+
     BOOL LoadString(_In_ UINT nID)
     {
         return LoadString(_AtlBaseModule.GetResourceInstance(), nID);