Switch to unified view

a/src/rcldb/searchdataxml.cpp b/src/rcldb/searchdataxml.cpp
...
...
13
 *   along with this program; if not, write to the
13
 *   along with this program; if not, write to the
14
 *   Free Software Foundation, Inc.,
14
 *   Free Software Foundation, Inc.,
15
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
15
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
16
 */
16
 */
17
17
18
// Handle translation from rcl's SearchData structures to Xapian Queries
18
// Handle translation from rcl's SearchData structures to XML. Used for
19
// complex search history storage in the GUI
19
20
20
#include "autoconfig.h"
21
#include "autoconfig.h"
21
22
22
#include <stdio.h>
23
#include <stdio.h>
23
24
...
...
62
    SearchDataClause *c = m_query[i];
63
    SearchDataClause *c = m_query[i];
63
    if (c->getTp() == SCLT_SUB) {
64
    if (c->getTp() == SCLT_SUB) {
64
        LOGERR(("SearchData::asXML: can't do subclauses !\n"));
65
        LOGERR(("SearchData::asXML: can't do subclauses !\n"));
65
        continue;
66
        continue;
66
    }
67
    }
68
  //if (c->getexclude())
69
  //    os << "<NEG/>" << endl;
70
  if (c->getTp() == SCLT_PATH) {
71
      // Keep these apart, for compat with the older history format
72
      SearchDataClausePath *cl = 
73
      dynamic_cast<SearchDataClausePath*>(c);
74
      if (cl->getexclude()) {
75
      os << "<ND>" << base64_encode(cl->gettext()) << "</ND>" << endl;
76
      } else {
77
      os << "<YD>" << base64_encode(cl->gettext()) << "</YD>" << endl;
78
      }
79
      continue;
80
  }
81
67
    SearchDataClauseSimple *cl = 
82
    SearchDataClauseSimple *cl = 
68
        dynamic_cast<SearchDataClauseSimple*>(c);
83
        dynamic_cast<SearchDataClauseSimple*>(c);
69
    os << "<C>" << endl;
84
    os << "<C>" << endl;
70
    if (cl->getTp() != SCLT_AND) {
85
    if (cl->getTp() != SCLT_AND) {
71
        os << "<CT>" << tpToString(cl->getTp()) << "</CT>" << endl;
86
        os << "<CT>" << tpToString(cl->getTp()) << "</CT>" << endl;
...
...
98
        "<Y>" << m_dates.y2 << "</Y>" 
113
        "<Y>" << m_dates.y2 << "</Y>" 
99
           << "</DMA>" << endl;
114
           << "</DMA>" << endl;
100
    }
115
    }
101
    }
116
    }
102
117
103
104
    if (m_minSize != size_t(-1)) {
118
    if (m_minSize != size_t(-1)) {
105
    os << "<MIS>" << m_minSize << "</MIS>" << endl;
119
    os << "<MIS>" << m_minSize << "</MIS>" << endl;
106
    }
120
    }
107
    if (m_maxSize != size_t(-1)) {
121
    if (m_maxSize != size_t(-1)) {
108
    os << "<MAS>" << m_maxSize << "</MAS>" << endl;
122
    os << "<MAS>" << m_maxSize << "</MAS>" << endl;
...
...
124
        os << *it << " ";
138
        os << *it << " ";
125
    }
139
    }
126
    os << "</IT>" << endl;
140
    os << "</IT>" << endl;
127
    }
141
    }
128
142
129
    for (vector<DirSpec>::const_iterator dit = m_dirspecs.begin();
130
   dit != m_dirspecs.end(); dit++) {
131
  if (dit->exclude) {
132
      os << "<ND>" << base64_encode(dit->dir) << "</ND>" << endl;
133
  } else {
134
      os << "<YD>" << base64_encode(dit->dir) << "</YD>" << endl;
135
  }
136
    }
137
    os << "</SD>";
143
    os << "</SD>";
138
    return os.str();
144
    return os.str();
139
}
145
}
140
146
141
147