Beispiel #1
0
KRomajiEdit::KRomajiEdit(QWidget *parent, const char *name)
	: KLineEdit(parent, name)
{
	kana = "unset";

	KStandardDirs *dirs = KGlobal::dirs();
	QString romkana = dirs->findResource("data", "kiten/romkana.cnv");
	if (romkana.isNull())
	{
		KMessageBox::error(0, i18n("Romaji information file not installed, so Romaji conversion cannot be used."));
		return;
	}

	QFile f(romkana);
	
	if (!f.open(IO_ReadOnly))
	{
		KMessageBox::error(0, i18n("Romaji information could not be loaded, so Romaji conversion cannot be used."));
	}

	QTextStream t(&f);
	t.setCodec(QTextCodec::codecForName("eucJP"));
	while (!t.eof())
	{
		QString s = t.readLine();

		QChar first = s.at(0);
		if (first == '#') // comment!
		{
			// nothing
		}
		else if (first == '$') // header
		{
			if (kana == "unset")
				kana = "hiragana";
			else
				kana = "katakana";
		}
		else // body
		{
			QStringList things(QStringList::split(QChar(' '), s));
			QString thekana(things.first());
			QString romaji(*things.at(1));

			if (kana == "hiragana")
				hiragana[romaji] = thekana;
			else if (kana == "katakana")
				katakana[romaji] = thekana;
		}
	}
	f.close();

	kana = "english";
}
Beispiel #2
0
char		*ft_epur_tabul(const char *src)
{
	int		count;
	int		a;
	char	*ret;

	a = 0;
	count = -1;
	ret = (char *)ft_memalloc(sizeof(char) *
		(ft_strlen(src) - things(src) + 1));
	while (*(src + ++count + a) != '\0')
	{
		while (*(src + count + a) == '\t')
			a++;
		*(ret + count) = *(src + count + a);
	}
	return (ret);
}
Beispiel #3
0
int main() {
  std::vector<int> things(1000000);
  for(int& i: things) {
    i = rand();
  }

  auto finder = Chaff::MaxFinder<int,int>::byCount(3);
  for(int i: things) {
    finder.sow(i, i);
  }

  std::cout << "The best three things are:\n";
  for(int i: finder.reap()) {
    std::cout << " - " << i << '\n';
  }

  std::cout << "Aren't they amazing?\n\n";
  return 0;
}
Beispiel #4
0
int main(int argc, char * argv[]) {
	people();
	things();
    return 0;
}