Commit 958b2d80dbb62203758f28fbb7d22ceaf7e9a043

Authored by Josh Klontz
1 parent 1eaac303

remove regexproperty

openbr/plugins/metadata/regexproperty.cpp deleted
1   -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2   - * Copyright 2012 The MITRE Corporation *
3   - * *
4   - * Licensed under the Apache License, Version 2.0 (the "License"); *
5   - * you may not use this file except in compliance with the License. *
6   - * You may obtain a copy of the License at *
7   - * *
8   - * http://www.apache.org/licenses/LICENSE-2.0 *
9   - * *
10   - * Unless required by applicable law or agreed to in writing, software *
11   - * distributed under the License is distributed on an "AS IS" BASIS, *
12   - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13   - * See the License for the specific language governing permissions and *
14   - * limitations under the License. *
15   - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
16   -
17   -#include <QRegularExpression>
18   -
19   -#include <openbr/plugins/openbr_internal.h>
20   -
21   -namespace br
22   -{
23   -
24   -/*!
25   - * \ingroup transforms
26   - * \brief Apply the input regular expression to the value of inputProperty, store the matched portion in outputProperty.
27   - * \author Charles Otto \cite caotto
28   - */
29   -class RegexPropertyTransform : public UntrainableMetadataTransform
30   -{
31   - Q_OBJECT
32   - Q_PROPERTY(QString regexp READ get_regexp WRITE set_regexp RESET reset_regexp STORED false)
33   - Q_PROPERTY(QString inputProperty READ get_inputProperty WRITE set_inputProperty RESET reset_inputProperty STORED false)
34   - Q_PROPERTY(QString outputProperty READ get_outputProperty WRITE set_outputProperty RESET reset_outputProperty STORED false)
35   - BR_PROPERTY(QString, regexp, "(.*)")
36   - BR_PROPERTY(QString, inputProperty, "name")
37   - BR_PROPERTY(QString, outputProperty, "Label")
38   -
39   - void projectMetadata(const File &src, File &dst) const
40   - {
41   - dst = src;
42   - QRegularExpression re(regexp);
43   - QRegularExpressionMatch match = re.match(dst.get<QString>(inputProperty));
44   - if (!match.hasMatch())
45   - qFatal("Unable to match regular expression \"%s\" to base name \"%s\"!", qPrintable(regexp), qPrintable(dst.get<QString>(inputProperty)));
46   - dst.set(outputProperty, match.captured(match.lastCapturedIndex()));
47   - }
48   -};
49   -
50   -BR_REGISTER(Transform, RegexPropertyTransform)
51   -
52   -} // namespace br
53   -
54   -#include "metadata/regexproperty.moc"