Welcome to mirror list, hosted at ThFree Co, Russian Federation.

stringparser.h « lang_getter - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: adbbb991de9b47d51e158d1f2728a291055eaa7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once

#include <QDomDocument>


class Logging;

class ContentParser
{
  Logging & m_log;

  QDomDocument m_doc;
  QDomElement m_node;

public:
  ContentParser(Logging & log) : m_log(log) {}

  bool InitSubDOM(QString const & xml, QString const & entry, QString const & tag);
  QDomElement Root() const { return m_node; }
};

template <class ToDo>
void TokenizeString(QString const & s, QString const & delim, ToDo toDo)
{
  int beg = 0;
  int i = 0;
  for (; i < s.length(); ++i)
  {
    if (delim.indexOf(s[i]) != -1)
    {
      if (i > beg)
        toDo(s.mid(beg, i-beg));
      beg = i+1;
    }
  }

  if (i > beg)
    toDo(s.mid(beg, i-beg));
}