KiCad PCB EDA Suite
github_getliblist.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2015 Jean-Pierre Charras jp.charras at wanadoo.fr
5  * Copyright (C) 2015 KiCad Developers, see CHANGELOG.TXT for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef GITHUB_GETLIBLIST_H_
26 #define GITHUB_GETLIBLIST_H_
27 
28 
48 {
49 public:
50  // -----<API>----------------------------------------------------------
51 
55  bool GetFootprintLibraryList( wxArrayString& aList );
56 
64  bool Get3DshapesLibsList( wxArrayString* aList,
65  bool (*aFilter)( const wxString& aData ) );
66 
70  std::string& GetBuffer() { return m_image; }
71 
75  void ClearBuffer() { m_image.clear(); }
76 
81  void SetLibraryExt( const wxString& aExt ) { m_libs_ext = aExt; }
82 
83  // -----</API>---------------------------------------------------------
84 
85  GITHUB_GETLIBLIST( const wxString& aRepoURL );
87 
88 protected:
89 
102  bool repoURL2listURL( const wxString& aRepoURL, std::string* aFullURLCommand,
103  int aItemCountMax, int aPage = 1 );
104 
114  bool remoteGetJSON( const std::string& aFullURLCommand, wxString* aMsgError );
115 
116  wxString m_github_path;
117  std::string m_image;
118  wxString m_repoURL;
119  wxString m_libs_ext;
120  char m_option_string[64];
121 };
122 
123 
124 #endif // GITHUB_GETLIBLIST_H_
GITHUB_GETLIBLIST(const wxString &aRepoURL)
char m_option_string[64]
option for transfert type, like "application/json"
bool GetFootprintLibraryList(wxArrayString &aList)
Fills aList by the name of footprint libraries found on the github repo.
bool Get3DshapesLibsList(wxArrayString *aList, bool(*aFilter)(const wxString &aData))
Fills aList by the URL of libraries found on the github repo.
void SetLibraryExt(const wxString &aExt)
The library names are expecting ending by .pretty SetLibraryExt set the extension to aExt...
std::string m_image
image of the downloaded data in its entirety.
bool repoURL2listURL(const wxString &aRepoURL, std::string *aFullURLCommand, int aItemCountMax, int aPage=1)
Function repoURL2listURL translates a repo URL to the URL name which gives the state of repos URL as ...
wxString m_github_path
Something like https://api.github.com/orgs/KiCad.
bool remoteGetJSON(const std::string &aFullURLCommand, wxString *aMsgError)
Function remoteGetJSON Download a json text from a github repo.
wxString m_repoURL
the URL of the Github repo
wxString m_libs_ext
the extension of the name of libraries (default = .pretty)
void ClearBuffer()
Clear the buffer which stores all the downloaded raw data.
std::string & GetBuffer()
Class GITHUB_GETLIBLIST implements a portion of pcbnew's PLUGIN interface to provide read only access...