Functions

ddcString.h File Reference

#include "ddcConfig.h"
#include "utf8xx.h"
#include <stdio.h>
#include <string>
Include dependency graph for ddcString.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions


Function Documentation

std::string escapeCString ( const std::string &  s  ) 

Encode C escapes into string; encodes byte-wise with escapes

References Format().

Here is the call graph for this function:

std::string unescapeCString ( const std::string &  s  ) 

Decode C escapes in string. Also supports json-style "\uXXXX" utf8-escapes

std::string escapeJsonString ( const std::string &  s,
bool  assume_utf8 = true,
bool  add_quotes = false 
)

Encode JSON escapes into string.

  • If assume_utf8 is true (default), leaves bytes with high-bit set alone; otherwise encodes them as escapes.
  • If add_quotes is true, the returned string will be wrapped in JSON-friendly double quotes ("")

References Format().

Referenced by jsonStr().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string unescapeJsonString ( const std::string &  s  ) 

Decode all JSON escapes from a string.

std::string jsonStr ( const std::string &  s,
bool  assume_utf8 = true,
bool  add_quotes = true 
) [inline]

wrapper for escapeJsonString

References escapeJsonString().

Referenced by CConcHolder::BuildJsonContextString(), CConcHolder::GenerateOneHitStringJson(), and CConcXml::GetFreeHeaderBiblAttributesJson().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string unescapeUtf8String ( const std::string &  s  ) 

Decode escapes from a string to UTF-8