C# Класс SIL.CoreImpl.TsStringUtils

TsStringUtils is a collection of static methods for working with TS strings.
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
kRegexUrl System.Text.RegularExpressions.Regex

Открытые методы

Метод Описание
Compose ( string source ) : string

Returns a string an NFC (normalized form, composed) form of a Unicode string.

CreateOrcFromGuid ( System.Guid guid, FwObjDataTypes type, int ws ) : ITsString

Creates an object replacement character from a Guid

DeleteOrcFromBuilder ( ITsStrBldr tssBldr, System.Guid guidToRemove ) : int

Remove all reference ORCs for the specified builder

FindTextInString ( ITsString wordFormTss, ITsString sourceTss, ILgWritingSystemFactory wsf, bool fMatchWholeWord, int &ichMin, int &ichLim ) : bool

Determine if the specified text exists in the string

TODO: Add a parameter to make it possible to do a case-insensitive match?

FindWordFormInString ( ITsString wordFormTss, ITsString sourceTss, ILgWritingSystemFactory wsf, int &ichMin, int &ichLim ) : bool

Determine if the word form exists in the string, matching the whole word or sequence of words.

TODO: Add a parameter to make it possible to do a case-insensitive match?

GetCharPropEngineAtOffset ( ITsString tss, ILgWritingSystemFactory wsf, int ich ) : ILgCharacterPropertyEngine

Get the character property engine that should be used for interpreting the character at ich.

GetCleanSingleRunTsString ( ITsString tss ) : ITsString

Gets a TsString made from the ashes of the input parameter which has: 1) only one run 2) uses the ws of the 1st run of the input TsString.

GetCleanTextFromTsString ( ITsString tss, IEnumerable stylesToRemove, bool fStopOnRemovedStyle, ILgWritingSystemFactory writingSystemFactory ) : string

Get the text from a ITsString, removing ORCs and any text in the specified character styles. Also trims any non-wordforming characters from the beginning and the end of the text.

GetCleanTsString ( ITsString tss ) : ITsString

Gets a TsString with no: 1) ORCs corresponding to special runs, or 2) clipboard- style footnote or picture runs.

GetCleanTsString ( ITsString tss, IEnumerable stylesToRemove ) : ITsString

Gets a TsString with no: 1) leading and trailing spaces, 2) ORCs, 3) clipboard-style footnote runs, or 4) runs having the specified character styles.

GetCleanTsString ( ITsString tss, IEnumerable stylesToRemove, bool fStopOnRemovedStyle, bool fPreserveUnknownOrcs, bool fTrimSpaces ) : ITsString

Gets a TsString with no: 1) ORCs (except maybe unknown ones, if so requested), 3) clipboard-style footnote runs, or 4) runs having the specified character styles. Also, leading and trailing spaces are removed if requested.

GetDiffsInTsStrings ( ITsString tssOld, ITsString tssNew ) : TsStringDiffInfo

Get an indication of the range of characters that differ between two TsStrings. Return null if they are equal If they are not, ichMin indicates the first different character (or the length of the shorter string). cvIns indicates how many characters must be inserted at ichMin, after deleting cvDel, to get tssNew. Character properties as well as values are considered. If it is ambiguous where the difference occurs, we first try to interpret the difference in a way that equates to inserting or deleting a complete word, otherwise, prefer to find the longest common string at the start.

GetFirstVernacularWs ( string vernWsVecImage, ILgWritingSystemFactory wsf, ITsString text ) : int

Gets the first vernacular ws.

GetGuidFromProps ( ITsTextProps ttp, FwObjDataTypes desiredOrcTypes, FwObjDataTypes &odt ) : System.Guid

Get a Guid from the given text props.

GetGuidFromRun ( ITsString tss, int iRun ) : System.Guid

Get a Guid from the given run in a structured text string.

GetGuidFromRun ( ITsString tss, int iRun, FwObjDataTypes desiredOrcType ) : System.Guid

Get a Guid from the given run in a structured text string.

GetGuidFromRun ( ITsString tss, int iRun, FwObjDataTypes &odt, TsRunInfo &tri, ITsTextProps &ttp, FwObjDataTypes desiredOrcTypes ) : System.Guid

Get a Guid from the given run in a structured text string.

GetGuidFromRun ( ITsString tss, int iRun, ITsTextProps ttp ) : System.Guid

Get a Guid from the given run in a structured text string.

GetGuidFromRun ( ITsString tss, int iRun, TsRunInfo &tri, ITsTextProps &ttp ) : System.Guid

Get a Guid from the given run in a structured text string.

GetHotGuidFromObjData ( string sObjData ) : System.Guid

See if the string, typically obtained from a TsTextProps string property (int)FwTextPropType.ktptObjData, represents a hot link. If so, return the GUID of the object linked to. This overlaps some of the functionality of GetGuidFromProps and GetHotObjectGuidFromProps, for performance reasons.

GetHotObjectGuidFromProps ( ITsTextProps ttp ) : System.Guid

Get a "Hot" Guid from the given text props.

GetObjData ( System.Guid guid, byte objectDataType ) : byte[]

Get the string to pass as ObjData property

GetOwnedGuidFromRun ( ITsString tss, int iRun, FwObjDataTypes &odt ) : System.Guid

Get an owned Guid from the given run in a structured text string.

GetOwnedGuidFromRun ( ITsString tss, int iRun, FwObjDataTypes &odt, TsRunInfo &tri, ITsTextProps &ttp ) : System.Guid

Get an owned Guid from the given run in a structured text string.

GetOwnedORCs ( ITsString tss ) : ITsString

Gets the owned ORCs from the given ITsString.

GetTextProps ( System.Xml.Linq.XElement xml, ILgWritingSystemFactory wsf ) : ITsTextProps

Convert XML (produced by the above 'GetString' method) into an ITsTextProps.

GetURL ( string sProp ) : string

Gets the URL information in a form suitable for writing out in an .

GetUsefulGuidFromProps ( ITsTextProps ttp ) : System.Guid

Get a Guid from the given text props if the object type is a footnote or a picture.

GetWritingSystems ( ITsString tss ) : List

Return a list of the writing systems found in the string.

GetWsAtOffset ( ITsString tss, int ich ) : int

Get the ws at the given (ich) char offset in the tss.

GetWsOfRun ( ITsString tss, int irun ) : int

Get the writing system of the specified run of a TsString.

GetXmlRep ( ITsString tss, ILgWritingSystemFactory wsf, int ws ) : string

Get an XML representation of the given ITsString.

GetXmlRep ( ITsString tss, ILgWritingSystemFactory wsf, int ws, bool fWriteObjData ) : string

Get an XML representation of the given ITsString.

GetXmlRep ( ITsTextProps ttp, ILgWritingSystemFactory wsf ) : string

Get an XML representation of the given ITsTextProps.

InitIcuDataDir ( ) : void

Initialize the ICU Data directory based on the ICU data directory. It is safe to call this static method more than once, but necessary only to call it at least once.

InsertOrcIntoPara ( System.Guid guid, FwObjDataTypes objDataType, ITsStrBldr tsStrBldr, int ichMin, int ichLim, int ws ) : void

Insert (or replace) an ORC run in a string builder.

IsCharacterDefined ( string chr ) : bool

Determines whether or not the specified character is defined in ICU.

IsEndOfSentenceChar ( int ch, LgGeneralCharCategory cc ) : bool

Determines whether the given character is used to end a sentence.

IsHyperlink ( ITsTextProps ttp ) : bool

Checks to see if the text properties are for a hyperlink.

IsValidChar ( string chr, ILgCharacterPropertyEngine cpe ) : bool

Determines whether the specified string is a valid string consisting of exactly one initial base character followed by zero or more legally placed combining marks.

IsWhite ( ILgCharacterPropertyEngine cpe, string text, int ich ) : bool

Tells whether the full character (starting) at ich is a white-space character.

MakeTss ( ITsStrFactory tsf, int wsHvo, string text ) : ITsString

Create an ITsString in the given writing system.

MakeTss ( string src, int ws ) : ITsString

Create a new Tss based on the given string and ws.

MakeTss ( string text, int wsHvo, string styleName ) : ITsString

Create an ITsString in the given writing system and with the given style name.

MergeString ( ITsString source, ITsString dest ) : ITsString

Merges the string.

MergeString ( ITsString source, ITsString dest, bool fConcatenateIfBoth ) : ITsString

Merges the string.

NormalizeNfd ( ITsString source ) : ITsString

Normalizes the specified TsString in NFD form.

NormalizeNfd ( string source ) : string

Returns a string an NFD (normalized form, decomposed) form of a Unicode string. Enhance JohnT: This is not a very efficient implementation; we should be able to use some ICU method directly (as the ITsString implementation does). Fix if ever used for something high-performance!

NormalizeToNFC ( string s ) : string

Normalize the string for display. Uniscribe requires NFC. (See LT-4202 and LT-4203.)

ParseCharString ( string chars, string delimiter, ILgCharacterPropertyEngine cpe ) : List

Parses the specified string into a list of characters, ignoring any bogus characters (digraphs, undefined Unicode characters, lone diacritics, etc.). The unparsed list is a string of valid characters delimited with the specified delimiter.

ParseCharString ( string chars, string delimiter, ILgCharacterPropertyEngine cpe, List &invalidCharacters ) : List

Parses the specified string into a list of characters. The unparsed list is a string of valid characters delimited with the specified delimiter.

PropsForWs ( int ws ) : ITsTextProps

Answer a TsTextProps that specifies the given writing system (all other props have default values).

ReassignTss ( ITsString &tss, ITsString tssNewValue ) : void

Releases a tss string that was created with MakeString, before reassigning it. Especially useful in Dispose, since we check whether it is null before doing the release.

RemoveIllegalXmlChars ( ITsString input ) : ITsString

Remove characters that are illegal in XML files. Returns the input string if nothing is wrong with it.

RemoveIntProp ( ITsString tss, int intProp ) : ITsString

Removes the specified integer property from a Structured text string.

ReverseString ( string s ) : string

Reverse the order of characters within the string (make a mirror image of it). The tricky part, as always with UTF-16, is handling surrogate pairs correctly. TODO: Ideally this method should be in SilUtils.StringUtils. However, this method depends on the Surrogates class which is defined in BasicUtils which we didn't want to move just for this one method.

Split ( ITsString tss, string separator, StringSplitOptions opt ) : List

Split the ITsString into pieces separated by one of the strings in separator, and using the same options as String.Split().

TrimNonWordFormingChars ( ITsString untrimmedString, ILgWritingSystemFactory writingSystemFactory ) : ITsString

Trim the leading AND trailing non-word forming characters.

TrimNonWordFormingChars ( ITsString tssInput, ILgWritingSystemFactory writingSystemFactory, bool fTrimLeading, bool fTrimTrailing ) : ITsString

Trim the leading AND/OR trailing non-word forming characters.

TurnOwnedOrcIntoUnownedOrc ( ITsStrBldr bldr, int irun ) : void

Replaces the requested run of the given builder with an identical ORC but whose type is un-owned rather than owned. If the given run is not an ORC at all or is not owned, do nothing.

ValidateCharacterSequence ( string origChars, ILgCharacterPropertyEngine cpe ) : string

Finds the first base character/combining diacritic combination and removes any remaining characters.

WriteHref ( int tpt, string sProp, XmlWriter writer ) : bool

Writes an href element to the XML writer if the given string property is of the proper type.

Приватные методы

Метод Описание
GetGuidFromRun ( ITsString tss, int iRun, FwObjDataTypes desiredOrcTypes, FwObjDataTypes &odt, TsRunInfo &tri, ITsTextProps &ttp ) : System.Guid

Get a Guid from the given run in a structured text string.

IsCodePointDefined ( int codepoint ) : bool

Determines whether or not the specified codepoint is defined in ICU. If it is and its a custom PUA character, then make sure the language definition's PUA character collection is updated. Return false if the codepoint is not defined in ICU.

IsIllegalXmlCharacter ( string text, int index ) : bool

See http://www.w3.org/TR/REC-xml/#charsets Also detects unmatched surrogates

IsMark ( char chr, ILgCharacterPropertyEngine cpe ) : bool

Determines whether the specified character is a mark (either as defined by the character property engine or as overridden by the language definition.

RemoveOneIllegalXmlCharacter ( ITsString input ) : ITsString

Remove one illegal character, if one is found; otherwise, return the original string.

Описание методов

Compose() публичный статический Метод

Returns a string an NFC (normalized form, composed) form of a Unicode string.
public static Compose ( string source ) : string
source string String to compose.
Результат string

CreateOrcFromGuid() публичный статический Метод

Creates an object replacement character from a Guid
public static CreateOrcFromGuid ( System.Guid guid, FwObjDataTypes type, int ws ) : ITsString
guid System.Guid guid that maps to an ORC
type FwObjDataTypes type of ORC to return within the TsString
ws int The writing system.
Результат ITsString

DeleteOrcFromBuilder() публичный статический Метод

Remove all reference ORCs for the specified builder
public static DeleteOrcFromBuilder ( ITsStrBldr tssBldr, System.Guid guidToRemove ) : int
tssBldr ITsStrBldr the builder
guidToRemove System.Guid guid of the ORC to remove
Результат int

FindTextInString() публичный статический Метод

Determine if the specified text exists in the string
TODO: Add a parameter to make it possible to do a case-insensitive match?
public static FindTextInString ( ITsString wordFormTss, ITsString sourceTss, ILgWritingSystemFactory wsf, bool fMatchWholeWord, int &ichMin, int &ichLim ) : bool
wordFormTss ITsString text to look for
sourceTss ITsString text to search in
wsf ILgWritingSystemFactory source of char prop engines
fMatchWholeWord bool True to match a whole word, false otherwise
ichMin int The start of the string where the text was found (undefined if /// this method returns false)
ichLim int The limit (one character position past the end) of the string /// where the text was found (undefined if this method returns false)
Результат bool

FindWordFormInString() публичный статический Метод

Determine if the word form exists in the string, matching the whole word or sequence of words.
TODO: Add a parameter to make it possible to do a case-insensitive match?
public static FindWordFormInString ( ITsString wordFormTss, ITsString sourceTss, ILgWritingSystemFactory wsf, int &ichMin, int &ichLim ) : bool
wordFormTss ITsString text of word form to look for
sourceTss ITsString text to search in
wsf ILgWritingSystemFactory source of char prop engines
ichMin int The start of the string where the text was found (undefined if /// this method returns false)
ichLim int The limit (one character position past the end) of the string /// where the text was found (undefined if this method returns false)
Результат bool

GetCharPropEngineAtOffset() публичный статический Метод

Get the character property engine that should be used for interpreting the character at ich.
public static GetCharPropEngineAtOffset ( ITsString tss, ILgWritingSystemFactory wsf, int ich ) : ILgCharacterPropertyEngine
tss ITsString
wsf ILgWritingSystemFactory
ich int
Результат ILgCharacterPropertyEngine

GetCleanSingleRunTsString() публичный статический Метод

Gets a TsString made from the ashes of the input parameter which has: 1) only one run 2) uses the ws of the 1st run of the input TsString.
public static GetCleanSingleRunTsString ( ITsString tss ) : ITsString
tss ITsString structured text string
Результат ITsString

GetCleanTextFromTsString() публичный статический Метод

Get the text from a ITsString, removing ORCs and any text in the specified character styles. Also trims any non-wordforming characters from the beginning and the end of the text.
public static GetCleanTextFromTsString ( ITsString tss, IEnumerable stylesToRemove, bool fStopOnRemovedStyle, ILgWritingSystemFactory writingSystemFactory ) : string
tss ITsString structured text string
stylesToRemove IEnumerable List of styles to remove (null if no styles should be /// removed).
fStopOnRemovedStyle bool if set to true stop building the string /// when a style to remove is encountered and we have some text in the string; /// false to just skip stylesToRemove.
writingSystemFactory ILgWritingSystemFactory The writing system factory.
Результат string

GetCleanTsString() публичный статический Метод

Gets a TsString with no: 1) ORCs corresponding to special runs, or 2) clipboard- style footnote or picture runs.
public static GetCleanTsString ( ITsString tss ) : ITsString
tss ITsString structured text string
Результат ITsString

GetCleanTsString() публичный статический Метод

Gets a TsString with no: 1) leading and trailing spaces, 2) ORCs, 3) clipboard-style footnote runs, or 4) runs having the specified character styles.
public static GetCleanTsString ( ITsString tss, IEnumerable stylesToRemove ) : ITsString
tss ITsString structured text string to clean up
stylesToRemove IEnumerable List of styles to remove (null if no styles should be /// removed).
Результат ITsString

GetCleanTsString() публичный статический Метод

Gets a TsString with no: 1) ORCs (except maybe unknown ones, if so requested), 3) clipboard-style footnote runs, or 4) runs having the specified character styles. Also, leading and trailing spaces are removed if requested.
public static GetCleanTsString ( ITsString tss, IEnumerable stylesToRemove, bool fStopOnRemovedStyle, bool fPreserveUnknownOrcs, bool fTrimSpaces ) : ITsString
tss ITsString structured text string to clean up
stylesToRemove IEnumerable List of styles to remove (null if no styles should be /// removed).
fStopOnRemovedStyle bool if set to true stop building the string /// when a style to remove is encountered and we have some text in the string; /// false to just skip stylesToRemove.
fPreserveUnknownOrcs bool true to allow the returned string to /// contain ORC characters not associated with a special run.
fTrimSpaces bool if set to true leading and trailing spaces are /// trimmed.
Результат ITsString

GetDiffsInTsStrings() публичный статический Метод

Get an indication of the range of characters that differ between two TsStrings. Return null if they are equal If they are not, ichMin indicates the first different character (or the length of the shorter string). cvIns indicates how many characters must be inserted at ichMin, after deleting cvDel, to get tssNew. Character properties as well as values are considered. If it is ambiguous where the difference occurs, we first try to interpret the difference in a way that equates to inserting or deleting a complete word, otherwise, prefer to find the longest common string at the start.
public static GetDiffsInTsStrings ( ITsString tssOld, ITsString tssNew ) : TsStringDiffInfo
tssOld ITsString
tssNew ITsString
Результат TsStringDiffInfo

GetFirstVernacularWs() публичный статический Метод

Gets the first vernacular ws.
public static GetFirstVernacularWs ( string vernWsVecImage, ILgWritingSystemFactory wsf, ITsString text ) : int
vernWsVecImage string The vern ws vec image, like "seh pt mar-fonipa".
wsf ILgWritingSystemFactory The Writing System Factory.
text ITsString The text.
Результат int

GetGuidFromProps() публичный статический Метод

Get a Guid from the given text props.
public static GetGuidFromProps ( ITsTextProps ttp, FwObjDataTypes desiredOrcTypes, FwObjDataTypes &odt ) : System.Guid
ttp ITsTextProps The text props
desiredOrcTypes FwObjDataTypes Set of ORC types that we're interested in, dude; or /// null if it don't make no difference
odt FwObjDataTypes Actual object type
Результат System.Guid

GetGuidFromRun() публичный статический Метод

Get a Guid from the given run in a structured text string.
public static GetGuidFromRun ( ITsString tss, int iRun ) : System.Guid
tss ITsString given structured text string
iRun int given run
Результат System.Guid

GetGuidFromRun() публичный статический Метод

Get a Guid from the given run in a structured text string.
public static GetGuidFromRun ( ITsString tss, int iRun, FwObjDataTypes desiredOrcType ) : System.Guid
tss ITsString given structured text string
iRun int given run
desiredOrcType FwObjDataTypes The desired ORC type
Результат System.Guid

GetGuidFromRun() публичный статический Метод

Get a Guid from the given run in a structured text string.
public static GetGuidFromRun ( ITsString tss, int iRun, FwObjDataTypes &odt, TsRunInfo &tri, ITsTextProps &ttp, FwObjDataTypes desiredOrcTypes ) : System.Guid
tss ITsString given structured text string
iRun int given run
odt FwObjDataTypes object data type, 0 if no ORC guid located
tri TsRunInfo run information
ttp ITsTextProps text properties of the run
desiredOrcTypes FwObjDataTypes The desired ORC types, or null to return any type of /// ORC
Результат System.Guid

GetGuidFromRun() публичный статический Метод

Get a Guid from the given run in a structured text string.
public static GetGuidFromRun ( ITsString tss, int iRun, ITsTextProps ttp ) : System.Guid
tss ITsString given structured text string
iRun int given run
ttp ITsTextProps text properties of the run
Результат System.Guid

GetGuidFromRun() публичный статический Метод

Get a Guid from the given run in a structured text string.
public static GetGuidFromRun ( ITsString tss, int iRun, TsRunInfo &tri, ITsTextProps &ttp ) : System.Guid
tss ITsString given structured text string
iRun int given run
tri TsRunInfo run information
ttp ITsTextProps text properties of the run
Результат System.Guid

GetHotGuidFromObjData() публичный статический Метод

See if the string, typically obtained from a TsTextProps string property (int)FwTextPropType.ktptObjData, represents a hot link. If so, return the GUID of the object linked to. This overlaps some of the functionality of GetGuidFromProps and GetHotObjectGuidFromProps, for performance reasons.
public static GetHotGuidFromObjData ( string sObjData ) : System.Guid
sObjData string The s obj data.
Результат System.Guid

GetHotObjectGuidFromProps() публичный статический Метод

Get a "Hot" Guid from the given text props.
public static GetHotObjectGuidFromProps ( ITsTextProps ttp ) : System.Guid
ttp ITsTextProps The text props
Результат System.Guid

GetObjData() публичный статический Метод

Get the string to pass as ObjData property
public static GetObjData ( System.Guid guid, byte objectDataType ) : byte[]
guid System.Guid GUID of the data
objectDataType byte Type of object (e.g. kodtNameGuidHot).
Результат byte[]

GetOwnedGuidFromRun() публичный статический Метод

Get an owned Guid from the given run in a structured text string.
public static GetOwnedGuidFromRun ( ITsString tss, int iRun, FwObjDataTypes &odt ) : System.Guid
tss ITsString given structured text string
iRun int given run
odt FwObjDataTypes object data type, 0 if no owned guid located
Результат System.Guid

GetOwnedGuidFromRun() публичный статический Метод

Get an owned Guid from the given run in a structured text string.
public static GetOwnedGuidFromRun ( ITsString tss, int iRun, FwObjDataTypes &odt, TsRunInfo &tri, ITsTextProps &ttp ) : System.Guid
tss ITsString given structured text string
iRun int given run
odt FwObjDataTypes object data type, 0 if no owned guid located
tri TsRunInfo run information
ttp ITsTextProps text properties of the run
Результат System.Guid

GetOwnedORCs() публичный статический Метод

Gets the owned ORCs from the given ITsString.
public static GetOwnedORCs ( ITsString tss ) : ITsString
tss ITsString The given ITsString.
Результат ITsString

GetTextProps() публичный статический Метод

Convert XML (produced by the above 'GetString' method) into an ITsTextProps.
public static GetTextProps ( System.Xml.Linq.XElement xml, ILgWritingSystemFactory wsf ) : ITsTextProps
xml System.Xml.Linq.XElement The XML.
wsf ILgWritingSystemFactory The WSF.
Результат ITsTextProps

GetURL() публичный статический Метод

Gets the URL information in a form suitable for writing out in an .
public static GetURL ( string sProp ) : string
sProp string The string property containing the URL info.
Результат string

GetUsefulGuidFromProps() публичный статический Метод

Get a Guid from the given text props if the object type is a footnote or a picture.
public static GetUsefulGuidFromProps ( ITsTextProps ttp ) : System.Guid
ttp ITsTextProps The text props
Результат System.Guid

GetWritingSystems() публичный статический Метод

Return a list of the writing systems found in the string.
public static GetWritingSystems ( ITsString tss ) : List
tss ITsString
Результат List

GetWsAtOffset() публичный статический Метод

Get the ws at the given (ich) char offset in the tss.
public static GetWsAtOffset ( ITsString tss, int ich ) : int
tss ITsString The TSS.
ich int char offset
Результат int

GetWsOfRun() публичный статический Метод

Get the writing system of the specified run of a TsString.
public static GetWsOfRun ( ITsString tss, int irun ) : int
tss ITsString
irun int
Результат int

GetXmlRep() публичный статический Метод

Get an XML representation of the given ITsString.
public static GetXmlRep ( ITsString tss, ILgWritingSystemFactory wsf, int ws ) : string
tss ITsString The ITsString object
wsf ILgWritingSystemFactory Writing system factory so that we can convert writing system /// integer codes (which are database object ids) to the corresponding strings.
ws int If nonzero, the writing system for a multilingual string (<AStr>). /// If zero, then this is a monolingual string (<Str>).
Результат string

GetXmlRep() публичный статический Метод

Get an XML representation of the given ITsString.
public static GetXmlRep ( ITsString tss, ILgWritingSystemFactory wsf, int ws, bool fWriteObjData ) : string
tss ITsString The ITsString object
wsf ILgWritingSystemFactory Writing system factory so that we can convert writing system /// integer codes (which are database object ids) to the corresponding strings.
ws int If nonzero, the writing system for a multilingual string (<AStr>). /// If zero, then this is a monolingual string (<Str>).
fWriteObjData bool If true, then write out embedded pictures and links. If false, ignore /// any runs that contain such objects.
Результат string

GetXmlRep() публичный статический Метод

Get an XML representation of the given ITsTextProps.
public static GetXmlRep ( ITsTextProps ttp, ILgWritingSystemFactory wsf ) : string
ttp ITsTextProps The TTP.
wsf ILgWritingSystemFactory The WSF.
Результат string

InitIcuDataDir() публичный статический Метод

Initialize the ICU Data directory based on the ICU data directory. It is safe to call this static method more than once, but necessary only to call it at least once.
public static InitIcuDataDir ( ) : void
Результат void

InsertOrcIntoPara() публичный статический Метод

Insert (or replace) an ORC run in a string builder.
public static InsertOrcIntoPara ( System.Guid guid, FwObjDataTypes objDataType, ITsStrBldr tsStrBldr, int ichMin, int ichLim, int ws ) : void
guid System.Guid The GUID representing the embedded object
objDataType FwObjDataTypes The type of embedding
tsStrBldr ITsStrBldr The TS string builder
ichMin int The position at which the object is to be inserted
ichLim int If replacing an existing ORC (or other text), this is the Lim /// position (otherwise, should be set equal to ichMin)
ws int The ID of the writing system to use for the inserted run, or 0 /// to leave unspecified
Результат void

IsCharacterDefined() публичный статический Метод

Determines whether or not the specified character is defined in ICU.
public static IsCharacterDefined ( string chr ) : bool
chr string
Результат bool

IsEndOfSentenceChar() публичный статический Метод

Determines whether the given character is used to end a sentence.
public static IsEndOfSentenceChar ( int ch, LgGeneralCharCategory cc ) : bool
ch int The character.
cc LgGeneralCharCategory The general character category.
Результат bool

IsHyperlink() публичный статический Метод

Checks to see if the text properties are for a hyperlink.
public static IsHyperlink ( ITsTextProps ttp ) : bool
ttp ITsTextProps The text properties.
Результат bool

IsValidChar() публичный статический Метод

Determines whether the specified string is a valid string consisting of exactly one initial base character followed by zero or more legally placed combining marks.
public static IsValidChar ( string chr, ILgCharacterPropertyEngine cpe ) : bool
chr string The string to check.
cpe ILgCharacterPropertyEngine The character property engine.
Результат bool

IsWhite() публичный статический Метод

Tells whether the full character (starting) at ich is a white-space character.
public static IsWhite ( ILgCharacterPropertyEngine cpe, string text, int ich ) : bool
cpe ILgCharacterPropertyEngine The character property engine.
text string The text.
ich int The character index.
Результат bool

MakeTss() публичный статический Метод

Create an ITsString in the given writing system.
public static MakeTss ( ITsStrFactory tsf, int wsHvo, string text ) : ITsString
tsf ITsStrFactory
wsHvo int
text string
Результат ITsString

MakeTss() публичный статический Метод

Create a new Tss based on the given string and ws.
public static MakeTss ( string src, int ws ) : ITsString
src string
ws int
Результат ITsString

MakeTss() публичный статический Метод

Create an ITsString in the given writing system and with the given style name.
public static MakeTss ( string text, int wsHvo, string styleName ) : ITsString
text string
wsHvo int
styleName string
Результат ITsString

MergeString() публичный статический Метод

Merges the string.
public static MergeString ( ITsString source, ITsString dest ) : ITsString
source ITsString The source.
dest ITsString The dest.
Результат ITsString

MergeString() публичный статический Метод

Merges the string.
public static MergeString ( ITsString source, ITsString dest, bool fConcatenateIfBoth ) : ITsString
source ITsString The source.
dest ITsString The dest.
fConcatenateIfBoth bool If true, and if source and dest both have values that are not /// equal, concatenate source on end of dest. Otherwise ignore source if dest has a value.
Результат ITsString

NormalizeNfd() публичный статический Метод

Normalizes the specified TsString in NFD form.
public static NormalizeNfd ( ITsString source ) : ITsString
source ITsString The TsString to normalize.
Результат ITsString

NormalizeNfd() публичный статический Метод

Returns a string an NFD (normalized form, decomposed) form of a Unicode string. Enhance JohnT: This is not a very efficient implementation; we should be able to use some ICU method directly (as the ITsString implementation does). Fix if ever used for something high-performance!
public static NormalizeNfd ( string source ) : string
source string String to compose.
Результат string

NormalizeToNFC() публичный статический Метод

Normalize the string for display. Uniscribe requires NFC. (See LT-4202 and LT-4203.)
public static NormalizeToNFC ( string s ) : string
s string
Результат string

ParseCharString() публичный статический Метод

Parses the specified string into a list of characters, ignoring any bogus characters (digraphs, undefined Unicode characters, lone diacritics, etc.). The unparsed list is a string of valid characters delimited with the specified delimiter.
public static ParseCharString ( string chars, string delimiter, ILgCharacterPropertyEngine cpe ) : List
chars string The string containing a delimited list of characters.
delimiter string The delimiter (passed as a string, but really just a single /// character).
cpe ILgCharacterPropertyEngine The character property engine.
Результат List

ParseCharString() публичный статический Метод

Parses the specified string into a list of characters. The unparsed list is a string of valid characters delimited with the specified delimiter.
public static ParseCharString ( string chars, string delimiter, ILgCharacterPropertyEngine cpe, List &invalidCharacters ) : List
chars string The string containing a delimited list of characters.
delimiter string The delimiter (passed as a string, but really just a single /// character).
cpe ILgCharacterPropertyEngine The character property engine.
invalidCharacters List The invalid characters.
Результат List

PropsForWs() публичный статический Метод

Answer a TsTextProps that specifies the given writing system (all other props have default values).
public static PropsForWs ( int ws ) : ITsTextProps
ws int
Результат ITsTextProps

ReassignTss() публичный статический Метод

Releases a tss string that was created with MakeString, before reassigning it. Especially useful in Dispose, since we check whether it is null before doing the release.
public static ReassignTss ( ITsString &tss, ITsString tssNewValue ) : void
tss ITsString tss to reassign a value to
tssNewValue ITsString the new tss value (including null)
Результат void

RemoveIllegalXmlChars() публичный статический Метод

Remove characters that are illegal in XML files. Returns the input string if nothing is wrong with it.
public static RemoveIllegalXmlChars ( ITsString input ) : ITsString
input ITsString
Результат ITsString

RemoveIntProp() публичный статический Метод

Removes the specified integer property from a Structured text string.
public static RemoveIntProp ( ITsString tss, int intProp ) : ITsString
tss ITsString The structured text string.
intProp int integer property to remove from the tss.
Результат ITsString

ReverseString() публичный статический Метод

Reverse the order of characters within the string (make a mirror image of it). The tricky part, as always with UTF-16, is handling surrogate pairs correctly. TODO: Ideally this method should be in SilUtils.StringUtils. However, this method depends on the Surrogates class which is defined in BasicUtils which we didn't want to move just for this one method.
public static ReverseString ( string s ) : string
s string
Результат string

Split() публичный статический Метод

Split the ITsString into pieces separated by one of the strings in separator, and using the same options as String.Split().
public static Split ( ITsString tss, string separator, StringSplitOptions opt ) : List
tss ITsString
separator string
opt StringSplitOptions
Результат List

TrimNonWordFormingChars() публичный статический Метод

Trim the leading AND trailing non-word forming characters.
public static TrimNonWordFormingChars ( ITsString untrimmedString, ILgWritingSystemFactory writingSystemFactory ) : ITsString
untrimmedString ITsString string that may contain non-word forming characters
writingSystemFactory ILgWritingSystemFactory The ws factory used to get character properties
Результат ITsString

TrimNonWordFormingChars() публичный статический Метод

Trim the leading AND/OR trailing non-word forming characters.
public static TrimNonWordFormingChars ( ITsString tssInput, ILgWritingSystemFactory writingSystemFactory, bool fTrimLeading, bool fTrimTrailing ) : ITsString
tssInput ITsString string that may contain non-word forming characters
writingSystemFactory ILgWritingSystemFactory The ws factory used to get character properties
fTrimLeading bool if set to true trim leading characters.
fTrimTrailing bool if set to true trim trailing characters.
Результат ITsString

TurnOwnedOrcIntoUnownedOrc() публичный статический Метод

Replaces the requested run of the given builder with an identical ORC but whose type is un-owned rather than owned. If the given run is not an ORC at all or is not owned, do nothing.
public static TurnOwnedOrcIntoUnownedOrc ( ITsStrBldr bldr, int irun ) : void
bldr ITsStrBldr
irun int
Результат void

ValidateCharacterSequence() публичный статический Метод

Finds the first base character/combining diacritic combination and removes any remaining characters.
public static ValidateCharacterSequence ( string origChars, ILgCharacterPropertyEngine cpe ) : string
origChars string The original string of characters.
cpe ILgCharacterPropertyEngine The character property engine.
Результат string

WriteHref() публичный статический Метод

Writes an href element to the XML writer if the given string property is of the proper type.
public static WriteHref ( int tpt, string sProp, XmlWriter writer ) : bool
tpt int The FwTextPropType (passed as an int - grr).
sProp string The string property.
writer System.Xml.XmlWriter The writer.
Результат bool

Описание свойств

kRegexUrl публичное статическое свойство

Regular expression used to check whether a string appears to be a URL (as opposed to a file path)
public static Regex,System.Text.RegularExpressions kRegexUrl
Результат System.Text.RegularExpressions.Regex