CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
TestXml.cpp File Reference
#include <iostream>
#include <string>
#include <assert.h>
#include <stdlib.h>
#include "XmlRpcUtil.h"

Go to the source code of this file.

Macros

#define WIN32_LEAN_AND_MEAN
 

Functions

int main (int argc, char *argv[])
 

Macro Definition Documentation

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 5 of file TestXml.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 19 of file TestXml.cpp.

20{
21 // Basic tests
22 std::string empty;
23 assert(empty == XmlRpcUtil::xmlEncode(empty));
24 assert(empty == XmlRpcUtil::xmlDecode(empty));
25 assert(empty == XmlRpcUtil::xmlEncode(""));
26 assert(empty == XmlRpcUtil::xmlDecode(""));
27
28 std::string raw("<>&'\"");
30
31 std::cout << "Basic tests passed.\n";
32
33 // Interactive tests
34 std::string s;
35 for (;;) {
36 std::cout << "\nEnter line of raw text to encode:\n";
37 std::getline(std::cin, s);
38 if (s.empty()) break;
39
40 std::cout << XmlRpcUtil::xmlEncode(s) << std::endl;
41 }
42
43 for (;;) {
44 std::cout << "\nEnter line of xml-encoded text to decode:\n";
45 std::getline(std::cin, s);
46 if (s.empty()) break;
47
48 std::cout << XmlRpcUtil::xmlDecode(s) << std::endl;
49 }
50
51 return 0;
52}
XmlRpcServer s
Definition: HelloServer.cpp:11
static std::string xmlEncode(const std::string &raw)
Convert raw text to encoded xml.
Definition: XmlRpcUtil.cpp:224
static std::string xmlDecode(const std::string &encoded)
Convert encoded xml to raw text.
Definition: XmlRpcUtil.cpp:187