mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Move RawString.h into Common
This commit is contained in:
@ -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" />
|
||||
|
@ -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">
|
||||
|
@ -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
|
Reference in New Issue
Block a user