Defines | Functions | Variables

XML_Util.cpp File Reference

#include "ACEXML/common/XML_Util.h"
Include dependency graph for XML_Util.cpp:

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

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

Define Documentation

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

Definition at line 11 of file XML_Util.cpp.


Function Documentation

ACEXML_String ACEXML_escape_string ( const ACEXML_String str  ) 

Definition at line 13 of file XML_Util.cpp.

{
  ACEXML_String ret(str.length ());
  ACEXML_escape_string(str, ret);
  return ret;
}

void ACEXML_escape_string ( const ACEXML_String in,
ACEXML_String out 
)

Definition at line 20 of file XML_Util.cpp.

{
  size_t len = in.length ();
  out.clear();
  for (size_t stridx = 0; stridx < len; ++stridx)
  {
    switch (in[stridx]) {
    case '&':
      out.append(ESCAPED_AMP, CSTRLEN(ESCAPED_AMP));
      break;
    case '<':
      out.append(ESCAPED_LESS, CSTRLEN(ESCAPED_LESS));
      break;
    case '>':
      out.append(ESCAPED_GREATER, CSTRLEN(ESCAPED_GREATER));
      break;
    case '\'':
      out.append(ESCAPED_APOS, CSTRLEN(ESCAPED_APOS));
      break;
    case '\"':
      out.append(ESCAPED_QUOTE, CSTRLEN(ESCAPED_QUOTE));
      break;
    default:
      out += in[stridx];
    }
  }
}


Variable Documentation

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

Definition at line 5 of file XML_Util.cpp.

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

Definition at line 8 of file XML_Util.cpp.

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

Definition at line 7 of file XML_Util.cpp.

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

Definition at line 6 of file XML_Util.cpp.

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

Definition at line 9 of file XML_Util.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines