예제 #1
0
ResizableString::size_type ResizableString::vformat(const char *format, va_list args)
{
	size_type formatsize = MutableString(*this).vformat(format, args);

	if(formatsize > capacity())
	{
		resize(formatsize, 0, formatsize);
		MutableString(*this).vformat(format, args);
	}

	return formatsize;
}
예제 #2
0
const ResizableString &ResizableString::operator =(const PieceString &other)
{
	resize(other.length(), 0, other.length());

	MutableString(*this) = other;

	return *this;
}
extern "C" ASPELL_EXPORT  int aspell_speller_add_to_session(Speller * ths, const char * word, int word_size)
{
  ths->temp_str_0.clear();
  ths->to_internal_->convert(word, word_size, ths->temp_str_0);
  unsigned int s0 = ths->temp_str_0.size();
  PosibErr<void> ret = ths->add_to_session(MutableString(ths->temp_str_0.mstr(), s0));
  ths->err_.reset(ret.release_err());
  if (ths->err_ != 0) return 0;
  return 1;
}
extern "C" ASPELL_EXPORT  int aspell_speller_check(Speller * ths, const char * word, int word_size)
{
  ths->temp_str_0.clear();
  ths->to_internal_->convert(word, word_size, ths->temp_str_0);
  unsigned int s0 = ths->temp_str_0.size();
  PosibErr<bool> ret = ths->check(MutableString(ths->temp_str_0.mstr(), s0));
  ths->err_.reset(ret.release_err());
  if (ths->err_ != 0) return -1;
  return ret.data;
}
예제 #5
0
const ResizableString &ResizableString::operator +=(const PieceString &other)
{
	size_type len = length();
	size_type olen = other.length();
	resize(len + olen, len, len*2 + olen);

	MutableString(*this) += other;

	return *this;
}
예제 #6
0
void ResizableString::replace(size_type offset, size_type sz, PieceString value)
{
	if(offset + sz > length()) return;

	size_type required_size = length() - sz + value.length();
	
	resize(required_size, length(), required_size*2);

	MutableString(*this).replace(offset, sz, value);
}
extern "C" ASPELL_EXPORT  const WordList * aspell_speller_suggest(Speller * ths, const char * word, int word_size)
{
  ths->temp_str_0.clear();
  ths->to_internal_->convert(word, word_size, ths->temp_str_0);
  unsigned int s0 = ths->temp_str_0.size();
  PosibErr<const WordList *> ret = ths->suggest(MutableString(ths->temp_str_0.mstr(), s0));
  ths->err_.reset(ret.release_err());
  if (ths->err_ != 0) return 0;
  if (ret.data)
    const_cast<WordList *>(ret.data)->from_internal_ = ths->from_internal_;
  return ret.data;
}
extern "C" ASPELL_EXPORT  int aspell_speller_store_replacement(Speller * ths, const char * mis, int mis_size, const char * cor, int cor_size)
{
  ths->temp_str_0.clear();
  ths->to_internal_->convert(mis, mis_size, ths->temp_str_0);
  unsigned int s0 = ths->temp_str_0.size();
  ths->temp_str_1.clear();
  ths->to_internal_->convert(cor, cor_size, ths->temp_str_1);
  unsigned int s1 = ths->temp_str_1.size();
  PosibErr<bool> ret = ths->store_replacement(MutableString(ths->temp_str_0.mstr(), s0), MutableString(ths->temp_str_1.mstr(), s1));
  ths->err_.reset(ret.release_err());
  if (ths->err_ != 0) return -1;
  return ret.data;
}
예제 #9
0
ResizableString::operator MutableString() 
{ 
	resize(1, capacity(), 64);
	return MutableString(mpBuffer, capacity()+1, mLength); 
}
예제 #10
0
 PosibErr<bool> check(ParmString word)
 {
   std::vector<char> w(word.size()+1);
   strncpy(&*w.begin(), word, w.size());
   return check(MutableString(&w.front(), w.size() - 1));
 }