summaryrefslogtreecommitdiff
path: root/net/xmlrpc-c-devel/files/patch-examples::meerkat-app-list.cc
blob: 6e6e770f69a4911346122e82190d1252a60067ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
--- examples/meerkat-app-list.cc.orig	Wed Apr 25 04:18:36 2001
+++ examples/meerkat-app-list.cc	Tue Mar  2 23:39:39 2004
@@ -2,8 +2,8 @@
 // For more details about O'Reilly's excellent Meerkat news service, see:
 // http://www.oreillynet.com/pub/a/rss/2000/11/14/meerkat_xmlrpc.html */
 
-#include <iostream.h>
-#include <strstream.h>
+#include <iostream>
+#include <sstream>
 
 #include <XmlRpcCpp.h>
 
@@ -15,12 +15,9 @@
 static void list_apps (int hours) {
 
     // Build our time_period parameter.
-    ostrstream time_period_stream;
-    time_period_stream << hours << "HOUR" << ends;
-    string time_period = time_period_stream.str();
-
-    // (Ask the ostrstream to reclaim ownership of its buffer.)
-    time_period_stream.freeze(false);
+    std::ostringstream time_period_stream;
+    time_period_stream << hours << "HOUR" << std::ends;
+    std::string time_period = time_period_stream.str();
 
     // Assemble our meerkat query recipe.
     XmlRpcValue recipe = XmlRpcValue::makeStruct();
@@ -45,21 +42,21 @@
 	XmlRpcValue app = apps.arrayGetItem(i);
 
 	// Get some information about our application.
-	string title       = app.structGetValue("title").getString();
-	string link        = app.structGetValue("link").getString();
-	string description = app.structGetValue("description").getString();
+	std::string title       = app.structGetValue("title").getString();
+	std::string link        = app.structGetValue("link").getString();
+	std::string description = app.structGetValue("description").getString();
 	
 	// Print a separator line if necessary.
 	if (first)
 	    first = 0;
 	else
-	    cout << endl;
+	    std::cout << std::endl;
 
 	// Print this application entry.
 	if (description.size() > 0) {
-	    cout << title << endl << description << endl << link << endl;
+	    std::cout << title << std::endl << description << std::endl << link << std::endl;
 	} else {
-	    cout << title << endl << description << endl << link << endl;
+	    std::cout << title << std::endl << description << std::endl << link << std::endl;
 	}
     }
 }
@@ -67,8 +64,8 @@
 // Print out a usage message.
 static void usage (void)
 {
-    cerr << "Usage: meekat-app-list [hours]" << endl;
-    cerr << "Data from <http://www.oreillynet.com/meerkat/>." << endl;
+    std::cerr << "Usage: meekat-app-list [hours]" << std::endl;
+    std::cerr << "Data from <http://www.oreillynet.com/meerkat/>." << std::endl;
     exit(1);
 }
 
@@ -85,7 +82,7 @@
     if (hours == 0)
 	usage();
     if (hours > 49) {
-        cerr << "It's not nice to ask for > 49 hours at once." << endl;
+        std::cerr << "It's not nice to ask for > 49 hours at once." << std::endl;
         exit(1);	
     }
 
@@ -96,8 +93,8 @@
     try {
 	list_apps(hours);
     } 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;
     }