1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license that can
* be found in the License.html file in the root of the source tree.
*/
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// JsTree functions
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------------------------------
#ifndef JsTreeH
#define JsTreeH
//---------------------------------------------------------------------------
#include <libxml/tree.h>
#include "MediaConchLib.h"
//---------------------------------------------------------------------------
namespace MediaConch {
//***************************************************************************
// Class JsTree
//***************************************************************************
class JsTree
{
public:
//Constructor/Destructor
JsTree() {}
~JsTree() {}
std::string format_from_trace_XML(const std::string& xml);
std::string format_from_inform_XML(const std::string& xml);
std::string format_from_inform_Text(const std::string& text);
static int policies_to_js_tree(std::vector<MediaConchLib::Policy_Policy*> vec, std::string& jstree, std::string& error);
static int policy_to_js_tree(MediaConchLib::Policy_Policy* policy, std::string& json, std::string& error);
static int rule_to_js_tree(MediaConchLib::XSLT_Policy_Rule* rule, std::string& json, std::string&);
std::string get_error() const { return error; }
private:
JsTree (const JsTree&);
JsTree& operator=(const JsTree&);
std::string error;
void find_trace_media_node(xmlNodePtr node, bool& sep, std::string& json);
void find_trace_block_node(xmlNodePtr node, bool& sep, std::string& json);
void find_trace_data_node(xmlNodePtr node, bool& sep, std::string& json);
bool has_block_data(xmlNodePtr child);
void find_inform_media_text(std::istringstream& stream, bool& sep, std::string& json);
void find_inform_block_text(std::istringstream& stream, bool& sep, std::string& json);
void find_inform_track_text(std::istringstream& stream, bool& sep, std::string& json);
void find_inform_data_node(xmlNodePtr node, bool& sep, std::string& json);
void find_inform_media_node(xmlNodePtr node, bool& sep, std::string& json);
void find_inform_track_type(xmlNodePtr node, bool& sep, std::string& json);
void interpret_trace_data_in_block(xmlNodePtr block, std::string& json);
void interpret_trace_data_in_data(xmlNodePtr data, std::string& json);
void trim_string(std::string &str);
std::string decimal_to_hexa(std::string val);
void interpret_offset(std::string& offset, bool coma, std::string& json);
void interpret_value(std::string& value, bool coma, std::string& json);
static std::string unified_json_value(const std::string& value);
};
}
#endif
|