Magick++  7.1.0
encoder_format.h
Go to the documentation of this file.
1 /*
2  Copyright @ 2018 ImageMagick Studio LLC, a non-profit organization
3  dedicated to making software imaging solutions freely available.
4 
5  You may not use this file except in compliance with the License. You may
6  obtain a copy of the License at
7 
8  https://imagemagick.org/script/license.php
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 
18 public:
19  std::string get() { return std::string(_format.begin(), _format.end()); } const
20  void set(const std::wstring fileName, const std::wstring extension)
21  {
22  if (fileName.find(L"clusterfuzz-testcase-") == -1)
23  {
24  if (extension.length() > 1)
25  _format = extension.substr(1, extension.size() - 1);
26  return;
27  }
28 
29  std::wstring format=fileName;
30 
31  size_t index = format.find(L"_", 0);
32  if (index == std::wstring::npos)
33  return;
34 
35  format=format.substr(index + 1);
36  index = format.find(L"_", 0);
37  if (index != std::wstring::npos)
38  _format=format.substr(0, index);
39  else if (extension.length() > 1)
40  _format=extension.substr(1, extension.size() - 1);
41  }
42 private:
43  std::wstring _format = L".notset";
44 };