Update README.linux
[deliverable/titan.core.git] / compiler2 / ttcn3 / JsonAST.cc
1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2014 Ericsson Telecom AB
3 // All rights reserved. This program and the accompanying materials
4 // are made available under the terms of the Eclipse Public License v1.0
5 // which accompanies this distribution, and is available at
6 // http://www.eclipse.org/legal/epl-v10.html
7 ///////////////////////////////////////////////////////////////////////////////
8 #include "JsonAST.hh"
9 #include "../../common/memory.h"
10 #include <cstddef>
11 #include <cstdio>
12
13 void JsonAST::init_JsonAST()
14 {
15 omit_as_null = false;
16 alias = NULL;
17 as_value = false;
18 default_value = NULL;
19 }
20
21 JsonAST::JsonAST(const JsonAST *other_val)
22 {
23 init_JsonAST();
24 if (NULL != other_val) {
25 omit_as_null = other_val->omit_as_null;
26 alias = (NULL != other_val->alias) ? mcopystr(other_val->alias) : NULL;
27 as_value = other_val->as_value;
28 default_value = (NULL != other_val->default_value) ? mcopystr(other_val->default_value) : NULL;
29 }
30 }
31
32 JsonAST::~JsonAST()
33 {
34 Free(alias);
35 Free(default_value);
36 }
37
38 void JsonAST::print_JsonAST() const
39 {
40 printf("\n\rOmit encoding: ");
41 if (omit_as_null) {
42 printf("as null value\n\r");
43 } else {
44 printf("skip field\n\r");
45 }
46 if (alias) {
47 printf("Name as %s\n\r", alias);
48 }
49 if (as_value) {
50 printf("Encoding unions as JSON value\n\r");
51 }
52 if (default_value) {
53 printf("Default value: %s\n\r", default_value);
54 }
55 }
This page took 0.033523 seconds and 6 git commands to generate.