Commit 4a58b240dbd97bd78275a329a0a0da6f4e9a0074
1 parent
958b2d80
remove renamefirst
Showing
1 changed file
with
0 additions
and
51 deletions
openbr/plugins/metadata/renamefirst.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 <openbr/plugins/openbr_internal.h> | ||
| 18 | - | ||
| 19 | -namespace br | ||
| 20 | -{ | ||
| 21 | - | ||
| 22 | -/*! | ||
| 23 | - * \ingroup transforms | ||
| 24 | - * \brief Rename first found metadata key | ||
| 25 | - * \author Josh Klontz \cite jklontz | ||
| 26 | - */ | ||
| 27 | -class RenameFirstTransform : public UntrainableMetadataTransform | ||
| 28 | -{ | ||
| 29 | - Q_OBJECT | ||
| 30 | - Q_PROPERTY(QStringList find READ get_find WRITE set_find RESET reset_find STORED false) | ||
| 31 | - Q_PROPERTY(QString replace READ get_replace WRITE set_replace RESET reset_replace STORED false) | ||
| 32 | - BR_PROPERTY(QStringList, find, QStringList()) | ||
| 33 | - BR_PROPERTY(QString, replace, "") | ||
| 34 | - | ||
| 35 | - void projectMetadata(const File &src, File &dst) const | ||
| 36 | - { | ||
| 37 | - dst = src; | ||
| 38 | - foreach (const QString &key, find) | ||
| 39 | - if (dst.localKeys().contains(key)) { | ||
| 40 | - dst.set(replace, dst.value(key)); | ||
| 41 | - dst.remove(key); | ||
| 42 | - break; | ||
| 43 | - } | ||
| 44 | - } | ||
| 45 | -}; | ||
| 46 | - | ||
| 47 | -BR_REGISTER(Transform, RenameFirstTransform) | ||
| 48 | - | ||
| 49 | -} // namespace br | ||
| 50 | - | ||
| 51 | -#include "metadata/renamefirst.moc" |