MCPcopy Create free account
hub / github.com/SoarGroup/Soar / AddXMLString

Function AddXMLString

Core/ElementXML/src/ElementXMLImpl.cpp:352–382  ·  view source on GitHub ↗

* @brief Adds pAdd to pDest (just like strcat). * BUT returns a pointer to the end of the combined string * unlike strcat. * * Also, this version replaces special characters with * their escape sequence. *************************************************************/

Source from the content-addressed store, hash-verified

350* their escape sequence.
351*************************************************************/
352inline static char* AddXMLString(char* pDest, char const* pAdd)
353{
354 char ch = *pAdd++ ;
355 while (ch != NUL)
356 {
357 switch (ch)
358 {
359 case '<' :
360 pDest = AddString(pDest, kLT) ;
361 break ;
362 case '>' :
363 pDest = AddString(pDest, kGT) ;
364 break ;
365 case '&' :
366 pDest = AddString(pDest, kAMP) ;
367 break ;
368 case '\"' :
369 pDest = AddString(pDest, kQUOT) ;
370 break ;
371 case '\'' :
372 pDest = AddString(pDest, kAPOS) ;
373 break ;
374 default :
375 *pDest++ = ch ;
376 }
377
378 ch = *pAdd++ ;
379 }
380
381 return pDest ;
382}
383
384
385/*************************************************************

Callers 1

GenerateXMLStringMethod · 0.85

Calls 1

AddStringFunction · 0.85

Tested by

no test coverage detected