28 #include <wx/wfstream.h>
29 #include <wx/txtstrm.h>
30 #include <hugin_version.h>
42 std::string(item1.
GetCategory().mb_str(wxConvLocal)),
43 std::string(item2.
GetCategory().mb_str(wxConvLocal)));
53 std::string(item1.
GetName().mb_str(wxConvLocal)),
54 std::string(item2.
GetName().mb_str(wxConvLocal)))<0);
65 return doj::alphanum_comp(std::string(v1.mb_str(wxConvLocal)),std::string(v2.mb_str(wxConvLocal))) < 0;
73 m_name=filename.GetFullName();
83 wxFileInputStream in(
m_filename.GetFullPath());
84 wxTextInputStream text(in);
87 bool foundCategory=
false;
89 bool foundAPImin=
false;
90 bool foundAPImax=
false;
92 bool foundDescription=
false;
94 wxString system(wxT(
"win"));
95 #elif defined __WXMAC__
96 wxString system(wxT(
"mac"));
98 wxString system(wxT(
"nix"));
100 wxString tagSYS(wxT(
"@sys"));
101 wxString tagAPImin(wxT(
"@api-min"));
102 wxString tagAPImax(wxT(
"@api-max"));
103 wxString tagCategory(wxT(
"@category"));
104 wxString tagName(wxT(
"@name"));
105 wxString tagDescription(wxT(
"@description"));
108 std::cout <<
m_filename.GetFullPath().mb_str(wxConvLocal) << std::endl;
111 while(!in.Eof() && !(foundCategory && foundName && foundAPImin && foundAPImax && foundSYS && foundDescription))
114 wxString
line=text.ReadLine();
116 wxString lowerLine=line.Lower();
117 pos=lowerLine.Find(tagSYS);
121 pos=lowerLine.Find(system);
125 std::cout <<
" fails @sys" << std::endl;
129 pos=lowerLine.Find(tagAPImin);
133 wxString APImin = line.Mid(pos+1+tagAPImin.length()).Trim().Trim(
false);
137 std::cout <<
" fails @api-min" << std::endl;
141 pos=lowerLine.Find(tagAPImax);
145 wxString APImax = line.Mid(pos+1+tagAPImax.length()).Trim().Trim(
false);
149 std::cout <<
" fails @api-max" << std::endl;
153 pos=lowerLine.Find(tagCategory);
156 m_category = line.Mid(pos+1+tagCategory.length()).Trim().Trim(
false);
158 std::cout <<
" CAT:" <<
m_category.mb_str(wxConvLocal) << std::endl;
161 pos=lowerLine.Find(tagName);
164 m_name = line.Mid(pos+1+tagName.length()).Trim().Trim(
false);
166 std::cout <<
" NAM:" <<
m_name.mb_str(wxConvLocal) << std::endl;
169 pos=lowerLine.Find(tagDescription);
172 m_description = line.Mid(pos+1+tagDescription.length()).Trim().Trim(
false);
173 foundDescription=
true;
int alphanum_comp(const std::string &l, const std::string &r)
Compare l and r with the same semantics as strcmp(), but with the "Alphanum Algorithm" which produces...
const wxString GetDescription() const
return description
Reading python plugins metadata.
bool compareVersion(wxString v1, wxString v2)
const wxFileName GetFilename() const
returns filename
bool comparePluginItem(PluginItem item1, PluginItem item2)
compares 2 plugin with category and name
PluginItem(wxFileName filename)
constructor
class for generating plugin menu items
const wxString GetName() const
return name from metadata
const bool IsAPIValid() const
returns true, if plugin can run on given system and version
const wxString GetCategory() const
return category name