OSDN Git Service

Update Dutch.po (#842)
[winmerge-jp/winmerge-jp.git] / Src / Merge7zFormatRegister.h
1 #pragma once
2
3 #include <vector>
4 #include "UnicodeString.h"
5 #include "dllpstub.h"
6 #include "../ArchiveSupport/Merge7z/Merge7z.h"
7
8 struct Merge7zFormatRegister
9 {
10         explicit Merge7zFormatRegister(Merge7z::Format *(*pfnGuessFormat)(const String& path))
11         {
12                 Add(pfnGuessFormat);
13         }
14         static void Add(Merge7z::Format *(*pfnGuessFormat)(const String& path))
15         {
16                 optionalFormats.push_back(pfnGuessFormat);
17         }
18         static Merge7z::Format *GuessFormat(const String& path)
19         {
20                 for (size_t i = 0; i < Merge7zFormatRegister::optionalFormats.size(); ++i)
21                 {
22                         Merge7z::Format* pFormat = Merge7zFormatRegister::optionalFormats[i](path);
23                         if (pFormat != nullptr)
24                                 return pFormat;
25                 }
26                 return nullptr;
27         }
28
29         static std::vector<Merge7z::Format *(*)(const String& path)> optionalFormats;
30 };
31