cleanup and documentation; refs #13
This commit is contained in:
53
examples/getproxylist.cxx
Normal file
53
examples/getproxylist.cxx
Normal file
@@ -0,0 +1,53 @@
|
||||
/*! @file
|
||||
|
||||
|
||||
Compile for Linux:
|
||||
|
||||
@code
|
||||
g++ test.cxx -I. -lproxy -ldl
|
||||
@endcode
|
||||
|
||||
On Linux: install http://code.google.com/p/libproxy/
|
||||
|
||||
@code
|
||||
./configure --without-gnome --without-kde \
|
||||
--without-webkit --without-mozjs \
|
||||
--without-networkmanager --without-python
|
||||
make && sudo make install
|
||||
@endcode
|
||||
|
||||
Cross-Compile for Windoze:
|
||||
|
||||
@code
|
||||
i586-mingw32msvc-g++ test.cxx \
|
||||
-I . -I ~/.wine/drive_c/MicrosoftSDK/include \
|
||||
winhttp.a
|
||||
@endcode
|
||||
|
||||
@id $Id$
|
||||
*/
|
||||
// 1 2 3 4 5 6 7 8
|
||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
#include <proxyface/autoproxy.hxx>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char** argv) try {
|
||||
proxy::Face detect;
|
||||
while (++argv, --argc) {
|
||||
std::cout<<"detecting proxies for url: "<<*argv<<std::endl;
|
||||
for (proxy::List p(detect.proxies(*argv));
|
||||
p.size();
|
||||
p.pop_front())
|
||||
std::cout<<" -> found "
|
||||
<<(p.begin()->type==proxy::DIRECT?"DIRECT"
|
||||
:(p.begin()->type==proxy::DEFAULT?"DEFAULT"
|
||||
:(p.begin()->type==proxy::HTTP?"HTTP"
|
||||
:(p.begin()->type==proxy::SOCKS?"SOCKS":"**ERROR**"))))
|
||||
<<" proxy host: "<<p.begin()->host
|
||||
<<" (Port: "<<p.begin()->port<<")"<<std::endl;
|
||||
}
|
||||
return 0;
|
||||
} catch(std::exception& x) {
|
||||
std::cerr<<" **** Exception: "<<x.what()<<std::endl;
|
||||
}
|
15
examples/makefile.am
Normal file
15
examples/makefile.am
Normal file
@@ -0,0 +1,15 @@
|
||||
## @id $Id$
|
||||
|
||||
## 1 2 3 4 5 6 7 8
|
||||
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
noinst_PROGRAMS = getproxylist simplegui
|
||||
|
||||
AM_CPPFLAGS = -I${top_srcdir}
|
||||
LDFLAGS = -L${top_builddir}/proxyface/.libs
|
||||
LDADD = -lQtCore -lQtNetwork -lQtGui -lproxy -lproxyface
|
||||
|
||||
getproxylist_SOURCES = getproxylist.cxx
|
||||
simplegui_SOURCES = simplegui.cxx
|
||||
|
||||
MAINTAINERCLEANFILES = makefile.in
|
16
examples/simplegui.cxx
Normal file
16
examples/simplegui.cxx
Normal file
@@ -0,0 +1,16 @@
|
||||
/*! @file
|
||||
|
||||
@id $Id$
|
||||
*/
|
||||
// 1 2 3 4 5 6 7 8
|
||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include <proxyface/proxy.hxx>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
QApplication app(argc, argv);
|
||||
gui::Proxy proxy("http://www.gnu.org/");
|
||||
proxy.show();
|
||||
return app.exec();
|
||||
}
|
Reference in New Issue
Block a user