_Core/Lang/Integration/RegisteredFunctions.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ComLib.Lang.Helpers;
namespace ComLib.Lang
{
/// <summary>
/// Helper class for calling functions
/// </summary>
public class RegisteredFunctions: IFunctionLookup
{
private Dictionary<string, FunctionStmt> _functions;
private Dictionary<string, string> _lcaseToFormaNameMap;
/// <summary>
/// Initialize
/// </summary>
public RegisteredFunctions()
{
_functions = new Dictionary<string, FunctionStmt>();
_lcaseToFormaNameMap = new Dictionary<string, string>();
}
/// <summary>
/// Registers a custom function callback.
/// </summary>
/// <param name="pattern"></param>
/// <param name="stmt">The function</param>
public void Register(string pattern, FunctionStmt stmt)
{
_functions[pattern] = stmt;
_lcaseToFormaNameMap[pattern.ToLower()] = pattern;
}
/// <summary>
/// Whether or not the function name.
/// </summary>
/// <param name="name">Name of the function</param>
/// <returns></returns>
public bool Contains(string name)
{
return _functions.ContainsKey(name);
}
/// <summary>
/// Get the formal case sensitive function name that matches the case insensitive function name supplied.
/// </summary>
/// <param name="name">Name of the function</param>
/// <returns></returns>
public string GetMatch(string name)
{
if (!_lcaseToFormaNameMap.ContainsKey(name))
return null;
后面还有 33 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
