|
/* This file is a part of SmartLexicon, a multi-lingual dictionary engine.
Copyright (C) 2005, Kostas Giannakakis
SmartLexicon 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.
SmartLexicon 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 SmartLexicon; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
#include "LexSourceFileBase.h"
#include <vector>
using std::vector;
class AFX_EXT_CLASS CLexIndexFileBase
{
public:
/// Constructor
CLexIndexFileBase()
{
lang = &langDefault;
isReady = FALSE;
name = _T("");
isOpen = FALSE;
for(int i = 0; i < PARAM_COUNT; i++)
{
param[i] = paramName[i] = _T("");
paramType[i] = PARAM_EMPTY;
}
extentionFilter = _T("All Files (*.*)|*.*||");
};
/// Destructor
virtual ~CLexIndexFileBase(void) {};
static CLexIndexFileBase* CreateNew();
/** Creates the index file corresponding to aSourceFile.
* @param aSourceFile Pointer to the source file.
* @return Returns one of LOADING_SUCCESSFUL, LOADING_FAILED, LOADING_PENDING.
*/
virtual int LoadNew(CLexSourceFileBase *aSourceFile) = 0;
virtual int Load(CLexSourceFileBase *aSourceFile, CString aName) = 0;
/** Returns the progress of the loading process
* @return Percentage (0-100%) of completion of the current stage
*/
virtual int GetProgress() = 0;
virtual void GetProgressMessage(CString &str) = 0;
/** Cancels the loading of the lexicon.
*/
virtual void StopLoading() = 0;
virtual BOOL IsLoadingOver(BOOL& result) = 0;
virtual int FindWords(const CString& wordStart,
vector<int> *wordAppearancesVector,
BOOL completeWord = FALSE,
BOOL exactMatch = FALSE) = 0;
void GetFileExtentionFilter(CString& aExtentionFilter)
{
aExtentionFilter = extentionFilter;
};
void GetParam(int i, CString ¶mStr)
{
if (i < 0 || i >= PARAM_COUNT)
{
paramStr = _T("");
}
paramStr = param[i];
};
void SetParam(int i, CString ¶mStr)
{
if (i >= 0 || i < PARAM_COUNT)
{
param[i] = paramStr;
}
};
void GetParamName(int i, CString ¶mStr)
{
if (i < 0 || i >= PARAM_COUNT)
{
paramStr = _T("");
}
paramStr = paramName[i];
};
int GetParamType(int i)
{
if (i >= 0 || i < PARAM_COUNT)
{
return(paramType[i]);
}
return(0);
};
void GetName(CString& aName) {aName = name;};
void SetLang(CLang* l) { lang = l; };
CLang* GetLang() { return(lang); };
enum {LOADING_SUCCESSFUL = 0, LOADING_FAILED, LOADING_PENDING};
enum { PARAM_EMPTY = 0, PARAM_STRING, PARAM_INT, PARAM_BOOL};
static const int PARAM_COUNT = 3;
protected:
virtual BOOL IsValidEntry(CString &entry) = 0;
BOOL isReady;
BOOL isOpen;
CString name;
CString extentionFilter;
// Parameters
CString param[PARAM_COUNT];
CString paramName[PARAM_COUNT];
int paramType[PARAM_COUNT];
private:
CLang* lang;
CLang langDefault;
};
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.