This commit is contained in:
Ivan
2022-04-05 11:42:28 +03:00
commit 6dc0eb0fcf
5565 changed files with 1200500 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
Debug
Release
doc
*.ncb
*.opt
*.plg
*.suo

View File

@@ -0,0 +1,108 @@
// FileClient.cpp : A simple xmlrpc client. Usage: FileClient serverHost serverPort xmlfile
// Reads an xmlrpc request from the specified xmlfile and calls the method on the server.
//
// Link against xmlrpc lib and whatever socket libs your system needs (ws2_32.lib on windows)
#include "xmlrpcpp/XmlRpc.h"
#include <iostream>
#include <fstream>
#include <stdlib.h>
using namespace XmlRpc;
std::string parseRequest(std::string const& xml, XmlRpcValue& params);
int main(int argc, char* argv[])
{
if (argc != 4) {
std::cerr << "Usage: FileClient serverHost serverPort requestXmlFile\n";
return -1;
}
int port = atoi(argv[2]);
XmlRpc::setVerbosity(5);
XmlRpcClient c(argv[1], port);
//
std::ifstream infile(argv[3]);
if (infile.fail()) {
std::cerr << "Could not open file '" << argv[3] << "'.\n";
return -1;
}
// Suck in the file. This is a one-liner in good compilers (which vc++ 6 is not)...
infile.seekg(0L, std::ios::end);
long nb = infile.tellg();
infile.clear();
infile.seekg(0L);
char* b = new char[nb+1];
infile.read(b, nb);
b[nb] = 0;
std::cout << "Read file.\n";
// Find the methodName and parse the params
std::string s(b);
XmlRpcValue params;
std::string name = parseRequest(s, params);
if (name.empty()) {
std::cerr << "Could not parse file\n";
return -1;
}
for (;;) {
XmlRpcValue result;
std::cout << "Calling " << name << std::endl;
if (c.execute(name.c_str(), params, result))
std::cout << result << "\n\n";
else
std::cout << "Error calling '" << name << "'\n\n";
std::cout << "Again? [y]: ";
std::string ans;
std::cin >> ans;
if (ans != "" && ans != "y") break;
}
return 0;
}
//
std::string
parseRequest(std::string const& xml, XmlRpcValue& params)
{
const char METHODNAME_TAG[] = "<methodName>";
const char PARAMS_TAG[] = "<params>";
const char PARAMS_ETAG[] = "</params>";
const char PARAM_TAG[] = "<param>";
const char PARAM_ETAG[] = "</param>";
int offset = 0; // Number of chars parsed from the request
std::string methodName = XmlRpcUtil::parseTag(METHODNAME_TAG, xml, &offset);
XmlRpcUtil::log(3, "XmlRpcServerConnection::parseRequest: parsed methodName %s.", methodName.c_str());
if (! methodName.empty() && XmlRpcUtil::findTag(PARAMS_TAG, xml, &offset))
{
int nArgs = 0;
while (XmlRpcUtil::nextTagIs(PARAM_TAG, xml, &offset)) {
std::cout << "Parsing arg " << nArgs+1 << std::endl;
XmlRpcValue arg(xml, &offset);
if ( ! arg.valid()) {
std::cerr << "Invalid argument\n";
return std::string();
}
std::cout << "Adding arg " << nArgs+1 << " to params array." << std::endl;
params[nArgs++] = arg;
(void) XmlRpcUtil::nextTagIs(PARAM_ETAG, xml, &offset);
}
XmlRpcUtil::log(3, "XmlRpcServerConnection::parseRequest: parsed %d params.", nArgs);
(void) XmlRpcUtil::nextTagIs(PARAMS_ETAG, xml, &offset);
}
return methodName;
}

View File

@@ -0,0 +1,96 @@
# Microsoft Developer Studio Project File - Name="FileClient" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=FileClient - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "FileClient.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "FileClient.mak" CFG="FileClient - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "FileClient - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "FileClient - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "FileClient - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\src" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 xmlrpc.lib Ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\release"
!ELSEIF "$(CFG)" == "FileClient - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\src" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 xmlrpc.lib Ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
!ENDIF
# Begin Target
# Name "FileClient - Win32 Release"
# Name "FileClient - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\FileClient.cpp
# End Source File
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,158 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="FileClient"
ProjectGUID="{C3B49855-CD45-448E-991E-3E4C9B02F465}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\src"
PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE,_WINDOWS"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\Release/FileClient.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0">
<IntelOptions
Optimization="2"
InlineFuncExpansion="1"
OmitFramePtrs="1"
StringPooling="1"
RuntimeLibrary="2"
BufferSecurityCheck="1"
FunctionLevelLinking="1"
AllOptions="/c /I &quot;..\src&quot; /nologo /W3 /O2 /Ob1 /Oy /D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_WINDOWS&quot; /D &quot;_MBCS&quot; /GF /FD /EHsc /MD /GS /Gy /Fp&quot;.\Release/FileClient.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd"/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib"
OutputFile=".\Release/FileClient.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\release"
ProgramDatabaseFile=".\Release/FileClient.pdb"
SubSystem="1">
<IntelOptions
AllOptions="/NOLOGO /OUT:&quot;.\Release/FileClient.exe&quot; /INCREMENTAL:NO /LIBPATH:&quot;..\release&quot; xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib /PDB:&quot;.\Release/FileClient.pdb&quot; /SUBSYSTEM:CONSOLE /TLBID:1 /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
</Tool>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/FileClient.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<IntelOptions
CompilerName="1"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\src"
PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE,_WINDOWS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Debug/FileClient.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0">
<IntelOptions
Optimization="0"
MinimalRebuild="1"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
AllOptions="/c /I &quot;..\src&quot; /ZI /nologo /W3 /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_WINDOWS&quot; /D &quot;_MBCS&quot; /Gm /EHsc /RTC1 /MDd /Fp&quot;.\Debug/FileClient.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd"/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib"
OutputFile=".\Debug/FileClient.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\Debug"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/FileClient.pdb"
SubSystem="1">
<IntelOptions
AllOptions="/NOLOGO /OUT:&quot;.\Debug/FileClient.exe&quot; /INCREMENTAL /LIBPATH:&quot;..\Debug&quot; xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib /DEBUG /PDB:&quot;.\Debug/FileClient.pdb&quot; /SUBSYSTEM:CONSOLE /TLBID:1 /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
</Tool>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/FileClient.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<IntelOptions
CompilerName="1"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath=".\FileClient.cpp"/>
</Filter>
</Files>
<Globals/>
</VisualStudioProject>

View File

@@ -0,0 +1,88 @@
// HelloClient.cpp : A simple xmlrpc client. Usage: HelloClient serverHost serverPort
// Link against xmlrpc lib and whatever socket libs your system needs (ws2_32.lib
// on windows)
#include "xmlrpcpp/XmlRpc.h"
#include <iostream>
using namespace XmlRpc;
int main(int argc, char* argv[])
{
if (argc != 3) {
std::cerr << "Usage: HelloClient serverHost serverPort\n";
return -1;
}
int port = atoi(argv[2]);
//XmlRpc::setVerbosity(5);
// Use introspection API to look up the supported methods
XmlRpcClient c(argv[1], port);
XmlRpcValue noArgs, result;
for (int i = 0; i < 2000; i++)
{
if (c.execute("system.listMethods", noArgs, result))
std::cout << "\nMethods:\n " << result << "\n\n";
else
std::cout << "Error calling 'listMethods'\n\n";
}
// Use introspection API to get the help string for the Hello method
XmlRpcValue oneArg;
oneArg[0] = "Hello";
if (c.execute("system.methodHelp", oneArg, result))
std::cout << "Help for 'Hello' method: " << result << "\n\n";
else
std::cout << "Error calling 'methodHelp'\n\n";
// Call the Hello method
if (c.execute("Hello", noArgs, result))
std::cout << result << "\n\n";
else
std::cout << "Error calling 'Hello'\n\n";
// Call the HelloName method
oneArg[0] = "Chris";
if (c.execute("HelloName", oneArg, result))
std::cout << result << "\n\n";
else
std::cout << "Error calling 'HelloName'\n\n";
// Add up an array of numbers
XmlRpcValue numbers;
numbers[0] = 33.33;
numbers[1] = 112.57;
numbers[2] = 76.1;
std::cout << "numbers.size() is " << numbers.size() << std::endl;
if (c.execute("Sum", numbers, result))
std::cout << "Sum = " << double(result) << "\n\n";
else
std::cout << "Error calling 'Sum'\n\n";
// Test the "no such method" fault
if (c.execute("NoSuchMethod", numbers, result))
std::cout << "NoSuchMethod call: fault: " << c.isFault() << ", result = " << result << std::endl;
else
std::cout << "Error calling 'Sum'\n";
// Test the multicall method. It accepts one arg, an array of structs
XmlRpcValue multicall;
multicall[0][0]["methodName"] = "Sum";
multicall[0][0]["params"][0] = 5.0;
multicall[0][0]["params"][1] = 9.0;
multicall[0][1]["methodName"] = "NoSuchMethod";
multicall[0][1]["params"][0] = "";
multicall[0][2]["methodName"] = "Sum";
// Missing params
multicall[0][3]["methodName"] = "Sum";
multicall[0][3]["params"][0] = 10.5;
multicall[0][3]["params"][1] = 12.5;
if (c.execute("system.multicall", multicall, result))
std::cout << "\nmulticall result = " << result << std::endl;
else
std::cout << "\nError calling 'system.multicall'\n";
return 0;
}

View File

@@ -0,0 +1,96 @@
# Microsoft Developer Studio Project File - Name="HelloClient" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=HelloClient - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "HelloClient.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "HelloClient.mak" CFG="HelloClient - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "HelloClient - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "HelloClient - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "HelloClient - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\src" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 xmlrpc.lib Ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\release"
!ELSEIF "$(CFG)" == "HelloClient - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\src" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 xmlrpc.lib Ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
!ENDIF
# Begin Target
# Name "HelloClient - Win32 Release"
# Name "HelloClient - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\HelloClient.cpp
# End Source File
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,158 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="HelloClient"
ProjectGUID="{F6860B2F-0F3B-445E-92F2-6DF3D36C90F0}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\src"
PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\Release/HelloClient.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0">
<IntelOptions
Optimization="2"
InlineFuncExpansion="1"
OmitFramePtrs="1"
StringPooling="1"
RuntimeLibrary="2"
BufferSecurityCheck="1"
FunctionLevelLinking="1"
AllOptions="/c /I &quot;..\src&quot; /nologo /W3 /O2 /Ob1 /Oy /D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_MBCS&quot; /GF /FD /EHsc /MD /GS /Gy /Fp&quot;.\Release/HelloClient.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd"/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib"
OutputFile=".\Release/HelloClient.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\release"
ProgramDatabaseFile=".\Release/HelloClient.pdb"
SubSystem="1">
<IntelOptions
AllOptions="/NOLOGO /OUT:&quot;.\Release/HelloClient.exe&quot; /INCREMENTAL:NO /LIBPATH:&quot;..\release&quot; xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib /PDB:&quot;.\Release/HelloClient.pdb&quot; /SUBSYSTEM:CONSOLE /TLBID:1 /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
</Tool>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/HelloClient.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<IntelOptions
CompilerName="1"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\src"
PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Debug/HelloClient.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0">
<IntelOptions
Optimization="0"
MinimalRebuild="1"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
AllOptions="/c /I &quot;..\src&quot; /ZI /nologo /W3 /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_MBCS&quot; /Gm /EHsc /RTC1 /MDd /Fp&quot;.\Debug/HelloClient.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd"/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386 &quot;c:\home\cmm\dev\sourceforge\xmlrpc++\Debug\xmlrpc.lib&quot;"
AdditionalDependencies="xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib"
OutputFile=".\Debug/HelloClient.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\Debug"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/HelloClient.pdb"
SubSystem="1">
<IntelOptions
AllOptions="/NOLOGO /OUT:&quot;.\Debug/HelloClient.exe&quot; /INCREMENTAL /LIBPATH:&quot;..\Debug&quot; xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib /DEBUG /PDB:&quot;.\Debug/HelloClient.pdb&quot; /SUBSYSTEM:CONSOLE /TLBID:1 /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
</Tool>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/HelloClient.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<IntelOptions
CompilerName="1"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath=".\HelloClient.cpp"/>
</Filter>
</Files>
<Globals/>
</VisualStudioProject>

View File

@@ -0,0 +1,82 @@
// HelloServer.cpp : Simple XMLRPC server example. Usage: HelloServer serverPort
//
#include "xmlrpcpp/XmlRpc.h"
#include <iostream>
#include <stdlib.h>
using namespace XmlRpc;
// The server
XmlRpcServer s;
// No arguments, result is "Hello".
class Hello : public XmlRpcServerMethod
{
public:
Hello(XmlRpcServer* s) : XmlRpcServerMethod("Hello", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
result = "Hello";
}
std::string help() { return std::string("Say hello"); }
} hello(&s); // This constructor registers the method with the server
// One argument is passed, result is "Hello, " + arg.
class HelloName : public XmlRpcServerMethod
{
public:
HelloName(XmlRpcServer* s) : XmlRpcServerMethod("HelloName", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
std::string resultString = "Hello, ";
resultString += std::string(params[0]);
result = resultString;
}
} helloName(&s);
// A variable number of arguments are passed, all doubles, result is their sum.
class Sum : public XmlRpcServerMethod
{
public:
Sum(XmlRpcServer* s) : XmlRpcServerMethod("Sum", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
int nArgs = params.size();
double sum = 0.0;
for (int i=0; i<nArgs; ++i)
sum += double(params[i]);
result = sum;
}
} sum(&s);
int main(int argc, char* argv[])
{
if (argc != 2) {
std::cerr << "Usage: HelloServer serverPort\n";
return -1;
}
int port = atoi(argv[1]);
XmlRpc::setVerbosity(5);
// Create the server socket on the specified port
s.bindAndListen(port);
// Enable introspection
s.enableIntrospection(true);
// Wait for requests indefinitely
s.work(-1.0);
return 0;
}

View File

@@ -0,0 +1,96 @@
# Microsoft Developer Studio Project File - Name="HelloServer" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=HelloServer - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "HelloServer.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "HelloServer.mak" CFG="HelloServer - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "HelloServer - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "HelloServer - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "HelloServer - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\src" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 xmlrpc.lib Ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\release"
!ELSEIF "$(CFG)" == "HelloServer - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\src" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 xmlrpc.lib Ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
!ENDIF
# Begin Target
# Name "HelloServer - Win32 Release"
# Name "HelloServer - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\HelloServer.cpp
# End Source File
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,158 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="HelloServer"
ProjectGUID="{08C4FFA8-A9E5-4EEA-9703-53C293C2F724}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\src"
PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\Release/HelloServer.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0">
<IntelOptions
Optimization="2"
InlineFuncExpansion="1"
OmitFramePtrs="1"
StringPooling="1"
RuntimeLibrary="2"
BufferSecurityCheck="1"
FunctionLevelLinking="1"
AllOptions="/c /I &quot;..\src&quot; /nologo /W3 /O2 /Ob1 /Oy /D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_MBCS&quot; /GF /FD /EHsc /MD /GS /Gy /Fp&quot;.\Release/HelloServer.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd"/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib"
OutputFile=".\Release/HelloServer.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\release"
ProgramDatabaseFile=".\Release/HelloServer.pdb"
SubSystem="1">
<IntelOptions
AllOptions="/NOLOGO /OUT:&quot;.\Release/HelloServer.exe&quot; /INCREMENTAL:NO /LIBPATH:&quot;..\release&quot; xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib /PDB:&quot;.\Release/HelloServer.pdb&quot; /SUBSYSTEM:CONSOLE /TLBID:1 /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
</Tool>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/HelloServer.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<IntelOptions
CompilerName="1"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\src"
PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Debug/HelloServer.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0">
<IntelOptions
Optimization="0"
MinimalRebuild="1"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
AllOptions="/c /I &quot;..\src&quot; /ZI /nologo /W3 /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_MBCS&quot; /Gm /EHsc /RTC1 /MDd /Fp&quot;.\Debug/HelloServer.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd"/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib"
OutputFile=".\Debug/HelloServer.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\Debug"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/HelloServer.pdb"
SubSystem="1">
<IntelOptions
AllOptions="/NOLOGO /OUT:&quot;.\Debug/HelloServer.exe&quot; /INCREMENTAL /LIBPATH:&quot;..\Debug&quot; xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib /DEBUG /PDB:&quot;.\Debug/HelloServer.pdb&quot; /SUBSYSTEM:CONSOLE /TLBID:1 /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
</Tool>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/HelloServer.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<IntelOptions
CompilerName="1"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath=".\HelloServer.cpp"/>
</Filter>
</Files>
<Globals/>
</VisualStudioProject>

View File

@@ -0,0 +1,26 @@
# makefile written for gnu make
CXX = g++
SRC = ../src
CPPFLAGS = -I$(SRC)
DEBUG = -g
#OPTIMIZE = -O2
GCCWARN = -Wall
CXXFLAGS = $(DEBUG) $(GCCWARN) $(OPTIMIZE) $(INCLUDES)
LIB = ../libXmlRpc.a
# Add your system-dependent network libs here
# Solaris: -lsocket -lnsl
SYSTEMLIBS =
LDLIBS = $(SYSTEMLIBS) $(LIB)
TESTS = HelloClient HelloServer TestBase64Client TestBase64Server TestValues TestXml Validator port_zero_server bool_test
all: $(TESTS)
$(TESTS): $(LIB)
clean:
rm -f *.o
rm -f $(TESTS)

View File

@@ -0,0 +1,45 @@
// TestBase64Client.cpp : A simple xmlrpc client that returns a png file
// encoded as base64 data to the client.
//
// Usage: TestBase64Client serverHost serverPort outputfile
// Requests a png file from the specified server and saves it in outputfile.
// Link against xmlrpc lib and whatever socket libs your system needs (ws2_32.lib on windows)
#include "xmlrpcpp/XmlRpc.h"
#include <iostream>
#include <fstream>
#include <stdlib.h>
using namespace XmlRpc;
int main(int argc, char* argv[])
{
if (argc != 4) {
std::cerr << "Usage: TestBase64Client serverHost serverPort outputFile\n";
return -1;
}
int port = atoi(argv[2]);
//XmlRpc::setVerbosity(5);
XmlRpcClient c(argv[1], port);
XmlRpcValue noArgs, result;
if (c.execute("TestBase64", noArgs, result))
{
const XmlRpcValue::BinaryData& data = result;
std::ofstream outfile(argv[3], std::ios::binary | std::ios::trunc);
if (outfile.fail())
std::cerr << "Error opening " << argv[3] << " for output.\n";
else
{
int n = int(data.size());
for (int i=0; i<n; ++i)
outfile << data[i];
}
}
else
std::cout << "Error calling 'TestBase64'\n\n";
return 0;
}

View File

@@ -0,0 +1,96 @@
# Microsoft Developer Studio Project File - Name="TestBase64Client" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=TestBase64Client - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "TestBase64Client.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "TestBase64Client.mak" CFG="TestBase64Client - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "TestBase64Client - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "TestBase64Client - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "TestBase64Client - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\src" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 xmlrpc.lib Ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\release"
!ELSEIF "$(CFG)" == "TestBase64Client - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\src" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 xmlrpc.lib Ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
!ENDIF
# Begin Target
# Name "TestBase64Client - Win32 Release"
# Name "TestBase64Client - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\TestBase64Client.cpp
# End Source File
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,158 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="TestBase64Client"
ProjectGUID="{1E8B725B-E898-494C-84C6-DB77EF38E6CB}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\src"
PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE,_WINDOWS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Debug/TestBase64Client.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0">
<IntelOptions
Optimization="0"
MinimalRebuild="1"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
AllOptions="/c /I &quot;..\src&quot; /ZI /nologo /W3 /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_WINDOWS&quot; /D &quot;_MBCS&quot; /Gm /EHsc /RTC1 /MDd /Fp&quot;.\Debug/TestBase64Client.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd"/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib"
OutputFile=".\Debug/TestBase64Client.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\Debug"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/TestBase64Client.pdb"
SubSystem="1">
<IntelOptions
AllOptions="/NOLOGO /OUT:&quot;.\Debug/TestBase64Client.exe&quot; /INCREMENTAL /LIBPATH:&quot;..\Debug&quot; xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib /DEBUG /PDB:&quot;.\Debug/TestBase64Client.pdb&quot; /SUBSYSTEM:CONSOLE /TLBID:1 /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
</Tool>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/TestBase64Client.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<IntelOptions
CompilerName="1"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\src"
PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE,_WINDOWS"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\Release/TestBase64Client.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0">
<IntelOptions
Optimization="2"
InlineFuncExpansion="1"
OmitFramePtrs="1"
StringPooling="1"
RuntimeLibrary="2"
BufferSecurityCheck="1"
FunctionLevelLinking="1"
AllOptions="/c /I &quot;..\src&quot; /nologo /W3 /O2 /Ob1 /Oy /D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_WINDOWS&quot; /D &quot;_MBCS&quot; /GF /FD /EHsc /MD /GS /Gy /Fp&quot;.\Release/TestBase64Client.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd"/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib"
OutputFile=".\Release/TestBase64Client.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\release"
ProgramDatabaseFile=".\Release/TestBase64Client.pdb"
SubSystem="1">
<IntelOptions
AllOptions="/NOLOGO /OUT:&quot;.\Release/TestBase64Client.exe&quot; /INCREMENTAL:NO /LIBPATH:&quot;..\release&quot; xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib /PDB:&quot;.\Release/TestBase64Client.pdb&quot; /SUBSYSTEM:CONSOLE /TLBID:1 /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
</Tool>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/TestBase64Client.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<IntelOptions
CompilerName="1"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath=".\TestBase64Client.cpp"/>
</Filter>
</Files>
<Globals/>
</VisualStudioProject>

View File

@@ -0,0 +1,68 @@
// TestBase64Server.cpp : Simple XMLRPC server example. Usage: TestBase64Server serverPort
//
#if defined(_MSC_VER)
# pragma warning(disable:4786) // identifier was truncated in debug info
#endif
#include <iostream>
#include <fstream>
#include <algorithm>
#include <stdlib.h>
#include "xmlrpcpp/XmlRpc.h"
using namespace XmlRpc;
// The server
XmlRpcServer s;
// No arguments, result is Base64-encoded pngnow.png data.
class TestBase64 : public XmlRpcServerMethod
{
public:
TestBase64(XmlRpcServer* s) : XmlRpcServerMethod("TestBase64", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
std::ifstream infile("pngnow.png", std::ios::binary);
if (infile.fail())
infile.open("../pngnow.png", std::ios::binary);
if (infile.fail())
result = "Could not open file pngnow.png";
else {
XmlRpcValue::BinaryData& data = result;
int n = 0;
for (;; ++n) {
char c = infile.get();
if (infile.eof()) break;
data.push_back(c);
}
std::cerr << "Read " << n << " bytes from pngnow.png\n";
}
}
} TestBase64(&s); // This constructor registers the method with the server
int main(int argc, char* argv[])
{
if (argc != 2) {
std::cerr << "Usage: TestBase64Server serverPort\n";
return -1;
}
int port = atoi(argv[1]);
//XmlRpc::setVerbosity(5);
// Create the server socket on the specified port
s.bindAndListen(port);
// Wait for requests indefinitely
s.work(-1.0);
return 0;
}

View File

@@ -0,0 +1,96 @@
# Microsoft Developer Studio Project File - Name="TestBase64Server" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=TestBase64Server - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "TestBase64Server.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "TestBase64Server.mak" CFG="TestBase64Server - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "TestBase64Server - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "TestBase64Server - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "TestBase64Server - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\src" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /Fr /YX /Yc /Yu
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 xmlrpc.lib Ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\release"
!ELSEIF "$(CFG)" == "TestBase64Server - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\src" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 xmlrpc.lib Ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
!ENDIF
# Begin Target
# Name "TestBase64Server - Win32 Release"
# Name "TestBase64Server - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\TestBase64Server.cpp
# End Source File
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,158 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="TestBase64Server"
ProjectGUID="{D3107CC6-6300-47DE-B183-255B75CFE85A}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\src"
PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE,_WINDOWS"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\Release/TestBase64Server.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0">
<IntelOptions
Optimization="2"
InlineFuncExpansion="1"
OmitFramePtrs="1"
StringPooling="1"
RuntimeLibrary="2"
BufferSecurityCheck="1"
FunctionLevelLinking="1"
AllOptions="/c /I &quot;..\src&quot; /nologo /W3 /O2 /Ob1 /Oy /D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_WINDOWS&quot; /D &quot;_MBCS&quot; /GF /FD /EHsc /MD /GS /Gy /Fp&quot;.\Release/TestBase64Server.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd"/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib"
OutputFile=".\Release/TestBase64Server.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\release"
ProgramDatabaseFile=".\Release/TestBase64Server.pdb"
SubSystem="1">
<IntelOptions
AllOptions="/NOLOGO /OUT:&quot;.\Release/TestBase64Server.exe&quot; /INCREMENTAL:NO /LIBPATH:&quot;..\release&quot; xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib /PDB:&quot;.\Release/TestBase64Server.pdb&quot; /SUBSYSTEM:CONSOLE /TLBID:1 /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
</Tool>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/TestBase64Server.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<IntelOptions
CompilerName="1"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\src"
PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE,_WINDOWS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Debug/TestBase64Server.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0">
<IntelOptions
Optimization="0"
MinimalRebuild="1"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
AllOptions="/c /I &quot;..\src&quot; /ZI /nologo /W3 /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_WINDOWS&quot; /D &quot;_MBCS&quot; /Gm /EHsc /RTC1 /MDd /Fp&quot;.\Debug/TestBase64Server.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd"/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib"
OutputFile=".\Debug/TestBase64Server.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\Debug"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/TestBase64Server.pdb"
SubSystem="1">
<IntelOptions
AllOptions="/NOLOGO /OUT:&quot;.\Debug/TestBase64Server.exe&quot; /INCREMENTAL /LIBPATH:&quot;..\Debug&quot; xmlrpc.lib Ws2_32.lib odbc32.lib odbccp32.lib /DEBUG /PDB:&quot;.\Debug/TestBase64Server.pdb&quot; /SUBSYSTEM:CONSOLE /TLBID:1 /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
</Tool>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/TestBase64Server.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<IntelOptions
CompilerName="1"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath=".\TestBase64Server.cpp"/>
</Filter>
</Files>
<Globals/>
</VisualStudioProject>

View File

@@ -0,0 +1,233 @@
// TestValues.cpp : Test XML encoding and decoding of XmlRpcValues.
#include <stdlib.h>
#include "xmlrpcpp/XmlRpcValue.h"
#include <assert.h>
#include <iostream>
using namespace XmlRpc;
void testBoolean()
{
XmlRpcValue booleanFalse(false);
XmlRpcValue booleanTrue(true);
int offset = 0;
XmlRpcValue booleanFalseXml("<value><boolean>0</boolean></value>", &offset);
offset = 0;
XmlRpcValue booleanTrueXml("<value><boolean>1</boolean></value>", &offset);
assert(booleanFalse != booleanTrue);
assert(booleanFalse == booleanFalseXml);
assert(booleanFalse != booleanTrueXml);
if (bool(booleanFalse))
assert(false);
if ( ! bool(booleanTrue))
assert(false);
}
// Int
void testInt()
{
XmlRpcValue int0(0);
XmlRpcValue int1(1);
XmlRpcValue int10(10);
XmlRpcValue int_1(-1);
int offset = 0;
XmlRpcValue int0Xml("<value><int>0</int></value>", &offset);
offset = 0;
XmlRpcValue int9Xml("<value><i4>9</i4></value>", &offset);
assert(int0 == int0Xml);
assert(int(int10) - int(int1) == int(int9Xml));
assert(9 == int(int9Xml));
assert(int(int10) + int(int_1) == int(int9Xml));
}
void testDouble()
{
// Double
XmlRpcValue d(43.7);
int offset = 0;
XmlRpcValue dXml("<value><double>56.3</double></value>", &offset);
assert(double(d) + double(dXml) == 100.0); // questionable practice...
}
void testString()
{
// String
XmlRpcValue s("Now is the time <&");
char csxml[] = "<value><string>Now is the time &lt;&amp;</string></value>";
std::string ssxml = csxml;
int offset = 0;
XmlRpcValue vscXml(csxml, &offset);
offset = 0;
XmlRpcValue vssXml(ssxml, &offset);
assert(s == vscXml);
assert(s == vssXml);
offset = 0;
XmlRpcValue fromXml(vssXml.toXml(), &offset);
assert(s == fromXml);
// Empty or blank strings with no <string> tags
std::string emptyStringXml("<value></value>");
offset = 0;
XmlRpcValue emptyStringVal1(emptyStringXml, &offset);
XmlRpcValue emptyStringVal2("");
assert(emptyStringVal1 == emptyStringVal2);
emptyStringXml = "<value> </value>";
offset = 0;
XmlRpcValue blankStringVal(emptyStringXml, &offset);
assert(std::string(blankStringVal) == " ");
}
void testDateTime()
{
// DateTime
int offset = 0;
XmlRpcValue dateTime("<value><dateTime.iso8601>19040101T03:12:35</dateTime.iso8601></value>", &offset);
struct tm &t = dateTime;
assert(t.tm_year == 1904 && t.tm_min == 12);
}
void testArray(XmlRpcValue const& d)
{
// Array
XmlRpcValue a;
a.setSize(4);
a[0] = 1;
a[1] = std::string("two");
a[2] = 43.7;
a[3] = "four";
assert(int(a[0]) == 1);
assert(a[2] == d);
char csaXml[] =
"<value><array>\n"
" <data>\n"
" <value><i4>1</i4></value> \n"
" <value> <string>two</string></value>\n"
" <value><double>43.7</double></value>\n"
" <value>four</value>\n"
" </data>\n"
"</array></value>";
int offset = 0;
XmlRpcValue aXml(csaXml, &offset);
assert(a == aXml);
}
void testStruct()
{
// Struct
XmlRpcValue struct1;
struct1["i4"] = 1;
struct1["str"] = "two";
struct1["d"] = 43.7;
XmlRpcValue a;
a.setSize(4);
a[0] = 1;
a[1] = std::string("two");
a[2] = 43.7;
a[3] = "four";
assert(struct1["d"] == a[2]);
char csStructXml[] =
"<value><struct>\n"
" <member>\n"
" <name>i4</name> \n"
" <value><i4>1</i4></value> \n"
" </member>\n"
" <member>\n"
" <name>d</name> \n"
" <value><double>43.7</double></value>\n"
" </member>\n"
" <member>\n"
" <name>str</name> \n"
" <value> <string>two</string></value>\n"
" </member>\n"
"</struct></value>";
int offset = 0;
XmlRpcValue structXml(csStructXml, &offset);
assert(struct1 == structXml);
XmlRpcValue astruct;
astruct["array"] = a;
assert(astruct["array"][2] == struct1["d"]);
for (int i=0; i<10; i++) {
XmlRpcValue Event;
Event["Name"] = "string";
Event.clear();
const int NELMTS = 100;
int ii;
for (ii=0; ii< NELMTS; ++ii) {
char buf[40];
sprintf(buf,"%d", ii);
Event[std::string(buf)] = buf;
}
Event.clear();
for (ii=0; ii< NELMTS; ++ii) {
char buf[40];
sprintf(buf,"%d", ii);
if (ii != NELMTS/2)
Event[std::string(buf)] = ii;
else
for (int jj=0; jj< NELMTS; ++jj) {
char bufj[40];
sprintf(bufj,"%d", jj);
Event[std::string(buf)][std::string(bufj)] = bufj;
}
}
for (ii=0; ii< NELMTS; ++ii) {
char buf[40];
sprintf(buf,"%d", ii);
if (ii != NELMTS/2)
assert(Event[std::string(buf)] == XmlRpcValue(ii));
else
assert(Event[std::string(buf)].size() == NELMTS);
}
}
}
int main(int argc, char* argv[])
{
testBoolean();
testInt();
testDouble();
testString();
testDateTime();
testArray(43.7);
testStruct();
return 0;
}

View File

@@ -0,0 +1,95 @@
# Microsoft Developer Studio Project File - Name="TestValues" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=TestValues - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "TestValues.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "TestValues.mak" CFG="TestValues - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "TestValues - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "TestValues - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "TestValues - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\src" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 xmlrpc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release"
!ELSEIF "$(CFG)" == "TestValues - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /MDd /W3 /GX /Zi /Od /I "..\src" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FR /FD /c
# SUBTRACT CPP /nologo
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 xmlrpc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
!ENDIF
# Begin Target
# Name "TestValues - Win32 Release"
# Name "TestValues - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\TestValuesWin32.cpp
# End Source File
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,156 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="TestValues"
ProjectGUID="{6181BBE3-DA50-4EEE-8D52-1F4245A1D603}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Release/TestValues.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE">
<IntelOptions
Optimization="2"
InlineFuncExpansion="1"
OmitFramePtrs="1"
StringPooling="1"
RuntimeLibrary="2"
BufferSecurityCheck="1"
FunctionLevelLinking="1"
AllOptions="/c /nologo /W3 /O2 /Ob1 /Oy /D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_MBCS&quot; /GF /FD /EHsc /MD /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/TestValues.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TP"/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib"
OutputFile=".\Release/TestValues.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\Release/TestValues.pdb"
SubSystem="1">
<IntelOptions
AllOptions="/NOLOGO /OUT:&quot;.\Release/TestValues.exe&quot; /INCREMENTAL:NO odbc32.lib odbccp32.lib /PDB:&quot;.\Release/TestValues.pdb&quot; /SUBSYSTEM:CONSOLE /TLBID:1 /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
</Tool>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/TestValues.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<IntelOptions
CompilerName="1"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\src"
PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE,_WINDOWS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Debug/TestValues.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0">
<IntelOptions
Optimization="0"
MinimalRebuild="1"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
AllOptions="/c /I &quot;..\src&quot; /ZI /nologo /W3 /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_WINDOWS&quot; /D &quot;_MBCS&quot; /Gm /EHsc /RTC1 /MDd /Fp&quot;.\Debug/TestValues.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd"/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="xmlrpc.lib odbc32.lib odbccp32.lib"
OutputFile=".\Debug/TestValues.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\Debug"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/TestValues.pdb"
SubSystem="1">
<IntelOptions
AllOptions="/NOLOGO /OUT:&quot;.\Debug/TestValues.exe&quot; /INCREMENTAL /LIBPATH:&quot;..\Debug&quot; xmlrpc.lib odbc32.lib odbccp32.lib /DEBUG /PDB:&quot;.\Debug/TestValues.pdb&quot; /SUBSYSTEM:CONSOLE /TLBID:1 /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
</Tool>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/TestValues.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<IntelOptions
CompilerName="1"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath=".\TestValues.cpp"/>
</Filter>
</Files>
<Globals/>
</VisualStudioProject>

View File

@@ -0,0 +1,253 @@
// TestValues.cpp : Test XML encoding and decoding of XmlRpcValues.
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#include "xmlrpcpp/XmlRpcValue.h"
#include <assert.h>
#include <iostream>
using namespace XmlRpc;
void testBoolean()
{
XmlRpcValue booleanFalse(false);
XmlRpcValue booleanTrue(true);
int offset = 0;
XmlRpcValue booleanFalseXml("<value><boolean>0</boolean></value>", &offset);
offset = 0;
XmlRpcValue booleanTrueXml("<value><boolean>1</boolean></value>", &offset);
assert(booleanFalse != booleanTrue);
assert(booleanFalse == booleanFalseXml);
assert(booleanFalse == booleanFalseXml);
if (booleanFalse)
assert(false);
if (booleanTrue)
assert( ! false);
else
assert(false);
}
// Int
void testInt()
{
XmlRpcValue int0(0);
XmlRpcValue int1(1);
XmlRpcValue int10(10);
XmlRpcValue int_1(-1);
int offset = 0;
XmlRpcValue int0Xml("<value><int>0</int></value>", &offset);
offset = 0;
XmlRpcValue int9Xml("<value><i4>9</i4></value>", &offset);
assert(int0 == int0Xml);
assert(int(int10) - int(int1) == int(int9Xml));
assert(9 == int(int9Xml));
assert(int(int10) + int(int_1) == int(int9Xml));
}
void testDouble()
{
// Double
XmlRpcValue d(43.7);
int offset = 0;
XmlRpcValue dXml("<value><double>56.3</double></value>", &offset);
assert(double(d) + double(dXml) == 100.0); // questionable practice...
}
void testString()
{
// String
XmlRpcValue s("Now is the time <&");
char csxml[] = "<value><string>Now is the time &lt;&amp;</string></value>";
std::string ssxml = csxml;
int offset = 0;
XmlRpcValue vscXml(csxml, &offset);
offset = 0;
XmlRpcValue vssXml(ssxml, &offset);
assert(s == vscXml);
assert(s == vssXml);
offset = 0;
XmlRpcValue fromXml(vssXml.toXml(), &offset);
assert(s == fromXml);
// Empty or blank strings with no <string> tags
std::string emptyStringXml("<value></value>");
offset = 0;
XmlRpcValue emptyStringVal1(emptyStringXml, &offset);
XmlRpcValue emptyStringVal2("");
assert(emptyStringVal1 == emptyStringVal2);
emptyStringXml = "<value> </value>";
offset = 0;
XmlRpcValue blankStringVal(emptyStringXml, &offset);
assert(std::string(blankStringVal) == " ");
}
void testDateTime()
{
// DateTime
int offset = 0;
XmlRpcValue dateTime("<value><dateTime.iso8601>19040101T03:12:35</dateTime.iso8601></value>", &offset);
struct tm &t = dateTime;
assert(t.tm_year == 1904 && t.tm_min == 12);
}
void testArray(XmlRpcValue const& d)
{
// Array
XmlRpcValue a;
a.setSize(4);
a[0] = 1;
a[1] = std::string("two");
a[2] = 43.7;
a[3] = "four";
assert(int(a[0]) == 1);
assert(a[2] == d);
char csaXml[] =
"<value><array>\n"
" <data>\n"
" <value><i4>1</i4></value> \n"
" <value> <string>two</string></value>\n"
" <value><double>43.7</double></value>\n"
" <value>four</value>\n"
" </data>\n"
"</array></value>";
int offset = 0;
XmlRpcValue aXml(csaXml, &offset);
assert(a == aXml);
}
void testStruct()
{
// Struct
XmlRpcValue struct1;
struct1["i4"] = 1;
struct1["str"] = "two";
struct1["d"] = 43.7;
XmlRpcValue a;
a.setSize(4);
a[0] = 1;
a[1] = std::string("two");
a[2] = 43.7;
a[3] = "four";
assert(struct1["d"] == a[2]);
char csStructXml[] =
"<value><struct>\n"
" <member>\n"
" <name>i4</name> \n"
" <value><i4>1</i4></value> \n"
" </member>\n"
" <member>\n"
" <name>d</name> \n"
" <value><double>43.7</double></value>\n"
" </member>\n"
" <member>\n"
" <name>str</name> \n"
" <value> <string>two</string></value>\n"
" </member>\n"
"</struct></value>";
int offset = 0;
XmlRpcValue structXml(csStructXml, &offset);
assert(struct1 == structXml);
XmlRpcValue astruct;
astruct["array"] = a;
assert(astruct["array"][2] == struct1["d"]);
for (int i=0; i<10; i++) {
XmlRpcValue Event;
Event["Name"] = "string";
Event.clear();
const int NELMTS = 100;
int ii;
for (ii=0; ii< NELMTS; ++ii) {
char buf[40];
sprintf(buf,"%d", ii);
Event[buf] = buf;
}
Event.clear();
for (ii=0; ii< NELMTS; ++ii) {
char buf[40];
sprintf(buf,"%d", ii);
if (ii != NELMTS/2)
Event[buf] = ii;
else
for (int jj=0; jj< NELMTS; ++jj) {
char bufj[40];
sprintf(bufj,"%d", jj);
Event[buf][bufj] = bufj;
}
}
for (ii=0; ii< NELMTS; ++ii) {
char buf[40];
sprintf(buf,"%d", ii);
if (ii != NELMTS/2)
assert(Event[buf] == XmlRpcValue(ii));
else
assert(Event[buf].size() == NELMTS);
}
}
}
int main(int argc, char* argv[])
{
_CrtDumpMemoryLeaks();
_CrtCheckMemory( );
testBoolean();
_CrtDumpMemoryLeaks();
_CrtCheckMemory( );
testInt();
_CrtDumpMemoryLeaks();
_CrtCheckMemory( );
testDouble();
_CrtDumpMemoryLeaks();
_CrtCheckMemory( );
testString();
_CrtDumpMemoryLeaks();
_CrtCheckMemory( );
testDateTime();
_CrtDumpMemoryLeaks();
_CrtCheckMemory( );
testArray(43.7);
_CrtDumpMemoryLeaks();
_CrtCheckMemory( );
testStruct();
_CrtDumpMemoryLeaks();
_CrtCheckMemory( );
return 0;
}

View File

@@ -0,0 +1,53 @@
// TestXml.cpp : Test XML encoding and decoding.
// The characters <>&'" are illegal in xml and must be encoded.
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <iostream>
// If you are using MSVC++6, you should update <string> to fix
// BUG: getline Template Function Reads Extra Character
#include <string>
#include <assert.h>
#include <stdlib.h>
#include "xmlrpcpp/XmlRpcUtil.h"
using namespace XmlRpc;
int main(int argc, char* argv[])
{
// Basic tests
std::string empty;
assert(empty == XmlRpcUtil::xmlEncode(empty));
assert(empty == XmlRpcUtil::xmlDecode(empty));
assert(empty == XmlRpcUtil::xmlEncode(""));
assert(empty == XmlRpcUtil::xmlDecode(""));
std::string raw("<>&'\"");
assert(XmlRpcUtil::xmlDecode(XmlRpcUtil::xmlEncode(raw)) == raw);
std::cout << "Basic tests passed.\n";
// Interactive tests
std::string s;
for (;;) {
std::cout << "\nEnter line of raw text to encode:\n";
std::getline(std::cin, s);
if (s.empty()) break;
std::cout << XmlRpcUtil::xmlEncode(s) << std::endl;
}
for (;;) {
std::cout << "\nEnter line of xml-encoded text to decode:\n";
std::getline(std::cin, s);
if (s.empty()) break;
std::cout << XmlRpcUtil::xmlDecode(s) << std::endl;
}
return 0;
}

View File

@@ -0,0 +1,96 @@
# Microsoft Developer Studio Project File - Name="TestXml" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=TestXml - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "TestXml.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "TestXml.mak" CFG="TestXml - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "TestXml - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "TestXml - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "TestXml - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\src" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 xmlrpc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\release"
!ELSEIF "$(CFG)" == "TestXml - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\src" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 xmlrpc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
!ENDIF
# Begin Target
# Name "TestXml - Win32 Release"
# Name "TestXml - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\TestXml.cpp
# End Source File
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,158 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="TestXml"
ProjectGUID="{6F0C2ADA-0341-4183-8FAA-576668F1788A}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\src"
PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\Release/TestXml.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0">
<IntelOptions
Optimization="2"
InlineFuncExpansion="1"
OmitFramePtrs="1"
StringPooling="1"
RuntimeLibrary="2"
BufferSecurityCheck="1"
FunctionLevelLinking="1"
AllOptions="/c /I &quot;..\src&quot; /nologo /W3 /O2 /Ob1 /Oy /D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_MBCS&quot; /GF /FD /EHsc /MD /GS /Gy /Fp&quot;.\Release/TestXml.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd"/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="xmlrpc.lib odbc32.lib odbccp32.lib"
OutputFile=".\Release/TestXml.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\release"
ProgramDatabaseFile=".\Release/TestXml.pdb"
SubSystem="1">
<IntelOptions
AllOptions="/NOLOGO /OUT:&quot;.\Release/TestXml.exe&quot; /INCREMENTAL:NO /LIBPATH:&quot;..\release&quot; xmlrpc.lib odbc32.lib odbccp32.lib /PDB:&quot;.\Release/TestXml.pdb&quot; /SUBSYSTEM:CONSOLE /TLBID:1 /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
</Tool>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/TestXml.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<IntelOptions
CompilerName="1"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\src"
PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Debug/TestXml.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0">
<IntelOptions
Optimization="0"
MinimalRebuild="1"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
AllOptions="/c /I &quot;..\src&quot; /ZI /nologo /W3 /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_MBCS&quot; /Gm /EHsc /RTC1 /MDd /Fp&quot;.\Debug/TestXml.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd"/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="xmlrpc.lib odbc32.lib odbccp32.lib"
OutputFile=".\Debug/TestXml.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\Debug"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/TestXml.pdb"
SubSystem="1">
<IntelOptions
AllOptions="/NOLOGO /OUT:&quot;.\Debug/TestXml.exe&quot; /INCREMENTAL /LIBPATH:&quot;..\Debug&quot; xmlrpc.lib odbc32.lib odbccp32.lib /DEBUG /PDB:&quot;.\Debug/TestXml.pdb&quot; /SUBSYSTEM:CONSOLE /TLBID:1 /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
</Tool>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/TestXml.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<IntelOptions
CompilerName="1"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath=".\TestXml.cpp"/>
</Filter>
</Files>
<Globals/>
</VisualStudioProject>

View File

@@ -0,0 +1,207 @@
// Validator.cpp : XMLRPC server based on the compliancy test at validator.xmlrpc.com.
//
#include "xmlrpcpp/XmlRpc.h"
using namespace XmlRpc;
#include <iostream>
XmlRpcServer s;
// One argument is passed, an array of structs, each with a member named curly with
// an integer value. Return the sum of those values.
class ArrayOfStructsTest : public XmlRpcServerMethod
{
public:
ArrayOfStructsTest(XmlRpcServer* s) : XmlRpcServerMethod("validator1.arrayOfStructsTest", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
std::cerr << "ArrayOfStructsTest\n";
XmlRpcValue& arg1 = params[0];
int n = arg1.size(), sum = 0;
for (int i=0; i<n; ++i)
sum += int(arg1[i]["curly"]);
result = sum;
}
} arrayOfStructsTest(&s);
// This handler takes a single parameter, a string, that contains any number of predefined
// entities, namely <, >, &, ' and ".
// The handler must return a struct that contains five fields, all numbers: ctLeftAngleBrackets,
// ctRightAngleBrackets, ctAmpersands, ctApostrophes, ctQuotes.
// To validate, the numbers must be correct.
class CountTheEntities : public XmlRpcServerMethod
{
public:
CountTheEntities(XmlRpcServer* s) : XmlRpcServerMethod("validator1.countTheEntities", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
std::cerr << "CountTheEntities\n";
std::string& arg = params[0];
int ctLeftAngleBrackets = 0;
int ctRightAngleBrackets = 0;
int ctAmpersands = 0;
int ctApostrophes = 0;
int ctQuotes = 0;
int n = int(arg.length());
for (int i=0; i<n; ++i)
switch (arg[i])
{
case '<': ++ctLeftAngleBrackets; break;
case '>': ++ctRightAngleBrackets; break;
case '&': ++ctAmpersands; break;
case '\'': ++ctApostrophes; break;
case '\"': ++ctQuotes; break;
}
result["ctLeftAngleBrackets"] = ctLeftAngleBrackets;
result["ctRightAngleBrackets"] = ctRightAngleBrackets;
result["ctAmpersands"] = ctAmpersands;
result["ctApostrophes"] = ctApostrophes;
result["ctQuotes"] = ctQuotes;
}
} countTheEntities(&s);
// This handler takes a single parameter, a struct, containing at least three elements
// named moe, larry and curly, all <i4>s. Your handler must add the three numbers and
// return the result.
class EasyStructTest : public XmlRpcServerMethod
{
public:
EasyStructTest(XmlRpcServer* s) : XmlRpcServerMethod("validator1.easyStructTest", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
std::cerr << "EasyStructTest\n";
XmlRpcValue& arg1 = params[0];
int sum = int(arg1["moe"]) + int(arg1["larry"]) + int(arg1["curly"]);
result = sum;
}
} easyStructTest(&s);
// This handler takes a single parameter, a struct. Your handler must return the struct.
class EchoStructTest : public XmlRpcServerMethod
{
public:
EchoStructTest(XmlRpcServer* s) : XmlRpcServerMethod("validator1.echoStructTest", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
std::cerr << "EchoStructTest\n";
result = params[0];
}
} echoStructTest(&s);
// This handler takes six parameters, and returns an array containing all the parameters.
class ManyTypesTest : public XmlRpcServerMethod
{
public:
ManyTypesTest(XmlRpcServer* s) : XmlRpcServerMethod("validator1.manyTypesTest", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
std::cerr << "ManyTypesTest\n";
result = params;
}
} manyTypesTest(&s);
// This handler takes a single parameter, which is an array containing between 100 and
// 200 elements. Each of the items is a string, your handler must return a string
// containing the concatenated text of the first and last elements.
class ModerateSizeArrayCheck : public XmlRpcServerMethod
{
public:
ModerateSizeArrayCheck(XmlRpcServer* s) : XmlRpcServerMethod("validator1.moderateSizeArrayCheck", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
std::cerr << "ModerateSizeArrayCheck\n";
std::string s = params[0][0];
s += std::string(params[0][params[0].size()-1]);
result = s;
}
} moderateSizeArrayCheck(&s);
// This handler takes a single parameter, a struct, that models a daily calendar.
// At the top level, there is one struct for each year. Each year is broken down
// into months, and months into days. Most of the days are empty in the struct
// you receive, but the entry for April 1, 2000 contains a least three elements
// named moe, larry and curly, all <i4>s. Your handler must add the three numbers
// and return the result.
class NestedStructTest : public XmlRpcServerMethod
{
public:
NestedStructTest(XmlRpcServer* s) : XmlRpcServerMethod("validator1.nestedStructTest", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
std::cerr << "NestedStructTest\n";
XmlRpcValue& dayStruct = params[0]["2000"]["04"]["01"];
int sum = int(dayStruct["moe"]) + int(dayStruct["larry"]) + int(dayStruct["curly"]);
result = sum;
}
} nestedStructTest(&s);
// This handler takes one parameter, and returns a struct containing three elements,
// times10, times100 and times1000, the result of multiplying the number by 10, 100 and 1000.
class SimpleStructReturnTest : public XmlRpcServerMethod
{
public:
SimpleStructReturnTest(XmlRpcServer* s) : XmlRpcServerMethod("validator1.simpleStructReturnTest", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
std::cerr << "SimpleStructReturnTest\n";
int n = params[0];
result["times10"] = n * 10;
result["times100"] = n * 100;
result["times1000"] = n * 1000;
}
} simpleStructReturnTest(&s);
int main(int argc, char* argv[])
{
if (argc != 2) {
std::cerr << "Usage: Validator port\n";
return -1;
}
int port = atoi(argv[1]);
XmlRpc::setVerbosity(5);
// Create the server socket on the specified port
s.bindAndListen(port);
// Wait for requests indefinitely
s.work(-1.0);
return 0;
}

View File

@@ -0,0 +1,95 @@
# Microsoft Developer Studio Project File - Name="Validator" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=Validator - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Validator.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Validator.mak" CFG="Validator - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Validator - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "Validator - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "Validator - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /Zd /O2 /I "..\src" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 xmlrpc.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\release"
!ELSEIF "$(CFG)" == "Validator - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\src" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 xmlrpc.lib WS2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\debug"
!ENDIF
# Begin Target
# Name "Validator - Win32 Release"
# Name "Validator - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\Validator.cpp
# End Source File
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,157 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="Validator"
ProjectGUID="{E68AB694-4805-43EA-A96E-21B8FE285DE4}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE,_WINDOWS"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\Release/Validator.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE">
<IntelOptions
Optimization="2"
InlineFuncExpansion="1"
OmitFramePtrs="1"
StringPooling="1"
RuntimeLibrary="2"
BufferSecurityCheck="1"
FunctionLevelLinking="1"
AllOptions="/c /nologo /W3 /O2 /Ob1 /Oy /D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_WINDOWS&quot; /D &quot;_MBCS&quot; /GF /FD /EHsc /MD /GS /Gy /Yu&quot;stdafx.h&quot; /Fp&quot;.\Release/Validator.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TP"/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib"
OutputFile=".\Release/Validator.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\Release/Validator.pdb"
SubSystem="1">
<IntelOptions
AllOptions="/NOLOGO /OUT:&quot;.\Release/Validator.exe&quot; /INCREMENTAL:NO odbc32.lib odbccp32.lib /PDB:&quot;.\Release/Validator.pdb&quot; /SUBSYSTEM:CONSOLE /TLBID:1 /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
</Tool>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/Validator.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<IntelOptions
CompilerName="1"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\src"
PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE,_WINDOWS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Debug/Validator.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0">
<IntelOptions
Optimization="0"
MinimalRebuild="1"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
AllOptions="/c /I &quot;..\src&quot; /ZI /nologo /W3 /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_WINDOWS&quot; /D &quot;_MBCS&quot; /Gm /EHsc /RTC1 /MDd /Fp&quot;.\Debug/Validator.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd"/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="xmlrpc.lib WS2_32.lib odbc32.lib odbccp32.lib"
OutputFile=".\Debug/Validator.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\debug"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/Validator.pdb"
SubSystem="1">
<IntelOptions
AllOptions="/NOLOGO /OUT:&quot;.\Debug/Validator.exe&quot; /INCREMENTAL /LIBPATH:&quot;..\debug&quot; xmlrpc.lib WS2_32.lib odbc32.lib odbccp32.lib /DEBUG /PDB:&quot;.\Debug/Validator.pdb&quot; /SUBSYSTEM:CONSOLE /TLBID:1 /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
</Tool>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/Validator.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<IntelOptions
CompilerName="1"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath=".\Validator.cpp"/>
</Filter>
</Files>
<Globals/>
</VisualStudioProject>

View File

@@ -0,0 +1,255 @@
<?xml version="1.0"?>
<methodCall>
<methodName>validator1.arrayOfStructsTest</methodName>
<params>
<param>
<value><array>
<data>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-84</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>87</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>77</i4>
</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-46</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>27</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>33</i4>
</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-70</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>89</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>30</i4>
</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-90</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>42</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>6</i4>
</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-28</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>96</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>92</i4>
</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-31</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>81</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>85</i4>
</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-18</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>62</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>9</i4>
</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-98</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>79</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>66</i4>
</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-3</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>59</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>80</i4>
</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-83</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>27</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>19</i4>
</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-85</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>4</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>16</i4>
</value>
</member>
</struct>
</value>
</data>
</array></value>
</param>
</params>
</methodCall>

View File

@@ -0,0 +1,21 @@
// bool_test.cpp : make sure bool variables copy around ok
#include "xmlrpcpp/XmlRpc.h"
#include <iostream>
#include <stdlib.h>
using namespace XmlRpc;
using namespace std;
int main(int argc, char* argv[])
{
XmlRpcValue v(bool(false));
cout << v.toXml() << endl;
XmlRpcValue v2;
v2[0] = int(1);
v2[1] = string();
v2[2] = XmlRpcValue(false);
cout << v2.toXml() << endl;
return 0;
}

View File

@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<methodCall>
<methodName>validator1.countTheEntities</methodName>
<params>
<param>
<value>&'<p"dgt"&>'<&"'<s>>ehv<j><>iu'<<<y"'>qo>"z"f<l&'"akn<&r'c'wbm&&x''</value>
</param>
</params>
</methodCall>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0"?>
<methodCall>
<methodName>validator1.easyStructTest</methodName>
<params>
<param>
<value><struct>
<member>
<name>curly</name>
<value>
<i4>-78</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>23</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>38</i4>
</value>
</member>
</struct></value>
</param>
</params>
</methodCall>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<methodCall>
<methodName>echo</methodName>
<params>
<param><value><string>Hello Chris</string></value></param>
<param><value><i4>123</i4></value></param>
</params>
</methodCall>

View File

@@ -0,0 +1,261 @@
<?xml version="1.0"?>
<methodCall>
<methodName>validator1.echoStructTest</methodName>
<params>
<param>
<value><struct>
<member>
<name>substruct0</name>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-76</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>31</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>44</i4>
</value>
</member>
</struct>
</value>
</member>
<member>
<name>substruct1</name>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-9</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>42</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>57</i4>
</value>
</member>
</struct>
</value>
</member>
<member>
<name>substruct2</name>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-15</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>69</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>78</i4>
</value>
</member>
</struct>
</value>
</member>
<member>
<name>substruct3</name>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-91</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>66</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>4</i4>
</value>
</member>
</struct>
</value>
</member>
<member>
<name>substruct4</name>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-47</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>66</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>8</i4>
</value>
</member>
</struct>
</value>
</member>
<member>
<name>substruct5</name>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-68</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>26</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>87</i4>
</value>
</member>
</struct>
</value>
</member>
<member>
<name>substruct6</name>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-59</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>20</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>74</i4>
</value>
</member>
</struct>
</value>
</member>
<member>
<name>substruct7</name>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-57</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>30</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>75</i4>
</value>
</member>
</struct>
</value>
</member>
<member>
<name>substruct8</name>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-34</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>33</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>30</i4>
</value>
</member>
</struct>
</value>
</member>
<member>
<name>substruct9</name>
<value>
<struct>
<member>
<name>curly</name>
<value>
<i4>-64</i4>
</value>
</member>
<member>
<name>larry</name>
<value>
<i4>98</i4>
</value>
</member>
<member>
<name>moe</name>
<value>
<i4>17</i4>
</value>
</member>
</struct>
</value>
</member>
</struct></value>
</param>
</params>
</methodCall>

View File

@@ -0,0 +1 @@
‰PNG

View File

@@ -0,0 +1,76 @@
// HelloServer.cpp : Simple XMLRPC server example. Usage: HelloServer serverPort
//
#include "xmlrpcpp/XmlRpc.h"
#include <iostream>
#include <stdlib.h>
using namespace XmlRpc;
// The server
XmlRpcServer s;
// No arguments, result is "Hello".
class Hello : public XmlRpcServerMethod
{
public:
Hello(XmlRpcServer* s) : XmlRpcServerMethod("Hello", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
result = "Hello";
}
std::string help() { return std::string("Say hello"); }
} hello(&s); // This constructor registers the method with the server
// One argument is passed, result is "Hello, " + arg.
class HelloName : public XmlRpcServerMethod
{
public:
HelloName(XmlRpcServer* s) : XmlRpcServerMethod("HelloName", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
std::string resultString = "Hello, ";
resultString += std::string(params[0]);
result = resultString;
}
} helloName(&s);
// A variable number of arguments are passed, all doubles, result is their sum.
class Sum : public XmlRpcServerMethod
{
public:
Sum(XmlRpcServer* s) : XmlRpcServerMethod("Sum", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
int nArgs = params.size();
double sum = 0.0;
for (int i=0; i<nArgs; ++i)
sum += double(params[i]);
result = sum;
}
} sum(&s);
int main(int argc, char* argv[])
{
XmlRpc::setVerbosity(5);
// Create the server socket on the specified port
s.bindAndListen(0);
// Enable introspection
s.enableIntrospection(true);
// Wait for requests indefinitely
s.work(-1.0);
return 0;
}