コード例 #1
0
ファイル: StringFunctions.cpp プロジェクト: realn/CodeBox
 strvector::const_iterator subfind(string const & text, strvector const & list, size_t const pos) {
   for(auto it = list.begin(); it != list.end(); it++) {
     if(subcmp(text, *it, pos)) {
       return it;
     }
   }
   return list.end();
 }
コード例 #2
0
ファイル: StringFunctions.cpp プロジェクト: realn/CodeBox
 string join(strvector const& list, string const& glue) {
   auto result = string();
   auto it = list.begin();
   while(it != list.end()) {
     result += *it;
     it++;
     if(it != list.end()) {
       result += glue;
     }
   }
   return result;
 }
コード例 #3
0
ファイル: layout.cpp プロジェクト: angeldv95/pokerspot
void interpret(strvector& data, CTableView* pView)
{
  bool ok = true;

  for (strvector::const_iterator i = data.begin(),
                                 end = data.end();
       i != end && ok;
       ++i)
  {
    string s = *i;
    token_handler handler = find_handler(s);
    if (handler)
      ok = (*handler)(i, end, pView);
  }
}
コード例 #4
0
ファイル: StringFunctions.cpp プロジェクト: realn/CodeBox
  size_t strfind_of(string const & text, strvector const& list, size_t const offset, strvector::const_iterator outIt) {
    size_t result = string::npos;
    outIt = list.end();
    for(auto it = list.begin(); it < list.end(); it++) {
      if(it->empty())
        continue;

      auto pos = text.find(*it, offset);
      if(pos == string::npos)
        continue;

      if(result == string::npos || pos < result) {
        result = pos;
        outIt = it;
      }
    }
    return result;
  }
コード例 #5
0
ファイル: layout.cpp プロジェクト: angeldv95/pokerspot
//
// If there are spaces in a coordinate entry in the
// layout file, then those coordinates will be two
// entries in the 'data' vector because a space is
// a string separator.
//
// This function collapses such entries into one to
// allow entries like: '13, 5' in the layout file.
//
void collapse(strvector& data)
{
  strvector tmp;
  for (strvector::const_iterator i = data.begin(),
                                 e = data.end();
       i != e;
       ++i)
  {
    string s = *i;
    int pos = s.find_first_of(',');

    if (pos == string::npos || pos == (s.size() - 1) &&
        i != e)
    {
      ++i;
      string s2 = *i;
      s += s2;
    }

    tmp.push_back(s);
  }

  data = tmp;
}