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