mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Add static constructor
This commit is contained in:
@ -35,15 +35,6 @@
|
|||||||
|
|
||||||
namespace XLS
|
namespace XLS
|
||||||
{
|
{
|
||||||
std::map<std::wstring, std::vector<bool>> FutureFunctionArgs =
|
|
||||||
{
|
|
||||||
{
|
|
||||||
L"_xlfn.DAYS",{0,1,1}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
L"_xlfn.NETWORKDAYS.INTL",{0, 0, 0, 1, 0}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const bool FutureFunctionParser::GetFutureFunction(std::wstring& functionName)
|
const bool FutureFunctionParser::GetFutureFunction(std::wstring& functionName)
|
||||||
{
|
{
|
||||||
@ -52,7 +43,8 @@ namespace XLS
|
|||||||
{
|
{
|
||||||
tempName = L"_xlfn." + tempName;
|
tempName = L"_xlfn." + tempName;
|
||||||
}
|
}
|
||||||
if(FutureFunctionArgs.find(tempName) != FutureFunctionArgs.end())
|
auto functions = init();
|
||||||
|
if(functions.FutureFunctions.find(tempName) != functions.FutureFunctions.end())
|
||||||
{
|
{
|
||||||
functionName = tempName;
|
functionName = tempName;
|
||||||
return true;
|
return true;
|
||||||
@ -63,12 +55,25 @@ namespace XLS
|
|||||||
std::vector<bool> FutureFunctionParser::GetArgumentList( const std::wstring& functionName)
|
std::vector<bool> FutureFunctionParser::GetArgumentList( const std::wstring& functionName)
|
||||||
{
|
{
|
||||||
std::vector<bool> argVector;
|
std::vector<bool> argVector;
|
||||||
auto findedFunc = FutureFunctionArgs.find(functionName);
|
auto functions = init();
|
||||||
if(findedFunc != FutureFunctionArgs.end())
|
auto findedFunc = functions.FutureFunctions.find(functionName);
|
||||||
|
if(findedFunc != functions.FutureFunctions.end())
|
||||||
{
|
{
|
||||||
argVector = findedFunc->second;
|
argVector = findedFunc->second;
|
||||||
}
|
}
|
||||||
return argVector;
|
return argVector;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace XLS
|
FutureFunctionParser& FutureFunctionParser::init()
|
||||||
|
{
|
||||||
|
static FutureFunctionParser parser;
|
||||||
|
return parser;
|
||||||
|
}
|
||||||
|
|
||||||
|
FutureFunctionParser::FutureFunctionParser()
|
||||||
|
{
|
||||||
|
FutureFunctions.emplace (L"_xlfn.DAYS", std::vector<bool>{0,1,1});
|
||||||
|
FutureFunctions.emplace(L"_xlfn.NETWORKDAYS.INTL",std::vector<bool>{0, 0, 0, 1, 0});
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace XLS
|
||||||
|
|||||||
@ -45,6 +45,11 @@ public:
|
|||||||
static const bool GetFutureFunction(std::wstring& functionName);
|
static const bool GetFutureFunction(std::wstring& functionName);
|
||||||
static std::vector<bool> GetArgumentList( const std::wstring& functionName);
|
static std::vector<bool> GetArgumentList( const std::wstring& functionName);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FutureFunctionParser();
|
||||||
|
static FutureFunctionParser& init();
|
||||||
|
std::map<std::wstring, std::vector<bool>> FutureFunctions;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user