コード例 #1
0
 /// <summary>
 /// Open (compile) an ICU regular expression.
 /// </summary>
 public static IntPtr uregex_open(string pattern, int patternLength, uint flags,
                                  out ParseError parseError, out ErrorCode errorCode)
 {
     errorCode = ErrorCode.NoErrors;
     if (RegexMethods.uregex_open == null)
     {
         RegexMethods.uregex_open = GetMethod <RegexMethodsContainer.uregex_openDelegate>(IcuI18NLibHandle, "uregex_open", true);
     }
     return(RegexMethods.uregex_open(pattern, patternLength, flags, out parseError, out errorCode));
 }
コード例 #2
0
        /// <summary>
        /// Creates a exception with the given message, error and rules used.
        /// </summary>
        /// <param name="message">Message to add with exception.</param>
        /// <param name="error">ParseError containing detailed error information.</param>
        /// <param name="rules">Rules resulting in parse error.</param>
        public ParseErrorException(string message, ParseError error, string rules)
            : base(message)
        {
            if (rules == null)
            {
                throw new ArgumentNullException("rules");
            }

            _error = error;
            _rules = rules;
        }
コード例 #3
0
 /// <summary>
 /// Open a new BreakIterator that uses the given rules to break text.
 /// </summary>
 /// <param name="rules">The rules to use for break iterator</param>
 /// <param name="rulesLength">The length of the rules.</param>
 /// <param name="text">The text.</param>
 /// <param name="textLength">Length of the text.</param>
 /// <param name="parseError">Receives position and context information for any syntax errors detected while parsing the rules. </param>
 /// <param name="errorCode">The error code.</param>
 /// <returns></returns>
 public static IntPtr ubrk_openRules(
     string rules, int rulesLength,
     string text, int textLength,
     out ParseError parseError, out ErrorCode errorCode)
 {
     errorCode = ErrorCode.NoErrors;
     if (BreakIteratorMethods.ubrk_openRules == null)
     {
         BreakIteratorMethods.ubrk_openRules = GetMethod <BreakIteratorMethodsContainer.ubrk_openRulesDelegate>(IcuCommonLibHandle, "ubrk_openRules", true);
     }
     return(BreakIteratorMethods.ubrk_openRules(rules, rulesLength, text, textLength, out parseError, out errorCode));
 }
コード例 #4
0
 ///<summary>
 /// Produce an Collator instance according to the rules supplied.
 /// The rules are used to change the default ordering, defined in the
 /// UCA in a process called tailoring. The resulting Collator pointer
 /// can be used in the same way as the one obtained by ucol_strcoll.
 /// </summary>
 /// <param name="rules">A string describing the collation rules. For the syntax
 ///    of the rules please see users guide.</param>
 /// <param name="rulesLength">The length of rules, or -1 if null-terminated.</param>
 /// <param name="normalizationMode">The normalization mode</param>
 /// <param name="strength">The default collation strength; can be also set in the rules</param>
 /// <param name="parseError">A pointer to ParseError to recieve information about errors
 /// occurred during parsing. This argument can currently be set
 /// to NULL, but at users own risk. Please provide a real structure.</param>
 /// <param name="status">A pointer to an ErrorCode to receive any errors</param>
 /// <returns>A pointer to a UCollator. It is not guaranteed that NULL be returned in case
 ///         of error - please use status argument to check for errors.</returns>
 public static RuleBasedCollator.SafeRuleBasedCollatorHandle ucol_openRules(
     [MarshalAs(UnmanagedType.LPWStr)] string rules,
     int rulesLength,
     NormalizationMode normalizationMode,
     CollationStrength strength,
     ref ParseError parseError,
     out ErrorCode status)
 {
     status = ErrorCode.NoErrors;
     if (CollatorMethods.ucol_openRules == null)
     {
         CollatorMethods.ucol_openRules = GetMethod <CollatorMethodsContainer.ucol_openRulesDelegate>(IcuI18NLibHandle, "ucol_openRules");
     }
     return(CollatorMethods.ucol_openRules(rules, rulesLength, normalizationMode, strength, ref parseError,
                                           out status));
 }
コード例 #5
0
        /// <summary />
        public static Transliterator.SafeTransliteratorHandle utrans_openU(string id,
                                                                           Transliterator.UTransDirection dir, string rules, out ParseError parseError, out ErrorCode status)
        {
            status     = ErrorCode.NoErrors;
            parseError = new ParseError();

            if (TransliteratorMethods.utrans_openU == null)
            {
                TransliteratorMethods.utrans_openU = GetMethod <TransliteratorMethodsContainer.utrans_openUDelegate>(IcuI18NLibHandle, nameof(utrans_openU), true);
            }

            var idLength    = id?.Length ?? 0;
            var rulesLength = rules?.Length ?? 0;

            return(TransliteratorMethods.utrans_openU(id, idLength, dir, rules, rulesLength, out parseError, out status));
        }
コード例 #6
0
 /// <summary/>
 public static IntPtr umsg_open(string pattern, int patternLen, string locale, out ParseError parseError, out ErrorCode status)
 {
     status = ErrorCode.NoErrors;
     if (MessageFormatMethods.umsg_open == null)
     {
         MessageFormatMethods.umsg_open = GetMethod <MessageFormatMethodsContainer.umsg_openDelegate>(IcuI18NLibHandle, nameof(umsg_open), true);
     }
     return(MessageFormatMethods.umsg_open(pattern, patternLen, locale, out parseError, out status));
 }
コード例 #7
0
 /// <summary>
 /// Constructs a new MessageFormat using the given pattern and locale.
 /// </summary>
 /// <param name="pattern">Pattern used to construct object. </param>
 /// <param name="localeId">The locale to use for formatting dates and numbers. </param>
 /// <param name="parseError">Struct to receive information on the position of an error
 /// within the pattern. </param>
 /// <param name="status">Input/output error code. If the pattern cannot be parsed, set
 /// to failure code. </param>
 public MessageFormatter(string pattern, string localeId, out ParseError parseError,
                         out ErrorCode status)
 {
     _Formatter = NativeMethods.umsg_open(pattern, pattern.Length, localeId, out parseError,
                                          out status);
 }