7 #define WIN32_LEAN_AND_MEAN
18 using namespace tinyxml2;
59 Stream (
void) { state =
'-'; type =
STRM_void; filename = NULL; str_file = NULL; str_tixel = NULL; str_string = NULL; }
61 Stream (
Stream_type tp) { state =
'-'; type = tp; filename = NULL; str_file = NULL; str_tixel = NULL; str_string = NULL; }
63 Stream (FILE *stream) { state =
'-'; type =
STRM_file; filename = NULL; str_file = stream; str_tixel = NULL; str_string = NULL; }
64 Stream (
XMLNode *stream) { state =
'-'; type =
STRM_tixel; filename = NULL; str_file = NULL; str_tixel = stream; str_string = NULL; }
65 Stream (
const char *stream) { state =
'-'; type =
STRM_string; filename = NULL; str_file = NULL; str_tixel = NULL; str_string = stream; }
76 if (state !=
'-')
errol;
78 if (rw[1] !=
'\0')
errol;
79 if (*rw !=
'r' && *rw !=
'w')
errol;
82 if (filename)
delete [] filename;
83 filename = fn; fn = NULL;
88 if (state ==
'w') this->str_tixel = node;
89 else if (state ==
'r')
errol;
93 if (*rw !=
'r' || node)
errol;
95 FILE *in =
_openFileN(
"r", filename, filename);
96 char c = getc(in); ungetc(c, in);
98 if (c==
'#') { type =
STRM_file; str_file = in; }
103 else _errorr2 (
"File %s doesnot start neither with character '#' nor '<'", filename);
108 default:
_errorr (
"unsuported stream type");
115 case STRM_file: fclose (str_file);
break;
117 if (state ==
'w') str_tixel->GetDocument()->SaveFile(filename);
118 else if (state ==
'r') ;
121 delete str_tixel->GetDocument();
124 default:
_errorr (
"unsuported stream type");
134 void redefine (FILE *stream) { type =
STRM_file; str_file = stream; str_tixel = NULL; str_string = NULL; }
136 void redefine (
const char *stream) { type =
STRM_string; str_file = NULL; str_tixel = NULL; str_string = stream; }
154 bool relink_downF (
void) { check_type(
STRM_tixel); str_tixel = this->str_tixel->FirstChild();
return (str_tixel) ?
true :
false; }
155 bool relink_downL (
void) { check_type(
STRM_tixel); str_tixel = this->str_tixel->LastChild();
return (str_tixel) ?
true :
false; }
156 bool relink_up (
void) { check_type(
STRM_tixel); str_tixel = this->str_tixel->Parent();
return (str_tixel) ?
true :
false; }
157 bool relink_next (
void) { check_type(
STRM_tixel);
if (str_tixel->NextSibling()) { str_tixel = str_tixel->NextSibling();
return true; }
else return false; }
158 bool relink_prev (
void) { check_type(
STRM_tixel);
if (str_tixel->PreviousSibling()) { str_tixel = str_tixel->PreviousSibling();
return true; }
else return false; }
161 void skip_commnet (
void) { check_type(
STRM_tixel);
while (
true)
if (str_tixel->ToComment() != NULL) str_tixel = str_tixel->NextSibling();
else break; }
166 _errorr (
"wrong type of Stream"); }
201 const char *
XP_giveDAtext (
const XMLNode *xelem,
int n,
bool last,
const char *format,
const char *type,
const char *name,
int *noc=NULL);
206 #endif // MIDAS_TIXY_H
Stream_type give_type(void)
long GP_scan_line(Stream *stream, char *dest)
... line; return value is length of the line
Stream(FILE *stream)
CONSTRUCTOR.
void redefine(XMLNode *stream)
const XMLElement * XP_give_unique_expected_elem(const XMLNode *xelem, const char *name, bool uniq)
#define _openFileN(_1, _2, _3)
FILE * file(void)
*** GET ***
void XP_check_expected_attribute(const XMLNode *xelem, const char *name, const char *value)
Stream(Stream_type tp)
CONSTRUCTOR.
const char * XP_giveDAtext(const XMLNode *xelem, int n, bool last, const char *format, const char *type, const char *name, int *noc)
The element is a container class.
Stream(const char *stream)
const char * string(void)
A Document binds together all the functionality.
void redefine(FILE *stream)
XMLDocument * openTXdcPNSS(const char *path, const char *name, const char *suff, const char *suff2)
long GP_scan_line_alloc(Stream *stream, char *&dest)
... line; return value is length of the line; dest is NULL and allocated here
void skip_commnet(void)
if this XMLnode is XMLComment, skip to next noncomment
XMLNode is a base class for every object that is in the XML Document Object Model (DOM)...
XMLDocument * tix_doc(void)
void redefine(const char *stream)
bool ST_scan_number(Stream *src, int &dest)
*** *** *** *** TINYXML FCE *** *** *** ***
virtual ~Stream()
DESTRUCTOR.
Stream_type
*** *** *** *** CLASS STREAM *** *** *** ***
void open(Stream_type t, const char *rw, const char *&fn, XMLNode *node=NULL)
*** SET ***
bool ST_scan_array(Stream *src, int n, int *dest)
void checkin_type(Stream_type tp)
const char ** pstring(void)
void check_type(Stream_type tp)
XMLDocument * openTXdcPN(const char *path, const char *name)
*** *** *** *** TINYXML FCE *** *** *** ***
long GP_scan_word(Stream *stream, char *dest)
... word; return value is length of the word