Merge github.com:eclipse/titan.core
[deliverable/titan.core.git] / common / JSON_Tokenizer.hh
index 6775c69a12cc42934b5239f83ca33c7e3f35abb3..e6d5b95cacb3a967cc57cbed923c9c8ee0159899 100644 (file)
@@ -1,3 +1,16 @@
+/******************************************************************************
+ * Copyright (c) 2000-2016 Ericsson Telecom AB
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Balasko, Jeno
+ *   Baranyi, Botond
+ *
+ ******************************************************************************/
+
 #ifndef JSON_TOKENIZER_HH
 #define        JSON_TOKENIZER_HH
 
@@ -150,11 +163,24 @@ public:
     * @return The number of characters added to the JSON document */
   int put_next_token(json_token_t p_token, const char* p_token_str = 0);
   
+  /** Adds raw data to the end of the buffer.
+    * @param p_data [in] Pointer to the beginning of the data
+    * @param p_len [in] Length of the data in bytes */
+  void put_raw_data(const char* p_data, size_t p_len);
+  
 }; // class JSON_Tokenizer
 
 // A dummy JSON tokenizer, use when there is no actual JSON document
 static JSON_Tokenizer DUMMY_BUFFER;
 
+/** Converts a string into a JSON string by replacing all control characters
+  * with JSON escape sequences, if available, or with the \uHHHH escape sequence.
+  * The string is also wrapped inside a set of double quotes and all double quotes
+  * and backslash characters are double-escaped.
+  *
+  * Returns an expstring, that needs to be freed. */
+extern char* convert_to_json_string(const char* str);
+
 
 #endif /* JSON_TOKENIZER_HH */
 
This page took 0.024882 seconds and 5 git commands to generate.