Some style improvements
This commit is contained in:
@@ -11,13 +11,13 @@
|
|||||||
|
|
||||||
#include "crossbasetypes.hpp"
|
#include "crossbasetypes.hpp"
|
||||||
|
|
||||||
const wxChar CELL_CLEAR = wxT('+');
|
const wxChar CELL_CLEAR = wxT('+');
|
||||||
const wxChar CELL_BORDER = wxT('-');
|
const wxChar CELL_BORDER = wxT('-');
|
||||||
const TransedChar TRANS_CLEAR = 0;
|
const TransedChar TRANS_CLEAR = 0;
|
||||||
const TransedChar TRANS_BORDER = 1;
|
const TransedChar TRANS_BORDER = 1;
|
||||||
const uint32_t MAX_WORD_COUNT = 262144; // =2^18
|
const uint32_t MAX_WORD_COUNT = 262144; // =2^18
|
||||||
|
|
||||||
void readDict(const wxString path, DictType &dict){
|
void readDict(const wxString path, DictType &dict_out){
|
||||||
wxTextFile f;
|
wxTextFile f;
|
||||||
f.Open(path);
|
f.Open(path);
|
||||||
for ( wxString str = f.GetFirstLine(); !f.Eof(); str = f.GetNextLine() ) {
|
for ( wxString str = f.GetFirstLine(); !f.Eof(); str = f.GetNextLine() ) {
|
||||||
@@ -25,7 +25,7 @@ void readDict(const wxString path, DictType &dict){
|
|||||||
int del_ind = str.Index('-');
|
int del_ind = str.Index('-');
|
||||||
key = str.Left(del_ind-1);
|
key = str.Left(del_ind-1);
|
||||||
val = str.Right(str.size() - del_ind - 2);
|
val = str.Right(str.size() - del_ind - 2);
|
||||||
dict[key] = val;
|
dict_out[key] = val;
|
||||||
}
|
}
|
||||||
f.Close();
|
f.Close();
|
||||||
};
|
};
|
||||||
@@ -106,7 +106,7 @@ void generateAllWords(const DictType &dict, AllWordsType &words_out,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void generateWordInfo(const GridType &grid, std::vector<WordInfo> &winfos){
|
void generateWordInfo(const GridType &grid, std::vector<WordInfo> &winfos_out){
|
||||||
wxLogDebug(wxT("Printing grid: "));
|
wxLogDebug(wxT("Printing grid: "));
|
||||||
for (size_t i = 0; i < grid.size(); ++i){
|
for (size_t i = 0; i < grid.size(); ++i){
|
||||||
wxString st;
|
wxString st;
|
||||||
@@ -141,7 +141,7 @@ void generateWordInfo(const GridType &grid, std::vector<WordInfo> &winfos){
|
|||||||
t.len = cur_len;
|
t.len = cur_len;
|
||||||
t.ind = cur_ind;
|
t.ind = cur_ind;
|
||||||
t.direct = false;
|
t.direct = false;
|
||||||
winfos.push_back(t);
|
winfos_out.push_back(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ((i ==0) || (grid.at(i - 1).at(j) != CELL_CLEAR)) &&
|
if ( ((i ==0) || (grid.at(i - 1).at(j) != CELL_CLEAR)) &&
|
||||||
@@ -163,7 +163,7 @@ void generateWordInfo(const GridType &grid, std::vector<WordInfo> &winfos){
|
|||||||
t.len = cur_len;
|
t.len = cur_len;
|
||||||
t.ind = cur_ind;
|
t.ind = cur_ind;
|
||||||
t.direct = true;
|
t.direct = true;
|
||||||
winfos.push_back(t);
|
winfos_out.push_back(t);
|
||||||
}
|
}
|
||||||
if ( exist ){
|
if ( exist ){
|
||||||
exist = false;
|
exist = false;
|
||||||
@@ -179,8 +179,14 @@ uint32_t getWordUniq(const T &w_ind, const T &w_len){
|
|||||||
return w_ind + w_len * MAX_WORD_COUNT;
|
return w_ind + w_len * MAX_WORD_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool procCross(UsedWords used, const AllWordsType &words, WorkGridType grid,
|
bool procCross(
|
||||||
const std::vector<WordInfo> &winfos, const size_t cur_word_ind, std::vector<TransedWord> &out){
|
UsedWords used,
|
||||||
|
const AllWordsType &words,
|
||||||
|
WorkGridType grid,
|
||||||
|
const std::vector<WordInfo> &winfos,
|
||||||
|
const size_t cur_word_ind,
|
||||||
|
std::vector<TransedWord> &out
|
||||||
|
){
|
||||||
if (cur_word_ind == winfos.size())
|
if (cur_word_ind == winfos.size())
|
||||||
return true;
|
return true;
|
||||||
WordInfo cur_wi = winfos.at(cur_word_ind);
|
WordInfo cur_wi = winfos.at(cur_word_ind);
|
||||||
|
|||||||
Reference in New Issue
Block a user