Ice Sheet System Model  4.18
Code documentation
KML_Comment.cpp
Go to the documentation of this file.
1 
5 /*Headers:*/
6 /*{{{*/
7 #ifdef HAVE_CONFIG_H
8  #include <config.h>
9 #else
10 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
11 #endif
12 
13 #include "./KML_Comment.h"
14 #include "../shared/shared.h"
15 /*}}}*/
16 
17 /*Constructors/destructor/copy*/
19 
20  value =NULL;
21 
22 }
23 /*}}}*/
25 
26  if (value ) xDelete<char>(value);
27 
28 }
29 /*}}}*/
30 
31 /*Other*/
32 void KML_Comment::Echo(){/*{{{*/
33 
34  bool flag=true;
35 
36  if(flag) _printf0_(" ");
37  if(flag) _printf0_(value << "\n");
38 
39  return;
40 }
41 /*}}}*/
42 void KML_Comment::DeepEcho(){/*{{{*/
43 
44  char indent[81]="";
45 
46  KML_Comment::DeepEcho(indent);
47 
48  return;
49 }
50 /*}}}*/
51 void KML_Comment::DeepEcho(const char* indent){/*{{{*/
52 
53  bool flag=true;
54 
55  if(flag) _printf0_(indent << " ");
56  if(flag) _printf0_(value << "\n");
57 
58  return;
59 }
60 /*}}}*/
61 void KML_Comment::Write(FILE* filout,const char* indent){/*{{{*/
62 
63  if (strncmp(&value[0] ,"<!--",4))
64  fprintf(filout,"%s<!--\n",indent);
65  fprintf(filout,"%s %s\n",indent,value);
66  if (strncmp(&value[strlen(value)-3],"-->" ,3))
67  fprintf(filout,"%s-->\n",indent);
68 
69  return;
70 }
71 /*}}}*/
72 void KML_Comment::Read(FILE* fid,char* kstr){/*{{{*/
73 
74 // comments always read as part of KMLFileToken
75 
76  ;
77 
78  return;
79 }
80 /*}}}*/
81 void KML_Comment::Alloc(const char* valuei){/*{{{*/
82 
83  value=xNew<char>(strlen(valuei)+1);
84  memcpy(value,valuei,(strlen(valuei)+1)*sizeof(char));
85 
86  return;
87 }
88 /*}}}*/
89 void KML_Comment::Add(DataSet* commnt){/*{{{*/
90 
91  commnt->AddObject((Object*)this);
92 
93  return;
94 }
95 /*}}}*/
96 void KML_Comment::Get(char** pvalueo){/*{{{*/
97 
98  *pvalueo=xNew<char>(strlen(value)+1);
99  memcpy(*pvalueo,value,(strlen(value)+1)*sizeof(char));
100 
101  return;
102 }
103 /*}}}*/
KML_Comment::Get
void Get(char **pvalueo)
Definition: KML_Comment.cpp:96
KML_Comment::Write
void Write(FILE *fid, const char *indent)
Definition: KML_Comment.cpp:61
_printf0_
#define _printf0_(StreamArgs)
Definition: Print.h:29
KML_Comment::DeepEcho
virtual void DeepEcho()
Definition: KML_Comment.cpp:42
DataSet::AddObject
int AddObject(Object *object)
Definition: DataSet.cpp:252
KML_Comment::value
char * value
Definition: KML_Comment.h:19
KML_Comment::KML_Comment
KML_Comment()
Definition: KML_Comment.cpp:18
KML_Comment.h
: header file for kml_comment object
KML_Comment::Alloc
void Alloc(const char *valuei)
Definition: KML_Comment.cpp:81
Object
Definition: Object.h:13
KML_Comment::Echo
virtual void Echo()
Definition: KML_Comment.cpp:32
KML_Comment::Add
void Add(DataSet *commnt)
Definition: KML_Comment.cpp:89
KML_Comment::Read
void Read(FILE *fid, char *kstr)
Definition: KML_Comment.cpp:72
DataSet
Declaration of DataSet class.
Definition: DataSet.h:14
KML_Comment::~KML_Comment
~KML_Comment()
Definition: KML_Comment.cpp:24