当前位置: 首页>>代码示例>>C++>>正文


C++ Char::SetPrevious方法代码示例

本文整理汇总了C++中Char::SetPrevious方法的典型用法代码示例。如果您正苦于以下问题:C++ Char::SetPrevious方法的具体用法?C++ Char::SetPrevious怎么用?C++ Char::SetPrevious使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Char的用法示例。


在下文中一共展示了Char::SetPrevious方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Insert

WindowResponse LineBuf::Insert(int y, int x, int ch) {
  WindowResponse response;
  if ((size_t)y > m_lines.size()) {
    throw ISError(string("Cannot insert ") + (char)ch + "; y out of bounds");
  } else if (m_lines.size() == (size_t)y) {
    g_log.info() << "LineBuf creating line for y=" << y;
    m_lines.push_back(new Line(y));
  } else if (m_lines.at(y).Size() == m_maxcols-2) {
    // Line too long; input ignored
    return response;
  }
  g_log.info() << "LineBuf inserting (" << y << "," << x << "):" << (char)ch;
  Char* prev = FindBefore(y, x);
  Char* next = FindAtOrAfter(y, x);
  Char* c = m_lines.at(y).Insert(x, ch);
  int x0 = x+1;
  int y0 = y;
  // Re-draw the window starting at the newly-entered character
  do {
    string s = m_lines.at(y).GetString(x);
    for (size_t i = 0; i < s.size(); ++i) {
      response.actions.push_back(WindowAction(WindowAction::INSERT, y, x + i, s[i]));
    }
    x = 0;
    ++y;
  } while ((size_t)y < m_lines.size());
  response.hotlist.Insert(c->inode);
  if (prev) {
    g_log.info() << " found before: " << *prev;
    prev->SetNext(c);
    c->SetPrevious(prev);
  }
  if (next) {
    g_log.info() << " found next: " << *next;
    next->SetPrevious(c);
    c->SetNext(next);
  }
  statik::IList* istart = &c->inode;
  while (istart->left) {
    istart = istart->left;
  }
  response.actions.push_back(WindowAction(WindowAction::MOVE, y0, x0));
  g_log.info() << "window0 olist: " << istart->Print();
  g_log.info() << "window0 hotlist: " << response.hotlist.Print();
  return response;
}
开发者ID:qlonik,项目名称:shok,代码行数:46,代码来源:InputWindow.cpp


注:本文中的Char::SetPrevious方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。