Author: saces Date: 2009-01-14 15:23:50 +0000 (Wed, 14 Jan 2009) New Revision: 25059
Added: trunk/apps/wxFCP/include/wx/fcp/fcp.h trunk/apps/wxFCP/samples/fcp/nodeinfo.cpp Log: add 2 file stubs. use the file headers from these as templete for new files Added: trunk/apps/wxFCP/include/wx/fcp/fcp.h =================================================================== --- trunk/apps/wxFCP/include/wx/fcp/fcp.h (rev 0) +++ trunk/apps/wxFCP/include/wx/fcp/fcp.h 2009-01-14 15:23:50 UTC (rev 25059) @@ -0,0 +1,28 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fcp/fcp.h +// Purpose: central header for fcp implementation +// Author: saces +// Modified by: +// Created: 14.01.2009 +// RCS-ID: $Id$ +// Copyright: (c) 2009 saces <[email protected]> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _FCP_FCP_H_ +#define _FCP_FCP_H_ + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#define DEFAULT_FCP_HOST "127.0.0.1" +#define DEFAULT_FCP_PORT 9481 +#define DEFAULT_FCP_TIMEOUT 300 + +#define FCP_HOST_ENV_NAME "FCP_HOST" +#define FCP_PORT_ENV_NAME "FCP_PORT" +#define FCP_TIMEOUT_ENV_NAME "FCP_TIMEOUT" + +#endif // ifndef _FCP_FCP_H_ Added: trunk/apps/wxFCP/samples/fcp/nodeinfo.cpp =================================================================== --- trunk/apps/wxFCP/samples/fcp/nodeinfo.cpp (rev 0) +++ trunk/apps/wxFCP/samples/fcp/nodeinfo.cpp 2009-01-14 15:23:50 UTC (rev 25059) @@ -0,0 +1,81 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: samples/fcp/nodeinfo.cpp +// Purpose: A simple demo, connect to node and print some info +// Author: saces +// Modified by: +// Created: 14.01.2009 +// RCS-ID: $Id$ +// Copyright: (c) 2009 saces <[email protected]> +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +// IMPORTANT NOTE: +// This application is used more for testing rather than as sample. +// If you're looking at this file to learn how to use the wxFCP library, +// you may better use the generated api documentation instead. + +#include "wx/cmdline.h" + +#include "wx/fcp/fcp.h" + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +int main(int argc, char **argv) +{ +#if !wxUSE_UNICODE + #error The freenet node speaks UTF-8, so an UNICODE version of wxWidgets is required +#endif // !wxUSE_UNICODE + + wxChar **wxArgv = new wxChar *[argc + 1]; + + { + int n; + for (n = 0; n < argc; n++ ) + { + wxMB2WXbuf warg = wxConvertMB2WX(argv[n]); + wxArgv[n] = wxStrdup(warg); + } + + wxArgv[n] = NULL; + } + + wxApp::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, "program"); + + wxInitializer initializer; + if ( !initializer ) + { + fprintf(stderr, "Failed to initialize the wxWidgets library, aborting."); + return -1; + } + + static const wxCmdLineEntryDesc cmdLineDesc[] = + { + { wxCMD_LINE_SWITCH, _T("h"), _T("help"), _T("show this help message"), + wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, + { wxCMD_LINE_SWITCH, _T("v"), _T("verbose"), _T("be verbose") }, + { wxCMD_LINE_NONE } + }; + + wxCmdLineParser parser(cmdLineDesc, argc, wxArgv); + switch ( parser.Parse() ) + { + case -1: + wxLogMessage(_T("Help was given, terminating.")); + break; + + case 0: + // everything is ok; proceed + break; + + default: + wxLogMessage(_T("Syntax error detected, aborting.")); + break; + } + + // do something useful here + + return 0; +} _______________________________________________ cvs mailing list [email protected] http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
