XML_Util.cpp File Reference

#include "ACEXML/common/XML_Util.h"

Include dependency graph for XML_Util.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define CSTRLEN(x)   ((sizeof(x) / sizeof(ACEXML_Char)) - 1)

Functions

ACEXML_String ACEXML_escape_string (const ACEXML_String &str)
void ACEXML_escape_string (const ACEXML_String &in, ACEXML_String &out)

Variables

const ACEXML_Char ESCAPED_AMP [] = ACE_TEXT("&")
const ACEXML_Char ESCAPED_LESS [] = ACE_TEXT("<")
const ACEXML_Char ESCAPED_GREATER [] = ACE_TEXT(">")
const ACEXML_Char ESCAPED_APOS [] = ACE_TEXT("'")
const ACEXML_Char ESCAPED_QUOTE [] = ACE_TEXT(""")


Define Documentation

#define CSTRLEN  )     ((sizeof(x) / sizeof(ACEXML_Char)) - 1)
 

Definition at line 11 of file XML_Util.cpp.

Referenced by ACEXML_escape_string().


Function Documentation

void ACEXML_escape_string const ACEXML_String in,
ACEXML_String out
 

Definition at line 20 of file XML_Util.cpp.

References ACEXML_String, CSTRLEN, ESCAPED_AMP, ESCAPED_APOS, ESCAPED_GREATER, ESCAPED_LESS, and ESCAPED_QUOTE.

Referenced by ACEXML_escape_string(), and run_tests().

00021 {
00022   size_t len = in.length ();
00023   out.clear();
00024   for (size_t stridx = 0; stridx < len; ++stridx)
00025   {
00026     switch (in[stridx]) {
00027     case '&':
00028       out.append(ESCAPED_AMP, CSTRLEN(ESCAPED_AMP));
00029       break;
00030     case '<':
00031       out.append(ESCAPED_LESS, CSTRLEN(ESCAPED_LESS));
00032       break;
00033     case '>':
00034       out.append(ESCAPED_GREATER, CSTRLEN(ESCAPED_GREATER));
00035       break;
00036     case '\'':
00037       out.append(ESCAPED_APOS, CSTRLEN(ESCAPED_APOS));
00038       break;
00039     case '\"':
00040       out.append(ESCAPED_QUOTE, CSTRLEN(ESCAPED_QUOTE));
00041       break;
00042     default:
00043       out += in[stridx];
00044     }
00045   }
00046 }

ACEXML_String ACEXML_escape_string const ACEXML_String str  ) 
 

Definition at line 13 of file XML_Util.cpp.

00014 {
00015   ACEXML_String ret(str.length ());
00016   ACEXML_escape_string(str, ret);
00017   return ret;
00018 }


Variable Documentation

const ACEXML_Char ESCAPED_AMP[] = ACE_TEXT("&amp;") [static]
 

Definition at line 5 of file XML_Util.cpp.

Referenced by ACEXML_escape_string().

const ACEXML_Char ESCAPED_APOS[] = ACE_TEXT("&apos;") [static]
 

Definition at line 8 of file XML_Util.cpp.

Referenced by ACEXML_escape_string().

const ACEXML_Char ESCAPED_GREATER[] = ACE_TEXT("&gt;") [static]
 

Definition at line 7 of file XML_Util.cpp.

Referenced by ACEXML_escape_string().

const ACEXML_Char ESCAPED_LESS[] = ACE_TEXT("&lt;") [static]
 

Definition at line 6 of file XML_Util.cpp.

Referenced by ACEXML_escape_string().

const ACEXML_Char ESCAPED_QUOTE[] = ACE_TEXT("&quot;") [static]
 

Definition at line 9 of file XML_Util.cpp.

Referenced by ACEXML_escape_string().


Generated on Thu Nov 9 11:47:32 2006 for ACEXML by doxygen 1.3.6