1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2009, 2014, 2016-2017 - TortoiseGit
4 // Copyright (C) 2008,2013 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 struct CBugTraqProvider
29 /* TODO: It's less of an association and more of a "token" or "memento".
31 class CBugTraqAssociation
34 CBugTraqProvider m_provider
;
42 m_provider
.clsid
= GUID_NULL
;
45 CBugTraqAssociation(LPCTSTR szWorkingCopy
, const CLSID
&provider_clsid
, LPCTSTR szProviderName
, LPCTSTR szParameters
, bool enabled
)
46 : m_path(szWorkingCopy
), m_parameters(szParameters
), m_enabled(enabled
)
48 m_provider
.clsid
= provider_clsid
;
49 m_provider
.name
= szProviderName
;
52 const CTGitPath
&GetPath() const { return m_path
; }
53 CString
GetProviderName() const { return m_provider
.name
; }
54 CLSID
GetProviderClass() const { return m_provider
.clsid
; }
55 CString
GetProviderClassAsString() const;
56 CString
GetParameters() const { return m_parameters
; }
57 bool IsEnabled() const { return m_enabled
; }
58 bool SetEnabled(bool enabled
) { if (m_enabled
== enabled
) { return false; } m_enabled
= enabled
; return true; }
61 class CBugTraqAssociations
63 typedef std::vector
< CBugTraqAssociation
* > inner_t
;
67 CBugTraqAssociations();
68 ~CBugTraqAssociations();
70 void Load(LPCTSTR uuid
= nullptr, LPCTSTR params
= nullptr);
73 void Add(const CBugTraqAssociation
&assoc
);
74 void Remove(CBugTraqAssociation
* assoc
);
76 bool FindProvider(const CString
&path
, CBugTraqAssociation
*assoc
);
78 typedef inner_t::const_iterator const_iterator
;
79 const_iterator
begin() const { return m_inner
.begin(); }
80 const_iterator
end() const { return m_inner
.end(); }
82 static std::vector
<CBugTraqProvider
> GetAvailableProviders();
83 static CString
LookupProviderName(const CLSID
&provider_clsid
);
86 bool FindProviderForPath(const CTGitPath
& path
, CBugTraqAssociation
*assoc
) const;
90 const CTGitPath
&m_path
;
92 FindByPathPred(const CTGitPath
&path
)
95 bool operator() (const CBugTraqAssociation
*assoc
) const
97 return (assoc
->GetPath().IsEquivalentToWithoutCase(m_path
));
100 CString providerUUID
;
101 CString providerParams
;
102 CBugTraqAssociation
* pProjectProvider
;