Move RawString.h into Common

This commit is contained in:
Birunthan Mohanathas
2013-05-31 17:34:36 +03:00
parent 1934c5db72
commit bdb5605d24
10 changed files with 13 additions and 13 deletions

View File

@ -314,6 +314,7 @@
<ClInclude Include="..\Common\Gfx\Util\WICBitmapLockGDIP.h" />
<ClInclude Include="..\Common\MenuTemplate.h" />
<ClInclude Include="..\Common\Platform.h" />
<ClInclude Include="..\Common\RawString.h" />
<ClInclude Include="..\Common\StringUtil.h" />
<ClInclude Include="CommandHandler.h" />
<ClInclude Include="ConfigParser.h" />
@ -360,7 +361,6 @@
<ClInclude Include="Rainmeter.h" />
<ClInclude Include="Export.h" />
<ClInclude Include="RainmeterQuery.h" />
<ClInclude Include="RawString.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="Section.h" />
<ClInclude Include="StdAfx.h" />

View File

@ -611,9 +611,6 @@
<ClInclude Include="Export.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="RawString.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MathParser.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -692,6 +689,9 @@
<ClInclude Include="CommandHandler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Common\RawString.h">
<Filter>Common</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Library.rc">

View File

@ -1,92 +0,0 @@
/*
Copyright (C) 2011 Birunthan Mohanathas
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __RAWSTRING_H__
#define __RAWSTRING_H__
#include <windows.h>
class RawString
{
public:
RawString() :
m_String()
{
}
RawString(const WCHAR* str) :
m_String(str_alloc(str))
{
}
RawString(const RawString& rhs) :
m_String(str_alloc(rhs.c_str()))
{
}
~RawString()
{
clear();
}
RawString& operator=(const WCHAR* rhs)
{
clear();
m_String = str_alloc(rhs);
return *this;
}
RawString& operator=(const RawString& rhs)
{
if (&rhs != this)
{
clear();
m_String = str_alloc(rhs.m_String);
}
return *this;
}
const WCHAR* c_str() const
{
return m_String ? m_String : L"";
}
bool empty() const
{
return !m_String || !(*m_String);
}
void clear()
{
if (m_String)
{
free(m_String);
m_String = nullptr;
}
}
private:
WCHAR* str_alloc(const WCHAR* str)
{
return str ? _wcsdup(str) : nullptr;
}
WCHAR* m_String;
};
#endif