本文整理汇总了C#中tinyAsn1.PEREffectiveConstraint类的典型用法代码示例。如果您正苦于以下问题:C# PEREffectiveConstraint类的具体用法?C# PEREffectiveConstraint怎么用?C# PEREffectiveConstraint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PEREffectiveConstraint类属于tinyAsn1命名空间,在下文中一共展示了PEREffectiveConstraint类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PrintCIsConstraintValid
public static void PrintCIsConstraintValid(Asn1Type pThis, PEREffectiveConstraint cns, StreamWriterLevel c, string errorCode, string typeName, string varName, int lev, int arrayDepth)
{
string varName2 = varName;
if (!varName.Contains("->"))
varName2 = "*" + varName;
if (pThis.m_constraints.Count > 0)
{
c.P(lev); c.Write("if ( !(");
for (int i = 0; i < pThis.m_constraints.Count; i++)
{
string ret = ((ISCConstraint)pThis.m_constraints[i]).PrintCIsConstraintValid(varName2, lev);
c.Write(ret);
if (i != pThis.m_constraints.Count - 1)
c.Write(" && ");
}
c.WriteLine(") ) {");
c.P(lev + 1);
c.WriteLine("*pErrCode = ERR_{0};", C.ID(errorCode));
c.P(lev + 1);
c.WriteLine("return FALSE;");
c.P(lev);
c.WriteLine("}");
}
}
开发者ID:kia92798,项目名称:tinyasn1,代码行数:25,代码来源:CSSType.cs
示例2: PrintCDecode
public void PrintCDecode(PEREffectiveConstraint cns, StreamWriterLevel c, string varName, int lev)
{
long min = minItems(cns);
long max = maxItems(cns);
string i = "i" + (CLocalVariable.GetArrayIndex(varName) + 1);
string length = "length" + (CLocalVariable.GetArrayIndex(varName) + 1);
string curBlockSize = "curBlockSize" + (CLocalVariable.GetArrayIndex(varName) + 1);
string nCount = "nCount" + (CLocalVariable.GetArrayIndex(varName) + 1);
string prefix = "";
bool topLevel = !varName.Contains("->");
if (topLevel)
prefix = varName + "->";
else
prefix = varName + ".";
if (max < 0x10000)
{
if (min != max)
{
c.P(lev);
c.WriteLine("if (!BitStream_DecodeConstraintWholeNumber(pBitStrm, &nCount, {0}, {1})) {{", min, max);
c.P(lev + 1);
c.WriteLine("*pErrCode = ERR_INSUFFICIENT_DATA;");
c.P(lev + 1);
c.WriteLine("return FALSE;");
c.P(lev);
c.WriteLine("}");
c.P(lev);
c.WriteLine("{0}nCount = (long)nCount;", prefix);
}
else
{
c.P(lev);
c.WriteLine("{0}nCount = {1};", prefix, max);
}
c.P(lev);
c.WriteLine("if (!BitStream_ReadBits(pBitStrm, {0}arr, {0}nCount)) {{", prefix);
c.P(lev + 1);
c.WriteLine("*pErrCode = ERR_INSUFFICIENT_DATA;");
c.P(lev + 1);
c.WriteLine("return FALSE;");
c.P(lev);
c.WriteLine("}");
}
else
{
PrintCDecodeFragmentation(cns, c, varName, lev,
"arr", max, prefix, length, curBlockSize, nCount);
}
}
开发者ID:kia92798,项目名称:tinyasn1,代码行数:52,代码来源:SCCSingleTypes.cs
示例3: PrintHtml
//Default implementation of PrintHtml for all types
public static void PrintHtml(Asn1Type pThis, PEREffectiveConstraint cns, StreamWriterLevel o, int lev, List<string> comment, TypeAssigment tas, List<IConstraint> additonalConstraints)
{
o.WriteLine("<a name=\"{0}\"></a>", "ICD_" + tas.m_name.Replace("-", "_"));
o.WriteLine("<table border=\"0\" width=\"100%\" >");
o.WriteLine("<tbody>");
o.WriteLine("<tr bgcolor=\"{0}\">", (tas.m_createdThroughTabulization ? "#379CEE" : "#FF8f00"));
o.WriteLine("<td height=\"35\" colspan=\"2\" >");
o.WriteLine("<font face=\"Verdana\" color=\"#FFFFFF\" size=\"4\">{0}</font><font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\">({1}) </font>", tas.m_name, pThis.Name);
o.WriteLine("<font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\"><a href=\"#{0}\">ASN.1</a></font>", "ASN1_" + tas.m_name.Replace("-", "_"));
o.WriteLine("</td>");
o.WriteLine("<td height=\"35\" align=\"center\">");
o.WriteLine(" <font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\">min = {0} bytes</font>", (pThis.MinBytesInPER == -1 ? "∞" : pThis.MinBytesInPER.ToString()));
o.WriteLine("</td>");
o.WriteLine("<td height=\"35\" align=\"center\">");
o.WriteLine(" <font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\">max = {0} bytes{1}</font>", (pThis.MaxBytesInPER == -1 ? "∞" : pThis.MaxBytesInPER.ToString()), pThis.MaxBitsInPER_Explained);
o.WriteLine("</td>");
o.WriteLine("</tr>");
IInternalContentsInHtml pICIH = pThis as IInternalContentsInHtml;
string tmp = string.Empty;
if (pICIH != null)
tmp = pICIH.InternalContentsInHtml(additonalConstraints);
if (comment.Count > 0 || tmp.Length > 0)
{
o.WriteLine("<tr class=\"CommentRow\">");
o.WriteLine("<td class=\"comment2\" colspan=\"4\">" + o.BR(comment) + tmp + "</td>");
o.WriteLine("</tr>");
}
o.WriteLine("<tr class=\"headerRow\">");
o.WriteLine("<td class=\"hrconstraint2\" colspan=\"2\">Constraints</td>");
o.WriteLine("<td class=\"hrMin2\">Min Length (bits)</td>");
o.WriteLine("<td class=\"hrMax2\">Max Length (bits)</td>");
o.WriteLine("</tr>");
o.WriteLine("<tr class=\"OddRow\">");
o.WriteLine(" <td class=\"constraint\" colspan=\"2\">{0}</td>", o.Constraint(pThis.Constraints + BaseConstraint.AsString(additonalConstraints)));
o.WriteLine(" <td class=\"min\" >{0}</td>", pThis.MinBitsInPER);
o.WriteLine(" <td class=\"max\" >{0}{1}</td>", pThis.MaxBitsInPER, pThis.MaxBitsInPER_Explained);
o.WriteLine("</tr>");
o.WriteLine("</tbody>");
o.WriteLine("</table>");
}
开发者ID:kia92798,项目名称:tinyasn1,代码行数:48,代码来源:ConstructedTypes.cs
示例4: PrintCDecode
public void PrintCDecode(PEREffectiveConstraint cns, StreamWriterLevel c, string varName, int lev)
{
string varName2 = varName;
if (!varName.Contains("->"))
varName2 += "->";
else
varName2 += ".";
int largestIndex = -1;
foreach (string v in m_children.Keys)
{
if (m_children[v].m_extended)
continue;
largestIndex++;
}
c.P(lev);
c.WriteLine("if (!BitStream_DecodeConstraintWholeNumber(pBitStrm, &nChoiceIndex, {0}, {1})) {{", 0, largestIndex);
c.P(lev + 1);
c.WriteLine("*pErrCode = ERR_INSUFFICIENT_DATA;");
c.P(lev + 1);
c.WriteLine("return FALSE;");
c.P(lev);
c.WriteLine("}");
c.P(lev);
c.WriteLine("switch(nChoiceIndex)");
c.P(lev); c.WriteLine("{");
int choiceIndex = 0;
foreach (ChoiceChild ch in m_children.Values)
{
c.P(lev); c.WriteLine("case {0}:", choiceIndex);
((ISCCType)ch.m_type).PrintCDecode(ch.m_type.PEREffectiveConstraint, c,
varName2 + "u." + C.ID(ch.m_childVarName), lev + 1);
c.P(lev + 1);
c.WriteLine("{0}kind = {1};", varName2, ch.CID);
c.P(lev + 1);
c.WriteLine("break;");
choiceIndex++;
}
c.P(lev); c.WriteLine("}");
}
开发者ID:kia92798,项目名称:tinyasn1,代码行数:42,代码来源:SCCChoiceType.cs
示例5: PrintCInitialize
public static void PrintCInitialize(ArrayType pThis, PEREffectiveConstraint cns,
Asn1Value defauleVal, StreamWriterLevel c, string typeName, string varName, int lev, int arrayDepth)
{
long min = pThis.minItems(cns);
long max = pThis.maxItems(cns);
string i = "i" + arrayDepth.ToString();
string prefix = "";
bool topLevel = !varName.Contains("->");
if (topLevel)
prefix = varName + "->";
else
{
prefix = varName + ".";
}
ArrayValue arVal = defauleVal as ArrayValue;
if (arVal == null)
{
c.P(lev);
c.WriteLine("{0}nCount = 0;", prefix);
c.P(lev); c.WriteLine("for({0}=0;{0}<{1};{0}++)", i, pThis.maxItems(cns));
c.P(lev); c.WriteLine("{");
((ISCCType)pThis.m_type).PrintCInitialize(pThis.m_type.PEREffectiveConstraint, pThis.m_type.GetOneValidValue(), c,
typeName + "_arr", prefix + "arr[" + i + "]", lev + 1, arrayDepth + 1);
c.P(lev); c.WriteLine("}");
}
else
{
c.P(lev);
c.WriteLine("{0}nCount = {1};", prefix, arVal.m_children.Count);
for (int k = 0; k < arVal.m_children.Count; k++)
{
c.P(lev); c.WriteLine("{");
((ISCCType)pThis.m_type).PrintCInitialize(pThis.m_type.PEREffectiveConstraint, arVal.m_children[k], c,
typeName + "_arr", prefix + "arr[" + k.ToString() + "]", lev + 1, arrayDepth + 1);
c.P(lev); c.WriteLine("}");
}
}
}
开发者ID:kia92798,项目名称:tinyasn1,代码行数:40,代码来源:SCCArray.cs
示例6: PrintCInitialize
public void PrintCInitialize(PEREffectiveConstraint cns, Asn1Value defaultVal, StreamWriterLevel h, string typeName, string varName, int lev, int arrayDepth)
{
bool topLevel = !varName.Contains("->");
h.P(lev);
if (topLevel)
h.WriteLine("*{0} = 0;", varName);
else
h.WriteLine("{0} = 0;", varName);
}
开发者ID:kia92798,项目名称:tinyasn1,代码行数:9,代码来源:SCCSingleTypes.cs
示例7: PrintCEncode
public void PrintCEncode(PEREffectiveConstraint cns, StreamWriterLevel c, string errorCode, string varName, int lev)
{
c.P(lev); c.WriteLine("/* NULL type */");
}
开发者ID:kia92798,项目名称:tinyasn1,代码行数:4,代码来源:SCCSingleTypes.cs
示例8: VarsNeededForDecode
public void VarsNeededForDecode(PEREffectiveConstraint cns, int arrayDepth, OrderedDictionary<string, CLocalVariable> existingVars)
{
PERIntegerEffectiveConstraint cn = cns as PERIntegerEffectiveConstraint;
if (cns != null && cn.Extensible)
{
if (!existingVars.ContainsKey("extBit"))
{
existingVars.Add("extBit", new CLocalVariable("extBit", "flag", 0, "FALSE"));
}
}
}
开发者ID:kia92798,项目名称:tinyasn1,代码行数:11,代码来源:SCCSingleTypes.cs
示例9: PrintHtml
public void PrintHtml(PEREffectiveConstraint cns, StreamWriterLevel o, int lev, List<string> comment, TypeAssigment tas, List<IConstraint> additonalConstraints)
{
ICDBType.PrintHtml(this, cns, o, lev, comment, tas, additonalConstraints);
}
开发者ID:kia92798,项目名称:tinyasn1,代码行数:4,代码来源:SingleTypes.cs
示例10: maxItemBitsInPER
public override long maxItemBitsInPER(PEREffectiveConstraint cns)
{
if (!DefaultBackend.EnterRecursiveFunc(MB.GetCurrentMethod().Name, this))
return -1;
long ret = minItemBitsInPER(cns);
DefaultBackend.LeaveRecursiveFunc(MB.GetCurrentMethod().Name, this);
return ret;
}
开发者ID:kia92798,项目名称:tinyasn1,代码行数:10,代码来源:StringTypes.cs
示例11: VarsNeededForEncode
public void VarsNeededForEncode(PEREffectiveConstraint cns, int arrayDepth, OrderedDictionary<string, CLocalVariable> existingVars)
{
}
开发者ID:kia92798,项目名称:tinyasn1,代码行数:3,代码来源:SCCSingleTypes.cs
示例12: PrintCIsConstraintValid
public void PrintCIsConstraintValid(PEREffectiveConstraint cns, StreamWriterLevel c, string errorCode, string typeName, string varName, int lev, int arrayDepth)
{
CSSType.PrintCIsConstraintValid(this, cns, c, errorCode, typeName, varName, lev, arrayDepth);
}
开发者ID:kia92798,项目名称:tinyasn1,代码行数:4,代码来源:SCCSingleTypes.cs
示例13: PrintHTypeDeclaration
public void PrintHTypeDeclaration(PEREffectiveConstraint cns, StreamWriterLevel h, string typeName, string varName, int lev)
{
h.WriteLine("enum {");
// h.WriteLine("enum {0} {{", typeName);
int i = 0;
foreach (Item it in m_enumValues.Values)
{
h.P(lev + 1);
h.Write("{0} = {1}", it.CID, it.m_value);
if (i < m_enumValues.Values.Count - 1)
h.WriteLine(",");
else
h.WriteLine();
i++;
}
h.P(lev);
h.Write("}");
}
开发者ID:kia92798,项目名称:tinyasn1,代码行数:19,代码来源:SCCSingleTypes.cs
示例14: PrintCDecodeItem
public void PrintCDecodeItem(PEREffectiveConstraint cns, StreamWriterLevel c, string varName, int lev)
{
SCCStringBase.PrintCDecodeItem(this, cns, c, varName, lev);
}
开发者ID:kia92798,项目名称:tinyasn1,代码行数:4,代码来源:SCCSingleTypes.cs
示例15: ItemConstraint
public override string ItemConstraint(PEREffectiveConstraint cns)
{
PERAlphabetAndSizeEffectiveConstraint cn = (PERAlphabetAndSizeEffectiveConstraint)cns;
if (cn.m_from!=null)
return cn.m_from.ToString();
return "";
}
开发者ID:kia92798,项目名称:tinyasn1,代码行数:7,代码来源:StringTypes.cs
示例16: minItemBitsInPER
public override long minItemBitsInPER(PEREffectiveConstraint cns)
{
if (!DefaultBackend.EnterRecursiveFunc(MB.GetCurrentMethod().Name, this))
return 0;
PERAlphabetAndSizeEffectiveConstraint cn = (PERAlphabetAndSizeEffectiveConstraint)cns;
long ret = BitsPerSingleChar(cn.m_from);
DefaultBackend.LeaveRecursiveFunc(MB.GetCurrentMethod().Name, this);
return ret;
}
开发者ID:kia92798,项目名称:tinyasn1,代码行数:11,代码来源:StringTypes.cs
注:本文中的tinyAsn1.PEREffectiveConstraint类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论