Back to Imagemagick

Magick++: encoder_format.h Source File

www/api/Magick++/encoder__format_8h_source.html

7.1.2-212.4 KB
Original Source

| 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/license/

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 class EncoderFormat {

18 public:

19 std::string get() { return std::string(_format.begin(), _format.end()); } const

20void set(const std::wstring fileName, const std::wstring extension)

21 {

22if (fileName.find(L"clusterfuzz-testcase-") == -1)

23 {

24if (extension.length() > 1)

25 _format = extension.substr(1, extension.size() - 1);

26return;

27 }

28

29 std::wstring format=fileName;

30

31size_t index = format.find(L"_", 0);

32if (index == std::wstring::npos)

33return;

34

35 format=format.substr(index + 1);

36 index = format.find(L"_", 0);

37if (index != std::wstring::npos)

38 _format=format.substr(0, index);

39else if (extension.length() > 1)

40 _format=extension.substr(1, extension.size() - 1);

41 }

42 private:

43 std::wstring _format = L".notset";

44 };

EncoderFormat

Definition: encoder_format.h:17