mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-06 06:30:19 +00:00
9d51d547e2
PR: ports/63752 Submitted by: Ports Fury
171 lines
6.1 KiB
Plaintext
171 lines
6.1 KiB
Plaintext
--- tools/xml-rpc-api2cpp/xml-rpc-api2cpp.cc.orig Thu Apr 12 08:21:38 2001
|
|
+++ tools/xml-rpc-api2cpp/xml-rpc-api2cpp.cc Tue Mar 2 23:39:39 2004
|
|
@@ -1,4 +1,4 @@
|
|
-#include <iostream.h>
|
|
+#include <iostream>
|
|
#include <stdexcept>
|
|
|
|
#include <XmlRpcCpp.h>
|
|
@@ -17,9 +17,9 @@
|
|
// Connect to a remote server and extract the information we'll need to
|
|
// build a proxy class.
|
|
|
|
-XmlRpcClass get_class_info (string server_url,
|
|
- string class_prefix,
|
|
- string class_name)
|
|
+XmlRpcClass get_class_info (std::string server_url,
|
|
+ std::string class_prefix,
|
|
+ std::string class_name)
|
|
{
|
|
// Create a place to store our data.
|
|
XmlRpcClass info(class_name);
|
|
@@ -33,22 +33,22 @@
|
|
for (size_t i = 0; i < end; i++) {
|
|
|
|
// Break the method name into two pieces.
|
|
- string method_prefix;
|
|
- string function_name;
|
|
- string method_name = methods.arrayGetItem(i).getString();
|
|
+ std::string method_prefix;
|
|
+ std::string function_name;
|
|
+ std::string method_name = methods.arrayGetItem(i).getString();
|
|
size_t last_dot = method_name.rfind('.');
|
|
- if (last_dot == string::npos) {
|
|
+ if (last_dot == std::string::npos) {
|
|
function_name = method_name;
|
|
} else {
|
|
- method_prefix = string(method_name, 0, last_dot);
|
|
- function_name = string(method_name, last_dot + 1);
|
|
+ method_prefix = std::string(method_name, 0, last_dot);
|
|
+ function_name = std::string(method_name, last_dot + 1);
|
|
}
|
|
|
|
// Decide whether we care about this function.
|
|
if (method_prefix == class_prefix) {
|
|
|
|
// Fetch some information about the function.
|
|
- string help = system.methodHelp(method_name);
|
|
+ std::string help = system.methodHelp(method_name);
|
|
XmlRpcValue signature = system.methodSignature(method_name);
|
|
|
|
// Add this function to our class information.
|
|
@@ -66,23 +66,23 @@
|
|
//=========================================================================
|
|
// Print a complete header for the specified class.
|
|
|
|
-void print_header (ostream& out, XmlRpcClass& class_info) {
|
|
- string class_name = class_info.className();
|
|
- out << "// " << class_name << ".h - xmlrpc-c C++ proxy class" << endl;
|
|
- out << "// Auto-generated by xml-rpc-api2cpp." << endl;
|
|
- out << endl;
|
|
-
|
|
- string header_symbol = "_" + class_name + "_H_";
|
|
- out << "#ifndef " << header_symbol << endl;
|
|
- out << "#define " << header_symbol << " 1" << endl;
|
|
- out << endl;
|
|
- out << "#include <XmlRpcCpp.h>" << endl;
|
|
- out << endl;
|
|
+void print_header (std::ostream& out, XmlRpcClass& class_info) {
|
|
+ std::string class_name = class_info.className();
|
|
+ out << "// " << class_name << ".h - xmlrpc-c C++ proxy class" << std::endl;
|
|
+ out << "// Auto-generated by xml-rpc-api2cpp." << std::endl;
|
|
+ out << std::endl;
|
|
+
|
|
+ std::string header_symbol = "_" + class_name + "_H_";
|
|
+ out << "#ifndef " << header_symbol << std::endl;
|
|
+ out << "#define " << header_symbol << " 1" << std::endl;
|
|
+ out << std::endl;
|
|
+ out << "#include <XmlRpcCpp.h>" << std::endl;
|
|
+ out << std::endl;
|
|
|
|
- class_info.printDeclaration(cout);
|
|
+ class_info.printDeclaration(std::cout);
|
|
|
|
- out << endl;
|
|
- out << "#endif /* " << header_symbol << " */" << endl;
|
|
+ out << std::endl;
|
|
+ out << "#endif /* " << header_symbol << " */" << std::endl;
|
|
}
|
|
|
|
|
|
@@ -91,16 +91,16 @@
|
|
//=========================================================================
|
|
// Print a complete header for the specified class.
|
|
|
|
-void print_cc_file (ostream& out, XmlRpcClass& class_info) {
|
|
- string class_name = class_info.className();
|
|
- out << "// " << class_name << ".cc - xmlrpc-c C++ proxy class" << endl;
|
|
- out << "// Auto-generated by xml-rpc-api2cpp." << endl;
|
|
- out << endl;
|
|
+void print_cc_file (std::ostream& out, XmlRpcClass& class_info) {
|
|
+ std::string class_name = class_info.className();
|
|
+ out << "// " << class_name << ".cc - xmlrpc-c C++ proxy class" << std::endl;
|
|
+ out << "// Auto-generated by xml-rpc-api2cpp." << std::endl;
|
|
+ out << std::endl;
|
|
|
|
- out << "#include <XmlRpcCpp.h>" << endl;
|
|
- out << "#include \"" << class_name << ".h\"" << endl;
|
|
+ out << "#include <XmlRpcCpp.h>" << std::endl;
|
|
+ out << "#include \"" << class_name << ".h\"" << std::endl;
|
|
|
|
- class_info.printDefinition(cout);
|
|
+ class_info.printDefinition(std::cout);
|
|
}
|
|
|
|
|
|
@@ -113,18 +113,18 @@
|
|
|
|
/* Parse our command-line arguments. */
|
|
if (argc != 4) {
|
|
- cerr << argv[0] << ": Usage:" << endl
|
|
+ std::cerr << argv[0] << ": Usage:" << std::endl
|
|
<< " xml-rpc-api2cpp <server_url> <method_prefix> <local_class>"
|
|
- << endl << endl
|
|
- << "Sample arguments:" << endl
|
|
- << " server_url = http://localhost/RPC2" << endl
|
|
- << " method_prefix = system" << endl
|
|
- << " local_class = SystemProxy" << endl;
|
|
+ << std::endl << std::endl
|
|
+ << "Sample arguments:" << std::endl
|
|
+ << " server_url = http://localhost/RPC2" << std::endl
|
|
+ << " method_prefix = system" << std::endl
|
|
+ << " local_class = SystemProxy" << std::endl;
|
|
exit(1);
|
|
}
|
|
- string server_url = argv[1];
|
|
- string method_prefix = argv[2];
|
|
- string local_class = argv[3];
|
|
+ std::string server_url = argv[1];
|
|
+ std::string method_prefix = argv[2];
|
|
+ std::string local_class = argv[3];
|
|
|
|
int status = 0;
|
|
XmlRpcClient::Initialize(NAME, VERSION);
|
|
@@ -133,18 +133,18 @@
|
|
XmlRpcClass system = get_class_info(server_url,
|
|
method_prefix,
|
|
local_class);
|
|
- print_header(cout, system);
|
|
- cout << endl;
|
|
- print_cc_file(cout, system);
|
|
+ print_header(std::cout, system);
|
|
+ std::cout << std::endl;
|
|
+ print_cc_file(std::cout, system);
|
|
} catch (XmlRpcFault& fault) {
|
|
- cerr << argv[0] << ": XML-RPC fault #" << fault.getFaultCode()
|
|
- << ": " << fault.getFaultString() << endl;
|
|
+ std::cerr << argv[0] << ": XML-RPC fault #" << fault.getFaultCode()
|
|
+ << ": " << fault.getFaultString() << std::endl;
|
|
status = 1;
|
|
- } catch (logic_error& err) {
|
|
- cerr << argv[0] << ": " << err.what() << endl;
|
|
+ } catch (std::logic_error& err) {
|
|
+ std::cerr << argv[0] << ": " << err.what() << std::endl;
|
|
status = 1;
|
|
} catch (...) {
|
|
- cerr << argv[0] << ": Unknown exception" << endl;
|
|
+ std::cerr << argv[0] << ": Unknown exception" << std::endl;
|
|
status = 1;
|
|
}
|
|
|