void SearcherTest::testSearcherFullField(void)
{
	UnicodeString strQuery;
	const UChar *uStr;

	// Populate the database
	Entry e;
	EntrySet entrySet;
	UnicodeString word = "A full field";
	// Add one word and entry
	e.Set(1, 1, 1);
	entrySet.insert(e);
	mDbNdx->AddWordEntry(word, e);

	// Search the database for a field only
	// This will use Lexer::ReadFullField as the field is in <quotes>
	strQuery = "<A full field>";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));

	// Add a new entry to a word
	e.Set(2, 2, 2);
	word = "test";
	entrySet.insert(e);
	mDbNdx->AddWordEntry(word, e);

	// Search the database for a field or a word
	strQuery = "<A full field> test";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));
}
void SearcherTest::testSearcherRange(void)
{
	UnicodeString strQuery;
	const UChar *uStr;

	// Populate the database
	Entry e;
	EntrySet entrySet;
	UnicodeString word;
	// Add one word and entry
	e.Set(1, 1, 1);
	word = "a";
	entrySet.insert(e);
	mDbNdx->AddWordEntry(word, e);
	// Add a new word and entry
	e.Set(2, 2, 2);
	word = "b";
	entrySet.insert(e);
	mDbNdx->AddWordEntry(word, e);
	// Add a new word and entry
	e.Set(3, 3, 3);
	word = "c";
	entrySet.insert(e);
	mDbNdx->AddWordEntry(word, e);

	// Search the database
	strQuery = "[a TO c]";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT_MESSAGE("[a TO c]", entrySet == *(mSearcher->GetEntrySet()));

	// Add a new word and entry
	e.Set(4, 4, 4);
	word = "d";
	mDbNdx->AddWordEntry(word, e);

	// Search the database (without "TO")
	strQuery = "[a c]";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT_MESSAGE("[a c]", entrySet == *(mSearcher->GetEntrySet()));

	// Keep only the "b" in the result set
	entrySet.clear();
	e.Set(2, 2, 2);
	entrySet.insert(e);

	// Search the database
	strQuery = "{a TO c}";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT_MESSAGE("{a TO c}", entrySet == *(mSearcher->GetEntrySet()));
}
예제 #3
0
파일: sample.cpp 프로젝트: robertop/pelet
	/** 
	 * Override this method to perform any custom logic when a variable assignment is found. Note that the same 
	 * variable may be assigned different values at different times within the same function.
	 * The symbol will be constructed in the following way:
	 *
	 * Example assignment:  $name = $this->getName()->toString();
	 *
	 * Variable: The variable's ChainList will contain the variable's name in index 0: "$name"
	 * ChainList: This is a list of  properties / methods
	 *            that were successively invoked.
	 *            In this example, the expression chain list will have 3 items in
	 *           the chain list "$this" "->getName()" and "->toString()".
	 *
	 * The variable itself may contain an array key in it; like so: $person['name'] = $this->getName()->toString();
	 * In this case, Variable ChainList will contain 1 item: "$name" and the Variable Array Key will contain "name"
	 * 
	 * 
	 * @param const UnicodeString& namespace the fully qualified namespace of the containing class / function.
	 * @param const UnicodeString& className class where the variable was found. may be empty is variable is scoped 
	 *        inside a function or is global.
	 * @param const UnicodeString& methodName function/method name where the variable was found. may be empty if 
	 *        variable is globally scoped.
	 * @param const VariableClass& variable the name of the variable that was found, along with any array keys that were used
	 *       in the left hand of the assignment. 
	 * @param const ExpressionClass& expression the expression assigned to the variable
	 * @param const UnicodeString& comment PHPDoc attached to the variable
	 * 
	 * @see pelet::VariableClass
	 */
	virtual void VariableFound(const UnicodeString& namespaceName, const UnicodeString& className, const UnicodeString& methodName, 
		const pelet::VariableClass& variable, pelet::ExpressionClass* expression, const UnicodeString& comment) {
		UFILE* ufout = u_finit(stdout, NULL, NULL);
		UnicodeString scope;
		if (className.isEmpty() && methodName.isEmpty()) {
			scope = UNICODE_STRING_SIMPLE("<global>");
		}
		else if (className.isEmpty() && !methodName.isEmpty()) {
			scope = methodName;
		}
		else {
			scope = className + UNICODE_STRING_SIMPLE("::") + methodName;
		}
		UnicodeString type;
		
		if (variable.IsPhpDocVariable && !variable.PhpDocType.isEmpty()) {
			type += UNICODE_STRING_SIMPLE("Variable is decorated with a PHPDoc comment: ");
			type += variable.PhpDocType;
		}
		else if (pelet::ExpressionClass::ARRAY == expression->ExpressionType) {
			type = UNICODE_STRING_SIMPLE("Variable is an array");
		}
		else if (pelet::ExpressionClass::SCALAR == expression->ExpressionType) {
			type = UNICODE_STRING_SIMPLE("Variable is a primitive");
		}
		else if (pelet::ExpressionClass::VARIABLE == expression->ExpressionType) {
			type = UNICODE_STRING_SIMPLE("Variable is a variable expression. ");
			type += UNICODE_STRING_SIMPLE("Chain list is: ");
			pelet::VariableClass* srcVariable = (pelet::VariableClass*) expression;
			for (size_t i = 0; i < srcVariable->ChainList.size(); ++i) {
				if (srcVariable->ChainList[i].IsStatic && i > 0) {
					type += UNICODE_STRING_SIMPLE("::");
				}
				else if (i > 0) {
					type += UNICODE_STRING_SIMPLE("->");
				}
				type += srcVariable->ChainList[i].Name;
				if (srcVariable->ChainList[i].IsFunction) {
					type += UNICODE_STRING_SIMPLE("()");
				}
				if (i < (srcVariable->ChainList.size() - 1)) {
					type += UNICODE_STRING_SIMPLE(", ");
				}
			}
			
		}
		else if (pelet::ExpressionClass::UNKNOWN == expression->ExpressionType) {
			type = UNICODE_STRING_SIMPLE("Variable is of unknown type.");
		}
		
		u_fprintf(ufout, "Variable Found: %.*S in scope %S. %S\n", 
				variable.ChainList[0].Name.length(), variable.ChainList[0].Name.getBuffer(),
				scope.getTerminatedBuffer(),
				type.getTerminatedBuffer());
	}
void SearcherTest::testSearcherAnd(void)
{
	UnicodeString strQuery;
	const UChar *uStr;

	// Populate the database
	Entry e;
	EntrySet entrySet;
	UnicodeString word = "test1";
	// Add one word and entry
	e.Set(1, 1, 1);
	entrySet.insert(e);
	mDbNdx->AddWordEntry(word, e);
	// Add a new word and entry
	e.Set(1, 1, 2);
	entrySet.insert(e);
	word = "test2";
	mDbNdx->AddWordEntry(word, e);
	// Add a new entry to this word
	e.Set(2, 2, 2);
	mDbNdx->AddWordEntry(word, e);

	// Search the database
	strQuery = "test1 AND test2";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));

	// Add a new word and entry
	e.Set(1, 1, 3);
	entrySet.insert(e);
	word = "test3";
	mDbNdx->AddWordEntry(word, e);
	// Add a new entry to this word
	e.Set(2, 2, 2);
	mDbNdx->AddWordEntry(word, e);
	// Add a new entry to this word
	e.Set(3, 3, 3);
	mDbNdx->AddWordEntry(word, e);

	// Search the database
	strQuery = "test1 AND test2 AND test3";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));
}
예제 #5
0
static void getBestPatternExample() {
	    
		u_printf("========================================================================\n");
		u_printf(" getBestPatternExample()\n");
        u_printf("\n");
        u_printf(" Use DateTimePatternGenerator to create customized date/time pattern:\n");
        u_printf(" yQQQQ,yMMMM, MMMMd, hhmm, jjmm per locale\n");
        u_printf("========================================================================\n");
		//! [getBestPatternExample]
	UnicodeString skeletons [] = {
		UnicodeString("yQQQQ"), // year + full name of quarter, i.e., 4th quarter 1999
        UnicodeString("yMMMM"), // year + full name of month, i.e., October 1999
        UnicodeString("MMMMd"), // full name of month + day of the month, i.e., October 25
        UnicodeString("hhmm"),  // 12-hour-cycle format, i.e., 1:32 PM
        UnicodeString("jjmm"), // preferred hour format for the given locale, i.e., 24-hour-cycle format for fr_FR
		0,
	};

	Locale locales[] = {
		Locale ("en_US"),
		Locale ("fr_FR"),
		Locale ("zh_CN"),
	};
	
	const char* filename = "sample.txt";
	/* open a UTF-8 file for writing */
	UFILE* f = u_fopen(filename, "w", NULL,"UTF-8");
	UnicodeString dateReturned;
	UErrorCode status =U_ZERO_ERROR;
	Calendar *cal = Calendar::createInstance(status);
	cal->set (1999,9,13,23,58,59);
	UDate date = cal->getTime(status);
	u_fprintf(f, "%-20S%-20S%-20S%-20S\n", UnicodeString("Skeleton").getTerminatedBuffer(),UnicodeString("en_US").getTerminatedBuffer(),UnicodeString("fr_FR").getTerminatedBuffer(),UnicodeString("zh_CN").getTerminatedBuffer());
	for (int i=0;skeletons[i]!=NULL;i++) {
		u_fprintf(f, "%-20S",skeletons[i].getTerminatedBuffer());
		for (int j=0;j<sizeof(locales)/sizeof(locales[0]);j++) {
			// create a DateTimePatternGenerator instance for given locale
			DateTimePatternGenerator *dtfg= DateTimePatternGenerator::createInstance(locales[j],status);
			// use getBestPattern method to get the best pattern for the given skeleton
			UnicodeString pattern = dtfg->getBestPattern(skeletons[i],status);
			// Constructs a SimpleDateFormat with the best pattern generated above and the given locale
			SimpleDateFormat *sdf = new SimpleDateFormat(pattern,locales[j],status);
			dateReturned.remove();
			// Get the format of the given date
			sdf->format(date,dateReturned,status);
			/* write Unicode string to file */
			u_fprintf(f, "%-20S", dateReturned.getTerminatedBuffer());
			delete dtfg;
			delete sdf;
		} 
		u_fprintf(f,"\n");
	}
	/* close the file resource */
	u_fclose(f);
	delete cal;
	//! [getBestPatternExample]
}
void SearcherTest::testSearcherPrefix(void)
{
	bool isLogError;
	UnicodeString strQuery;
	const UChar *uStr;

	// Populate the database
	Entry e;
	EntrySet entrySet;
	UnicodeString word = "test";
	// Add one word and entry
	e.Set(1, 1, 1);
	entrySet.insert(e);
	mDbNdx->AddWordEntry(word, e);
	// Add a new entry to this word
	e.Set(2, 2, 2);
	entrySet.insert(e);
	mDbNdx->AddWordEntry(word, e);

	// Search the database
	strQuery = cStrField;
	strQuery += ":test";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));

	// Search with a wrong prefix
	isLogError = gLog.isInLogLevel(eTypLogError);
	gLog.removeLogLevel(eTypLogError); // Remove errors
	entrySet.clear();
	strQuery = "wrong_prefix:test";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));
	strQuery = "wrong_prefix:test*";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));
	if (isLogError)
		gLog.addLogLevel(eTypLogError); // Show errors
}
static int t_ucharcharacteriterator_init(t_ucharcharacteriterator *self,
                                         PyObject *args, PyObject *kwds)
{
    UnicodeString *u;
    int len, start, end, pos;

    switch (PyTuple_Size(args)) {
      case 2:
        if (!parseArgs(args, "Wi", &u, &self->text, &len))
        {
            self->object = new UCharCharacterIterator(u->getTerminatedBuffer(), len);
            self->flags = T_OWNED;
            break;
        }
        PyErr_SetArgsError((PyObject *) self, "__init__", args);
        return -1;
      case 3:
        if (!parseArgs(args, "Wii", &u, &self->text, &len, &pos))
        {
            self->object = new UCharCharacterIterator(u->getTerminatedBuffer(), len, pos);
            self->flags = T_OWNED;
            break;
        }
        PyErr_SetArgsError((PyObject *) self, "__init__", args);
        return -1;
      case 5:
        if (!parseArgs(args, "Wiiii", &u, &self->text, &len, &start, &end, &pos))
        {
            self->object = new UCharCharacterIterator(u->getTerminatedBuffer(), len, start, end, pos);
            self->flags = T_OWNED;
            break;
        }
        PyErr_SetArgsError((PyObject *) self, "__init__", args);
        return -1;
      default:
        PyErr_SetArgsError((PyObject *) self, "__init__", args);
        return -1;
    }
        
    if (self->object)
        return 0;

    return -1;
}
예제 #8
0
static void replaceFieldTypesExample() {
		// Use repalceFieldTypes API to replace zone 'zzzz' with 'vvvv'
       u_printf("========================================================================\n");
       u_printf(" replaceFieldTypeExample()\n");
       u_printf("\n");
       u_printf(" Use replaceFieldTypes API to replace zone 'zzzz' with 'vvvv'\n");
       u_printf("========================================================================\n");
	   //! [replaceFieldTypesExample]
		UFILE *out = u_finit(stdout, NULL, "UTF-8");
		UErrorCode status =U_ZERO_ERROR;
		UnicodeString pattern,dateReturned;
		Locale locale =Locale::getFrance();
		Calendar *cal = Calendar::createInstance(status);
		cal->set (1999,9,13,23,58,59);
		UDate date = cal->getTime(status);
		TimeZone *zone = TimeZone::createTimeZone(UnicodeString("Europe/Paris"));
		DateTimePatternGenerator *dtfg = DateTimePatternGenerator::createInstance(locale,status);
	    SimpleDateFormat *sdf = new SimpleDateFormat("EEEE d MMMM y HH:mm:ss zzzz",locale,status);
		sdf->setTimeZone(*zone);
		pattern = sdf->toPattern(pattern);
		u_fprintf(out, "%S\n", UnicodeString("Pattern before replacement:").getTerminatedBuffer());
      	u_fprintf(out, "%S\n", pattern.getTerminatedBuffer());
		dateReturned.remove();
		dateReturned = sdf->format(date, dateReturned, status);
		u_fprintf(out, "%S\n", UnicodeString("Date/Time format in fr_FR:").getTerminatedBuffer());
		u_fprintf(out, "%S\n", dateReturned.getTerminatedBuffer());
        // Replace zone "zzzz" in the pattern with "vvvv"
		UnicodeString newPattern = dtfg->replaceFieldTypes(pattern, "vvvv", status);
		// Apply the new pattern
		sdf->applyPattern(newPattern);
		dateReturned.remove();
		dateReturned = sdf->format(date, dateReturned, status);
		u_fprintf(out, "%S\n", UnicodeString("Pattern after replacement:").getTerminatedBuffer());
     	u_fprintf(out, "%S\n", newPattern.getTerminatedBuffer());
     	u_fprintf(out, "%S\n", UnicodeString("Date/Time format in fr_FR:").getTerminatedBuffer());
		u_fprintf(out, "%S\n", dateReturned.getTerminatedBuffer());
		delete sdf;
		delete dtfg;
		delete zone;
		delete cal;
		u_fclose(out);

		//! [replaceFieldTypesExample]
		/* output of the sample code:
        *************************************************************************************************
         Pattern before replacement:
         EEEE d MMMM y HH:mm:ss zzzz
         Date/Time format in fr_FR:
         jeudi 14 octobre 1999 05:58:59 heure avancée d’Europe centrale
         Pattern after replacement:
         EEEE d MMMM y HH:mm:ss vvvv
         Date/Time format in fr_FR:
         jeudi 14 octobre 1999 05:58:59 heure de l’Europe centrale

        *************************************************************************************************/
    }
예제 #9
0
/*
Function:
EnumCalendarArray

Enumerates an array of strings and invokes the callback for each value.
*/
bool EnumCalendarArray(const UnicodeString* srcArray, int32_t srcArrayCount, EnumCalendarInfoCallback callback, const void* context)
{
	for (int i = 0; i < srcArrayCount; i++)
	{
		UnicodeString src = srcArray[i];
		callback(src.getTerminatedBuffer(), context);
	}

	return true;
}
예제 #10
0
void kiwix::printStringInHexadecimal(UnicodeString s) {
  std::cout << std::showbase << std::hex;
  for (int i=0; i<s.length(); i++) {
    char c = (char)((s.getTerminatedBuffer())[i]);
    if (c & 0x80)
      std::cout << (c & 0xffff) << " ";
    else
      std::cout << c << " ";
  }
  std::cout << std::endl;
}
예제 #11
0
UnicodeString StringConverter::fromUtf8(const char* buffer, int bufferSize) {
    UnicodeString tmp = UnicodeString::fromUTF8(StringPiece(buffer, bufferSize));

    // a little strange, but otherwise a unicode string might be returned that is just filled with 0x00, but still
    // has length > 0 and is != "" etc
    UnicodeString ret(tmp.getTerminatedBuffer());
    if (ret.isBogus()) {
        ret = UnicodeString("##FLUOERROR"); // set error string
        LOG_WARN << "Unable to convert from utf-8 string" << std::endl;
    }
    return ret;
}
예제 #12
0
    const char * GetDisplayName(char * strID)
#endif
    {
        UnicodeString strDisplayName;
        Transliterator::getDisplayName(strID, strDisplayName);
#ifdef _MSC_VER
		return ::SysAllocString(strDisplayName.getTerminatedBuffer());
#else
		char * name = UniStr_to_CharStar(strDisplayName);
		return name;
#endif
    }
static PyObject *t_ucharcharacteriterator_setText(t_ucharcharacteriterator *self, PyObject *args)
{
    UnicodeString *u;
    int32_t length;

    if (!parseArgs(args, "Wi", &u, &self->text, &length))
    {
        self->object->setText(u->getTerminatedBuffer(), length);  /* ref'd */
        Py_RETURN_NONE;
    }

    return PyErr_SetArgsError((PyObject *) self, "setText", args);
}
VString XLinuxIntlMgr::GetDateSeparator() const
{
	VString dateSeparator;

	icu::DateFormat* dateFmt=icu::DateFormat::createDateInstance(icu::DateFormat::SHORT, fLocale);
	xbox_assert(dateFmt!=NULL);

	icu::SimpleDateFormat* simpleDateFmt=reinterpret_cast<icu::SimpleDateFormat*>(dateFmt);
	xbox_assert(simpleDateFmt!=NULL);

	if(simpleDateFmt!=NULL)
	{
		UErrorCode err=U_ZERO_ERROR;

		UnicodeString tmpPattern;
		simpleDateFmt->toLocalizedPattern(tmpPattern, err);
		xbox_assert(err==U_ZERO_ERROR);

		VString datePattern(tmpPattern.getTerminatedBuffer());
		bool isQuoted=false;

		for(int i=0 ; i<datePattern.GetLength() ; i++)
		{
			UniChar c=datePattern[i];

			if(c=='\'')
				isQuoted=!isQuoted;

			if(isQuoted)
				continue;

			//ICU works with patterns ("M/d/yy" for ex.) and doesn't have a notion of date separator.
			//As a work around, we try to get a localized date pattern and pick the first char that looks like a separator.
			if(!(c>='A' && c<='Z') && !(c>='a' && c<='z'))
			{
				dateSeparator.AppendUniChar(c);
				break;
			}
		}
	}

	if(dateFmt!=NULL)
		delete dateFmt;

	xbox_assert(!dateSeparator.IsEmpty());

	if(dateSeparator.IsEmpty())
		return VString("/");

	return dateSeparator;
}
예제 #15
0
/* static */ void
ICUUtils::ToMozString(UnicodeString& aICUString, nsAString& aMozString)
{
  // Both ICU's UnicodeString and Mozilla's nsAString use UTF-16, so we can
  // cast here.

  static_assert(sizeof(UChar) == 2 && sizeof(nsAString::char_type) == 2,
                "Unexpected character size - the following cast is unsafe");

  const nsAString::char_type* buf =
    (const nsAString::char_type*)aICUString.getTerminatedBuffer();
  aMozString.Assign(buf);

  NS_ASSERTION(aMozString.Length() == (uint32_t)aICUString.length(),
               "Conversion failed");
}
예제 #16
0
/*
Function:
InvokeCallbackForDateTimePattern

Gets the DateTime pattern for the specified skeleton and invokes the callback with the retrieved value.
*/
bool InvokeCallbackForDateTimePattern(Locale& locale, const char* patternSkeleton, EnumCalendarInfoCallback callback, const void* context)
{
	UErrorCode err = U_ZERO_ERROR;
	LocalPointer<DateTimePatternGenerator> generator(DateTimePatternGenerator::createInstance(locale, err));
	if (U_FAILURE(err))
		return false;

	UnicodeString pattern = generator->getBestPattern(UnicodeString(patternSkeleton), err);
	if (U_SUCCESS(err))
	{
		callback(pattern.getTerminatedBuffer(), context);
		return true;
	}

	return false;
}
예제 #17
0
	const char * ConverterNameList_next(void)
#endif
    {
		if (m_iConvNameIndex >= m_iConvNameCount)
			return NULL;
		UnicodeString strID = Transliterator::getAvailableID(m_iConvNameIndex);
		++m_iConvNameIndex;
#ifdef _MSC_VER
		return ::SysAllocString(strID.getTerminatedBuffer());
#else
		char * name = UniStr_to_CharStar(strID);
#ifdef VERBOSE_DEBUGGING
        fprintf(stderr, "+");
#endif
		return name;
#endif
    }
예제 #18
0
/*
Function:
InvokeCallbackForDatePattern

Gets the ICU date pattern for the specified locale and EStyle and invokes the callback with the result.
*/
bool InvokeCallbackForDatePattern(Locale& locale, DateFormat::EStyle style, EnumCalendarInfoCallback callback, const void* context)
{
	LocalPointer<DateFormat> dateFormat(DateFormat::createDateInstance(style, locale));
	if (dateFormat.isNull())
		return false;

	// cast to SimpleDateFormat so we can call toPattern()  
	SimpleDateFormat* sdf = dynamic_cast<SimpleDateFormat*>(dateFormat.getAlias());
	if (sdf == NULL)
		return false;

	UnicodeString pattern;
	sdf->toPattern(pattern);

	callback(pattern.getTerminatedBuffer(), context);
	return true;
}
예제 #19
0
/**
 * Register an entry object (adopted) with the given ID, source,
 * target, and variant strings.
 */
void TransliteratorRegistry::registerEntry(const UnicodeString& ID,
                                           const UnicodeString& source,
                                           const UnicodeString& target,
                                           const UnicodeString& variant,
                                           TransliteratorEntry* adopted,
                                           UBool visible) {
    UErrorCode status = U_ZERO_ERROR;
    registry.put(ID, adopted, status);
    if (visible) {
        registerSTV(source, target, variant);
        if (!availableIDs.contains((void*) &ID)) {
            UnicodeString *newID = (UnicodeString *)ID.clone();
            // Check to make sure newID was created.
            if (newID != NULL) {
               // NUL-terminate the ID string
               newID->getTerminatedBuffer();
               availableIDs.addElement(newID, status);
            }
        }
    } else {
        removeSTV(source, target, variant);
        availableIDs.removeElement((void*) &ID);
    }
}
VString XLinuxIntlMgr::GetDateOrTimePattern(Pattern inPatternType) const
{
	icu::DateFormat* dateOrTimeFmt=NULL;

	switch(inPatternType)
	{
	case SHORT_DATE :
	case AM_STRING :	//For AM and PM strings, any SimpleDateFormat should do the job.
	case PM_STRING :
		dateOrTimeFmt=icu::DateFormat::createDateInstance(icu::DateFormat::SHORT, fLocale);
		break;

	case MEDIUM_DATE :
		dateOrTimeFmt=icu::DateFormat::createDateInstance(icu::DateFormat::MEDIUM, fLocale);
		break;

	case LONG_DATE :
		dateOrTimeFmt=icu::DateFormat::createDateInstance(icu::DateFormat::LONG, fLocale);
		break;

	case SHORT_TIME :
		dateOrTimeFmt=icu::DateFormat::createTimeInstance(icu::DateFormat::SHORT, fLocale);
		break;

	case MEDIUM_TIME :
		dateOrTimeFmt=icu::DateFormat::createTimeInstance(icu::DateFormat::MEDIUM, fLocale);
		break;

	case LONG_TIME :
		dateOrTimeFmt=icu::DateFormat::createTimeInstance(icu::DateFormat::LONG, fLocale);
		break;

	default :
		xbox_assert(0);
	}

	xbox_assert(dateOrTimeFmt!=NULL);


	VString pattern;

	if(dateOrTimeFmt!=NULL)
	{
		icu::SimpleDateFormat* simpleDateOrTimeFmt=reinterpret_cast<icu::SimpleDateFormat*>(dateOrTimeFmt);
		xbox_assert(simpleDateOrTimeFmt!=NULL);

		if(simpleDateOrTimeFmt!=NULL)
		{
			if(inPatternType==AM_STRING || inPatternType==PM_STRING)
			{
				//symbols is owned by simpleDateOrTimeFmt - Do not delete it manually !
				const icu::DateFormatSymbols* symbols=simpleDateOrTimeFmt->getDateFormatSymbols();
				xbox_assert(symbols!=NULL);

				if(symbols!=NULL)
				{
					sLONG count=0;
					const UnicodeString* amPmStringArray=symbols->getAmPmStrings(count);

					xbox_assert(count==2);

					if(count==2)
					{
						const UniChar* uniPtr=NULL;
						VSize uniPtrLen=0;

						if(inPatternType==AM_STRING)
							uniPtr=amPmStringArray[0].getBuffer(), uniPtrLen=amPmStringArray[0].length();
						else
							uniPtr=amPmStringArray[1].getBuffer(), uniPtrLen=amPmStringArray[1].length();

						pattern.FromBlock(uniPtr, uniPtrLen*sizeof(UniChar), VTC_UTF_16);
					}
				}
			}
			else
			{
				UErrorCode err=U_ZERO_ERROR;

				UnicodeString tmpPattern;
				simpleDateOrTimeFmt->toLocalizedPattern(tmpPattern, err);
				xbox_assert(err==U_ZERO_ERROR);

				pattern=tmpPattern.getTerminatedBuffer();
				xbox_assert(!pattern.IsEmpty());
			}
		}
	}

	if(dateOrTimeFmt!=NULL)
		delete dateOrTimeFmt;

	return pattern;
}
예제 #21
0
/* @bug 7902
 * Tests for Greek Language.
 * This tests that requests for short unit names correctly fall back 
 * to long unit names for a locale where the locale data does not 
 * provide short unit names. As of CLDR 1.9, Greek is one such language.
 */
void TimeUnitTest::testGreekWithFallback() {
    UErrorCode status = U_ZERO_ERROR;

    const char* locales[] = {"el-GR", "el"};
    TimeUnit::UTimeUnitFields tunits[] = {TimeUnit::UTIMEUNIT_SECOND, TimeUnit::UTIMEUNIT_MINUTE, TimeUnit::UTIMEUNIT_HOUR, TimeUnit::UTIMEUNIT_DAY, TimeUnit::UTIMEUNIT_MONTH, TimeUnit::UTIMEUNIT_YEAR};
    UTimeUnitFormatStyle styles[] = {UTMUTFMT_FULL_STYLE, UTMUTFMT_ABBREVIATED_STYLE};
    const int numbers[] = {1, 7};

    const UChar oneSecond[] = {0x0031, 0x0020, 0x03b4, 0x03b5, 0x03c5, 0x03c4, 0x03b5, 0x03c1, 0x03cc, 0x03bb, 0x03b5, 0x03c0, 0x03c4, 0x03bf, 0};
    const UChar oneSecondShort[] = {0x0031, 0x0020, 0x03b4, 0x03b5, 0x03c5, 0x03c4, 0x002e, 0};
    const UChar oneMinute[] = {0x0031, 0x0020, 0x03bb, 0x03b5, 0x03c0, 0x03c4, 0x03cc, 0};
    const UChar oneMinuteShort[] = {0x0031, 0x0020, 0x03bb, 0x03b5, 0x03c0, 0x002e, 0};
    const UChar oneHour[] = {0x0031, 0x0020, 0x03ce, 0x03c1, 0x03b1, 0};
    const UChar oneDay[] = {0x0031, 0x0020, 0x03b7, 0x03bc, 0x03ad, 0x03c1, 0x03b1, 0};
    const UChar oneMonth[] = {0x0031, 0x0020, 0x03bc, 0x03ae, 0x03bd, 0x03b1, 0x03c2, 0};
    const UChar oneMonthShort[] = {0x0031, 0x0020, 0x03bc, 0x03ae, 0x03bd, 0x002e, 0};
    const UChar oneYear[] = {0x0031, 0x0020, 0x03ad, 0x03c4, 0x03bf, 0x03c2, 0};
    const UChar sevenSeconds[] = {0x0037, 0x0020, 0x03b4, 0x03b5, 0x03c5, 0x03c4, 0x03b5, 0x03c1, 0x03cc, 0x03bb, 0x03b5, 0x03c0, 0x03c4, 0x03b1, 0};
    const UChar sevenSecondsShort[] = {0x0037, 0x0020, 0x03b4, 0x03b5, 0x03c5, 0x03c4, 0x002e, 0};
    const UChar sevenMinutes[] = {0x0037, 0x0020, 0x03bb, 0x03b5, 0x03c0, 0x03c4, 0x03ac, 0};
    const UChar sevenMinutesShort[] = {0x0037, 0x0020, 0x03bb, 0x03b5, 0x03c0, 0x002e, 0};
    const UChar sevenHours[] = {0x0037, 0x0020, 0x03ce, 0x03c1, 0x03b5, 0x03c2, 0};
    const UChar sevenDays[] = {0x0037, 0x0020, 0x03b7, 0x03bc, 0x03ad, 0x03c1, 0x03b5, 0x03c2, 0};
    const UChar sevenMonths[] = {0x0037, 0x0020, 0x03bc, 0x03ae, 0x03bd, 0x03b5, 0x3c2, 0};
    const UChar sevenMonthsShort[] = {0x0037, 0x0020, 0x03bc, 0x03ae, 0x03bd, 0x002e, 0};
    const UChar sevenYears[] = {0x0037, 0x0020, 0x03ad, 0x03c4, 0x03b7, 0};

    const UnicodeString oneSecondStr(oneSecond);
    const UnicodeString oneSecondShortStr(oneSecondShort);
    const UnicodeString oneMinuteStr(oneMinute);
    const UnicodeString oneMinuteShortStr(oneMinuteShort);
    const UnicodeString oneHourStr(oneHour);
    const UnicodeString oneDayStr(oneDay);
    const UnicodeString oneMonthStr(oneMonth);
    const UnicodeString oneMonthShortStr(oneMonthShort);
    const UnicodeString oneYearStr(oneYear);
    const UnicodeString sevenSecondsStr(sevenSeconds);
    const UnicodeString sevenSecondsShortStr(sevenSecondsShort);
    const UnicodeString sevenMinutesStr(sevenMinutes);
    const UnicodeString sevenMinutesShortStr(sevenMinutesShort);
    const UnicodeString sevenHoursStr(sevenHours);
    const UnicodeString sevenDaysStr(sevenDays);
    const UnicodeString sevenMonthsStr(sevenMonths);
    const UnicodeString sevenMonthsShortStr(sevenMonthsShort);
    const UnicodeString sevenYearsStr(sevenYears);

    const UnicodeString expected[] = {oneSecondStr, oneMinuteStr, oneHourStr, oneDayStr, oneMonthStr, oneYearStr,
                              oneSecondShortStr, oneMinuteShortStr, oneHourStr, oneDayStr, oneMonthShortStr, oneYearStr,
                              sevenSecondsStr, sevenMinutesStr, sevenHoursStr, sevenDaysStr, sevenMonthsStr, sevenYearsStr,
                              sevenSecondsShortStr, sevenMinutesShortStr, sevenHoursStr, sevenDaysStr, sevenMonthsShortStr, sevenYearsStr,
                              oneSecondStr, oneMinuteStr, oneHourStr, oneDayStr, oneMonthStr, oneYearStr,
                              oneSecondShortStr, oneMinuteShortStr, oneHourStr, oneDayStr, oneMonthShortStr, oneYearStr,
                              sevenSecondsStr, sevenMinutesStr, sevenHoursStr, sevenDaysStr, sevenMonthsStr, sevenYearsStr,
                              sevenSecondsShortStr, sevenMinutesShortStr, sevenHoursStr, sevenDaysStr, sevenMonthsShortStr, sevenYearsStr};

    int counter = 0;
    for ( unsigned int locIndex = 0;
        locIndex < sizeof(locales)/sizeof(locales[0]);
        ++locIndex ) {

        Locale l = Locale::createFromName(locales[locIndex]);

        for ( unsigned int numberIndex = 0;
            numberIndex < sizeof(numbers)/sizeof(int);
            ++numberIndex ) {

            for ( unsigned int styleIndex = 0;
                styleIndex < sizeof(styles)/sizeof(styles[0]);
                ++styleIndex ) {

                for ( unsigned int unitIndex = 0;
                    unitIndex < sizeof(tunits)/sizeof(tunits[0]);
                    ++unitIndex ) {

                    TimeUnitAmount *tamt = new TimeUnitAmount(numbers[numberIndex], tunits[unitIndex], status);
                    if (U_FAILURE(status)) {
                        dataerrln("generating TimeUnitAmount Object failed.");
#ifdef TUFMTTS_DEBUG
                        std::cout << "Failed to get TimeUnitAmount for " << tunits[unitIndex] << "\n";
#endif
                        return;
                    }

                    TimeUnitFormat *tfmt = new TimeUnitFormat(l, styles[styleIndex], status);
                    if (U_FAILURE(status)) {
                        dataerrln("generating TimeUnitAmount Object failed.");
#ifdef TUFMTTS_DEBUG
                       std::cout <<  "Failed to get TimeUnitFormat for " << locales[locIndex] << "\n";
#endif
                       return;
                    }

                    Formattable fmt;
                    UnicodeString str;

                    fmt.adoptObject(tamt);
                    str = ((Format *)tfmt)->format(fmt, str, status);
                    if (!assertSuccess("formatting relative time failed", status)) {
                        delete tfmt;
#ifdef TUFMTTS_DEBUG
                        std::cout <<  "Failed to format" << "\n";
#endif
                        return;
                    }

#ifdef TUFMTTS_DEBUG
                    char tmp[128];    //output
                    char tmp1[128];    //expected
                    int len = 0;
                    u_strToUTF8(tmp, 128, &len, str.getTerminatedBuffer(), str.length(), &status);
                    u_strToUTF8(tmp1, 128, &len, expected[counter].unescape().getTerminatedBuffer(), expected[counter].unescape().length(), &status);
                    std::cout <<  "Formatted string : " << tmp << " expected : " << tmp1 << "\n";
#endif
                    if (!assertEquals("formatted time string is not expected, locale: " + UnicodeString(locales[locIndex]) + " style: " + (int)styles[styleIndex] + " units: " + (int)tunits[unitIndex], expected[counter], str)) {
                        delete tfmt;
                        str.remove();
                        return;
                    }
                    delete tfmt;
                    str.remove();
                    ++counter;
                }
            }
        }
    }
}
예제 #22
0
파일: case.cpp 프로젝트: cyrusimap/icu4c
void printUnicodeString(UFILE *out, const UnicodeString &s) {
    UnicodeString other = s;
    u_fprintf(out, "\"%S\"", other.getTerminatedBuffer());
}
void SearcherTest::testSearcherPhraseSlop(void)
{
	UnicodeString strQuery;
	const UChar *uStr;

	// Populate the database
	Entry e;
	EntrySet entrySet;
	UnicodeString word = "test1";
	// Add one word and entry
	e.Set(1, 1, 1);
	entrySet.insert(e);
	// Add one word and entry
	mDbNdx->AddWordEntry(word, e);
	// Add a new word and entry
	e.Set(1, 1, 2);
	word = "test2";
	entrySet.insert(e);
	mDbNdx->AddWordEntry(word, e);
	// Add a new entry to this word
	e.Set(2, 2, 2);
	mDbNdx->AddWordEntry(word, e);

	// Search the database
	strQuery = "\"test1 test2\"~2";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));

	// Add a new word and entry
	e.Set(1, 1, 3);
	word = "test3";
	entrySet.insert(e);
	mDbNdx->AddWordEntry(word, e);
	// Add a new entry to this word
	e.Set(1, 1, 5);
	mDbNdx->AddWordEntry(word, e);
	// Add a new entry to this word
	e.Set(3, 3, 3);
	mDbNdx->AddWordEntry(word, e);

	// Search the database
	strQuery = "\"test1 test2 test3\"~3";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));

	// Search the database
	e.Set(1, 1, 5);
	entrySet.insert(e);
	strQuery = "\"test1 test2 test3\"~10";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));

	// Add a new word and entry
	e.Set(1, 1, 4);
	word = "test4";
	entrySet.insert(e);
	mDbNdx->AddWordEntry(word, e);

	// Search the database
	strQuery = "\"test4 test3 test2 test1\"~4";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));

	// Add a new word and entry
	e.Set(1, 1, 50);
	word = "test4";
	mDbNdx->AddWordEntry(word, e);

	// Search the database
	strQuery = "\"test1 test2 test3 test4\"~40";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));

	// Search the database
	/*entrySet.clear();
	strQuery = "\"test1 test2 test3 test4\"~3";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));*/
}
void AdornerTest::testAdornContent(void)
{
	//const UChar *sDebug;
	bool wantOutputFile = true;
	unsigned long nbError;
	std::string elem;
	std::string attrName;
	UnicodeString attrValue;
	StringToUnicodeStringMap attrMap;
	UnicodeString text;
	unsigned int numDoc = 1;
	std::string testFileName = mPath + "test_adorner.xml";
	std::string outFileName = mPath + "test_adorner_temp.xml";

	std::unique_ptr<Adorner> adorner(new Adorner());
	adorner->EnableAdornerString(true);
	adorner->SetAdornerDocRef(numDoc);
	if (wantOutputFile)
		adorner->SetAdornerDstFileName(outFileName);
	adorner->StartDocument();

	UnicodeString &adornerString = adorner->GetAdornerString();
	adornerString.remove(); // Remove the xml file header

	// Opens a node
	elem = "adorner_test";
	attrName = "id";
	attrValue = "123";
	attrMap[attrName] = attrValue;
	adorner->StartNode(elem, attrMap);
	attrMap.clear();
	// Appends text
	text = "Full text content";
	adorner->AddCharacters(text.getTerminatedBuffer(), text.length());
	// Close the node
	adorner->EndNode();
	// Check the adorner content
	adorner->ForceDecorate();
	//sDebug = adornerString.getTerminatedBuffer(); // Debug string
	CPPUNIT_ASSERT(adornerString == "<adorner_test id=\"123\"><w pos=\"1\">Full</w> <w pos=\"2\">text</w> <w pos=\"3\">content</w></adorner_test>");
	adornerString.remove();

	// Test
	//   Le 5<e>eme</e> élément
	text = "\nLe 5";
	adorner->AddCharacters(text.getTerminatedBuffer(), text.length());
	elem = "e";
	adorner->StartNode(elem, attrMap);
	text = "eme";
	adorner->AddCharacters(text.getTerminatedBuffer(), text.length());
	adorner->EndNode();
	text = " element";
	adorner->AddCharacters(text.getTerminatedBuffer(), text.length());
	// Check the adorner content
	adorner->ForceDecorate();
	//sDebug = adornerString.getTerminatedBuffer(); // Debug string
	CPPUNIT_ASSERT(adornerString == "\n<w pos=\"4\">Le</w> <w pos=\"5\">5</w><e><w pos=\"5\">eme</w></e> <w pos=\"6\">element</w>");
	adornerString.remove();

	// Close the document
	adorner->EndDocument(false);
	adornerString.remove();
	nbError = adorner->GetNbError();

	CPPUNIT_ASSERT(nbError == 0);

	if (wantOutputFile) {
		// Text compare source and destination files
		bool isOk = FileSystem::TextCompareFiles(testFileName, outFileName);
		CPPUNIT_ASSERT_MESSAGE(outFileName, isOk);
		// Delete temporary file
		::remove(outFileName.c_str());
	}
}
void SearcherTest::testSearcherFuzzy(void)
{
	UnicodeString strQuery;
	const UChar *uStr;

	// Populate the database
	Entry e;
	EntrySet entrySet;
	UnicodeString word = "test1";
	// Add one word and entry
	e.Set(1, 1, 0);
	entrySet.insert(e);
	mDbNdx->AddWordEntry(word, e);

	// Search the database
	strQuery = "test~";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));

	entrySet.clear();
	// Add a new word and entry
	e.Set(1, 1, 1);
	entrySet.insert(e);
	word = "bate";
	mDbNdx->AddWordEntry(word, e);
	// Add a new word and entry
	e.Set(1, 1, 2);
	entrySet.insert(e);
	word = "fate";
	mDbNdx->AddWordEntry(word, e);
	// Add a new word and entry
	e.Set(1, 1, 3);
	entrySet.insert(e);
	word = "tate";
	mDbNdx->AddWordEntry(word, e);
	// Add a new word and entry
	e.Set(1, 1, 4);
	entrySet.insert(e);
	word = "tatu";
	mDbNdx->AddWordEntry(word, e);

	// Search the database
	strQuery = "tate~";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));

	// Add a new word and entry
	e.Set(1, 1, 5);
	word = "baty";
	mDbNdx->AddWordEntry(word, e);

	// Search the database
	strQuery = "tate~";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));
}
void SearcherTest::testSearcherWildcard(void)
{
	UnicodeString strQuery;
	const UChar *uStr;

	// Populate the database
	Entry e;
	EntrySet entrySet;
	UnicodeString word;
	// Add one word and entry
	word = "test";
	e.Set(1, 1, 1);
	entrySet.insert(e);
	mDbNdx->AddWordEntry(word, e);
	// Add one word and entry
	word = "testa";
	e.Set(1, 1, 2);
	entrySet.insert(e);
	mDbNdx->AddWordEntry(word, e);
	// Add one word and entry
	word = "testb";
	e.Set(1, 1, 3);
	entrySet.insert(e);
	mDbNdx->AddWordEntry(word, e);

	// Search the database
	strQuery = "test*";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));

	// Add a new word and entry
	e.Set(1, 1, 2);
	word = "tes";
	mDbNdx->AddWordEntry(word, e);
	// Add a new entry to this word
	e.Set(2, 2, 2);
	mDbNdx->AddWordEntry(word, e);

	// Search the database
	strQuery = "test*";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));

	// Add a new word and entry
	e.Set(1, 1, 3);
	entrySet.insert(e);
	word = "test3";
	mDbNdx->AddWordEntry(word, e);
	// Add a new entry to this word
	e.Set(2, 2, 2);
	entrySet.insert(e);
	mDbNdx->AddWordEntry(word, e);
	// Add a new entry to this word
	e.Set(3, 3, 3);
	entrySet.insert(e);
	mDbNdx->AddWordEntry(word, e);

	// Search the database
	strQuery = "test*";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT(entrySet == *(mSearcher->GetEntrySet()));

	// Test with accents
	entrySet.clear();
	// Add a new word and entry
	e.Set(1, 1, 1);
	entrySet.insert(e);
	word = "bateaux";
	mDbNdx->AddWordEntry(word, e);
	// Add a new word and entry
	e.Set(1, 1, 2);
	entrySet.insert(e);
	UChar s1[] = { 'b', 0x00E2, 't', 'i', 0 }; // "bâti"
	word = s1;
	mDbNdx->AddWordEntry(word, e);
	// Add a new word and entry
	e.Set(1, 1, 3);
	entrySet.insert(e);
	word = "bats";
	mDbNdx->AddWordEntry(word, e);

	// Search the database
	strQuery = "bat*";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT_MESSAGE("Wildcard query with accents", entrySet == *(mSearcher->GetEntrySet()));

	// Test with wildcard in the middle
	entrySet.clear();
	// Add a new word and entry
	e.Set(1, 1, 1);
	entrySet.insert(e);
	UChar s2[] = { 'b', 0x00E9, 'n', 'e', 'd', 'i', 'c', 't', 'i', 'o', 'n', 0 }; // "bénediction"
	word = s2;
	mDbNdx->AddWordEntry(word, e);
	// Add a new word and entry
	e.Set(1, 1, 2);
	UChar s3[] = { 'b', 0x00E9, 'n', 0x00E9, 'f', 'i', 'c', 'e', 0 }; // "bénéfice"
	word = s3;
	mDbNdx->AddWordEntry(word, e);
	// Add a new word and entry
	e.Set(1, 1, 3);
	entrySet.insert(e);
	word = "benjamin";
	mDbNdx->AddWordEntry(word, e);

	// Search the database
	strQuery = "ben*n";
	uStr = strQuery.getTerminatedBuffer();
	mSearcher->SetQuery(cStrField, uStr);
	mSearcher->Compute();
	CPPUNIT_ASSERT_MESSAGE("Wildcard query with accents", entrySet == *(mSearcher->GetEntrySet()));
}