1 // TortoiseGit - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2008 - TortoiseGit
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
20 #include "TGitPath.h"
\r
22 struct CBugTraqProvider
\r
28 /* TODO: It's less of an association and more of a "token" or "memento".
\r
30 class CBugTraqAssociation
\r
33 CBugTraqProvider m_provider;
\r
34 CString m_parameters;
\r
37 CBugTraqAssociation()
\r
39 m_provider.clsid = GUID_NULL;
\r
42 CBugTraqAssociation(LPCTSTR szWorkingCopy, const CLSID &provider_clsid, LPCTSTR szProviderName, LPCTSTR szParameters)
\r
43 : m_path(szWorkingCopy), m_parameters(szParameters)
\r
45 m_provider.clsid = provider_clsid;
\r
46 m_provider.name = szProviderName;
\r
49 const CTGitPath &GetPath() const { return m_path; }
\r
50 CString GetProviderName() const { return m_provider.name; }
\r
51 CLSID GetProviderClass() const { return m_provider.clsid; }
\r
52 CString GetProviderClassAsString() const;
\r
53 CString GetParameters() const { return m_parameters; }
\r
56 class CBugTraqAssociations
\r
58 typedef std::vector< CBugTraqAssociation * > inner_t;
\r
62 ~CBugTraqAssociations();
\r
67 void Add(const CBugTraqAssociation &assoc);
\r
68 void RemoveByPath(const CTGitPath &path);
\r
70 bool FindProvider(const CTGitPathList &pathList, CBugTraqAssociation *assoc) const;
\r
72 typedef inner_t::const_iterator const_iterator;
\r
73 const_iterator begin() const { return m_inner.begin(); }
\r
74 const_iterator end() const { return m_inner.end(); }
\r
76 static std::vector<CBugTraqProvider> GetAvailableProviders();
\r
77 static CString LookupProviderName(const CLSID &provider_clsid);
\r
80 bool FindProviderForPathList(const CTGitPathList &pathList, CBugTraqAssociation *assoc) const;
\r
81 bool FindProviderForPath(CTGitPath path, CBugTraqAssociation *assoc) const;
\r
83 struct FindByPathPred
\r
85 const CTGitPath &m_path;
\r
87 FindByPathPred(const CTGitPath &path)
\r
90 bool operator() (const CBugTraqAssociation *assoc) const
\r
92 return (assoc->GetPath().IsEquivalentToWithoutCase(m_path));
\r