Skip to content

Commit 4ef37ec

Browse files
authored
Add SpecificItemAndFieldName() to ISenseOrEntry (#337)
Added to support a fix for LT-22124 in Fieldworks.
1 parent ad2dcf7 commit 4ef37ec

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1818

1919
### Added
2020

21+
- [SIL.LCModel] Add SpecificItemAndFieldName() to ISenseOrEntry
2122
- [SIL.LCModel] Added a parameter to GetBestGuess() and TryGetBestGuess() to do lowercase matching regardless of the occurrence index
2223
- [SIL.LCModel] Add GetCaptionOrHeadword() to CmPicture
2324
- [SIL.LCModel] `LCModelStrings.NotSure` to allow clients to know if a grammatical category is the placeholder

src/SIL.LCModel/DomainImpl/OverridesLing_Lex.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10065,5 +10065,31 @@ public ILcmReferenceSequence<ICmPossibility> DialectLabelsRS
1006510065
return sense.DialectLabelsSenseOrEntry;
1006610066
}
1006710067
}
10068+
10069+
/// <summary>
10070+
/// There are some special cases where the value of a field cannot be obtained
10071+
/// by getting the value of fieldName on the SenseOrEntry.Item. This method accounts for
10072+
/// those special cases and returns the Item and fieldName that will need to be used to
10073+
/// get the value. If it is not a special case then the default is to return SenseOrEntry.Item
10074+
/// for specificItem and return fieldName for specificFieldName.
10075+
/// </summary>
10076+
/// <param name="fieldName">The general fieldName associated with this SenseOrEntry object.</param>
10077+
/// <param name="specificItem">The specific LexSense or LexEntry item that will contain a
10078+
/// value for specificFieldName.</param>
10079+
/// <param name="specificFieldName">The specific field name that will need to be used to get
10080+
/// the value from the specificItem.</param>
10081+
public void SpecificItemAndFieldName(string fieldName, out ICmObject specificObject, out string specificFieldName)
10082+
{
10083+
specificObject = Item;
10084+
specificFieldName = fieldName;
10085+
if (fieldName == "HeadWordRef" && Item is ILexSense)
10086+
{
10087+
specificFieldName = "MLOwnerOutlineName";
10088+
}
10089+
else if (fieldName == "EntryRefsOS" && Item is ILexSense sense)
10090+
{
10091+
specificObject = sense.Entry;
10092+
}
10093+
}
1006810094
}
1006910095
}

src/SIL.LCModel/InterfaceAdditions.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5992,5 +5992,19 @@ public interface ISenseOrEntry
59925992
/// Returns the dialect labels for the entry or sense
59935993
/// </summary>
59945994
ILcmReferenceSequence<ICmPossibility> DialectLabelsRS { get; }
5995+
5996+
/// <summary>
5997+
/// There are some special cases where the value of a field cannot be obtained
5998+
/// by getting the value of fieldName on the SenseOrEntry.Item. This method accounts for
5999+
/// those special cases and returns the Item and fieldName that will need to be used to
6000+
/// get the value. If it is not a special case then the default is to return SenseOrEntry.Item
6001+
/// for specificItem and return fieldName for specificFieldName.
6002+
/// </summary>
6003+
/// <param name="fieldName">The general fieldName associated with this SenseOrEntry object.</param>
6004+
/// <param name="specificItem">The specific LexSense or LexEntry item that will contain a
6005+
/// value for specificFieldName.</param>
6006+
/// <param name="specificFieldName">The specific field name that will need to be used to get
6007+
/// the value from the specificItem.</param>
6008+
void SpecificItemAndFieldName(string fieldName, out ICmObject specificItem, out string specificFieldName);
59956009
}
59966010
}

0 commit comments

Comments
 (0)