chrcatid_t_blank and langid_t_blank are static members of their respective structures now
This commit is contained in:
parent
e4e8609a00
commit
dddc2d5794
@ -26,7 +26,7 @@
|
||||
|
||||
wxZRColaSettings::wxZRColaSettings(wxWindow* parent) :
|
||||
m_lang_auto(true),
|
||||
m_lang(ZRCola::langid_t_blank),
|
||||
m_lang(ZRCola::langid_t::blank),
|
||||
wxZRColaSettingsBase(parent)
|
||||
{
|
||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
||||
@ -184,7 +184,7 @@ bool wxPersistentZRColaSettings::Restore()
|
||||
const auto &lang = app->m_lang_db.idxLng[0];
|
||||
wnd->m_lang = lang.id;
|
||||
} else
|
||||
wnd->m_lang = ZRCola::langid_t_blank;
|
||||
wnd->m_lang = ZRCola::langid_t::blank;
|
||||
|
||||
return wxPersistentDialog::Restore();
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\character.cpp" />
|
||||
<ClCompile Include="..\src\common.cpp" />
|
||||
<ClCompile Include="..\src\language.cpp" />
|
||||
<ClCompile Include="..\src\mapping.cpp" />
|
||||
<ClCompile Include="..\src\normalize.cpp" />
|
||||
|
@ -33,6 +33,9 @@
|
||||
<ClCompile Include="..\src\character.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\common.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\stdafx.h">
|
||||
|
@ -45,7 +45,7 @@ namespace ZRCola {
|
||||
/// Character category ID type
|
||||
/// Two letter abbreviation, non-terminated
|
||||
///
|
||||
struct chrcatid_t {
|
||||
struct ZRCOLA_API chrcatid_t {
|
||||
char data[2];
|
||||
|
||||
inline chrcatid_t& operator=(const chrcatid_t &src)
|
||||
@ -60,15 +60,14 @@ namespace ZRCola {
|
||||
data[1] = (data[0] = src[0]) != 0 ? src[1] : 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
///
|
||||
/// Blank character category
|
||||
///
|
||||
static const chrcatid_t blank;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Blank character category
|
||||
///
|
||||
const chrcatid_t chrcatid_t_blank = {};
|
||||
|
||||
|
||||
///
|
||||
/// Compares two character category IDs
|
||||
///
|
||||
@ -251,14 +250,14 @@ namespace ZRCola {
|
||||
///
|
||||
/// \returns
|
||||
/// - Character category if character found
|
||||
/// - `ZRCola::chrcatid_t_blank` otherwise
|
||||
/// - `ZRCola::chrcatid_t::blank` otherwise
|
||||
///
|
||||
inline chrcatid_t GetCharCat(wchar_t c) const
|
||||
{
|
||||
char _chr[sizeof(character)];
|
||||
((character *)_chr)->chr = c;
|
||||
indexChar::size_type start;
|
||||
return idxChr.find(*((character *)_chr), start) ? idxChr[start].cat : chrcatid_t_blank;
|
||||
return idxChr.find(*((character *)_chr), start) ? idxChr[start].cat : chrcatid_t::blank;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -76,7 +76,7 @@ namespace ZRCola {
|
||||
/// Language ID type
|
||||
/// Three letter abbreviation, zero terminated
|
||||
///
|
||||
struct langid_t {
|
||||
struct ZRCOLA_API langid_t {
|
||||
char data[4];
|
||||
|
||||
inline langid_t& operator=(const langid_t &src)
|
||||
@ -99,15 +99,14 @@ namespace ZRCola {
|
||||
src[3] : 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
///
|
||||
/// Blank language ID
|
||||
///
|
||||
static const langid_t blank;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Blank language ID
|
||||
///
|
||||
const langid_t langid_t_blank = {};
|
||||
|
||||
|
||||
///
|
||||
/// Compares two language IDs
|
||||
///
|
||||
|
@ -224,7 +224,7 @@ namespace ZRCola {
|
||||
///
|
||||
inline void Decompose(_In_z_count_(inputMax) const wchar_t* input, _In_ size_t inputMax, _Out_ std::wstring &output, _Out_opt_ std::vector<mapping>* map = NULL) const
|
||||
{
|
||||
Decompose(input, inputMax, NULL, langid_t_blank, output, map);
|
||||
Decompose(input, inputMax, NULL, langid_t::blank, output, map);
|
||||
}
|
||||
|
||||
///
|
||||
|
@ -20,6 +20,9 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
const ZRCola::chrcatid_t ZRCola::chrcatid_t::blank = {};
|
||||
|
||||
|
||||
bool ZRCola::character_db::Search(_In_z_ const wchar_t *str, _In_ const std::set<chrcatid_t> &cats, _Inout_ std::map<wchar_t, charrank_t> &hits, _Inout_ std::map<wchar_t, charrank_t> &hits_sub, _In_opt_ bool (__cdecl *fn_abort)(void *cookie), _In_opt_ void *cookie) const
|
||||
{
|
||||
assert(str);
|
||||
|
23
lib/libZRCola/src/common.cpp
Normal file
23
lib/libZRCola/src/common.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
|
||||
This file is part of ZRCola.
|
||||
|
||||
ZRCola 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ZRCola 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 ZRCola. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
const ZRCola::langid_t ZRCola::langid_t::blank = {};
|
Loading…
x
Reference in New Issue
Block a user