本文整理汇总了C#中ISilDataAccess.GetObjIndex方法的典型用法代码示例。如果您正苦于以下问题:C# ISilDataAccess.GetObjIndex方法的具体用法?C# ISilDataAccess.GetObjIndex怎么用?C# ISilDataAccess.GetObjIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISilDataAccess
的用法示例。
在下文中一共展示了ISilDataAccess.GetObjIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNextSeg
/// <summary>
/// Given that idxCurSeg is the index of a segment of curPara, adjust both until it is the index of the
/// next segment (possibly in a later paragraph). Return false if no earlier segment exists in
/// the current text.
/// </summary
private static bool GetNextSeg(ref int idxCurSeg, ISilDataAccess sda,
ref StTxtPara curPara, int ktagParaSegments)
{
idxCurSeg++;
// This for usually exits early in the first iteration, and all we do in the method is increment idxCurSeg.
// It is even rarer to have more than one full iteration but could happen if there is an empty paragraph.
for (; ; )
{
int csegs = sda.get_VecSize(curPara.Hvo, ktagParaSegments);
if (idxCurSeg < csegs)
return true;
// set curPara to next para in StText. If there is none, fail.
int idxPara = sda.GetObjIndex(curPara.OwnerHVO, (int)StText.StTextTags.kflidParagraphs, curPara.Hvo);
int cpara = sda.get_VecSize(curPara.OwnerHVO, (int)StText.StTextTags.kflidParagraphs);
if (idxPara >= cpara - 1)
return false;
int hvoNext = sda.get_VecItem(curPara.OwnerHVO, (int)StText.StTextTags.kflidParagraphs, idxPara + 1);
curPara = CmObject.CreateFromDBObject(curPara.Cache, hvoNext, false) as StTxtPara;
idxCurSeg = 0;
}
}
示例2: GetPrevSeg
/// <summary>
/// Given that idxCurSeg is the index of a segment of curPara, adjust both until it is the index of the
/// previous segment (possibly in an earlier paragraph). Return false if no earlier segment exists in
/// the current text.
/// </summary
private static bool GetPrevSeg(ref int idxCurSeg, ISilDataAccess sda,
ref StTxtPara curPara, int ktagParaSegments)
{
idxCurSeg--;
// This while usually has no iterations, and all we do in the method is decrement idxCurSeg.
// It is even rarer to have more than one iteration but could happen if there is an empty paragraph.
while (idxCurSeg < 0)
{
// set curPara to previous para in StText. If there is none, fail.
int idxPara = sda.GetObjIndex(curPara.OwnerHVO, (int)StText.StTextTags.kflidParagraphs, curPara.Hvo);
if (idxPara == 0)
return false;
int hvoPrev = sda.get_VecItem(curPara.OwnerHVO, (int)StText.StTextTags.kflidParagraphs, idxPara - 1);
curPara = CmObject.CreateFromDBObject(curPara.Cache, hvoPrev, false) as StTxtPara;
idxCurSeg = sda.get_VecSize(curPara.Hvo, ktagParaSegments) - 1;
}
return true;
}