00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _XmlFileStream
00026 #define _XmlFileStream
00027
00028 #include <OPS_Stream.h>
00029
00030 #include <fstream>
00031 using std::ofstream;
00032
00033 class XmlFileStream : public OPS_Stream
00034 {
00035 public:
00036 XmlFileStream(int indentSize=4);
00037 XmlFileStream(const char *fileName, openMode mode = OVERWRITE, int indentSize=4);
00038 ~XmlFileStream();
00039
00040
00041 int setFile(const char *fileName, openMode mode = OVERWRITE);
00042 int open(void);
00043 int close(void);
00044
00045 int setPrecision(int precision);
00046 int setFloatField(floatField);
00047 int precision(int precision) {return 0;};
00048 int width(int width) {return 0;};
00049 const char *getFileName(void) {return fileName;}
00050
00051
00052 int tag(const char *);
00053 int tag(const char *, const char *);
00054 int endTag();
00055 int attr(const char *name, int value);
00056 int attr(const char *name, double value);
00057 int attr(const char *name, const char *value);
00058 int write(Vector &data);
00059
00060
00061 OPS_Stream& write(const char *s, int n);
00062 OPS_Stream& write(const unsigned char *s, int n);
00063 OPS_Stream& write(const signed char *s, int n);
00064 OPS_Stream& write(const void *s, int n);
00065 OPS_Stream& operator<<(char c);
00066 OPS_Stream& operator<<(unsigned char c);
00067 OPS_Stream& operator<<(signed char c);
00068 OPS_Stream& operator<<(const char *s);
00069 OPS_Stream& operator<<(const unsigned char *s);
00070 OPS_Stream& operator<<(const signed char *s);
00071 OPS_Stream& operator<<(const void *p);
00072 OPS_Stream& operator<<(int n);
00073 OPS_Stream& operator<<(unsigned int n);
00074 OPS_Stream& operator<<(long n);
00075 OPS_Stream& operator<<(unsigned long n);
00076 OPS_Stream& operator<<(short n);
00077 OPS_Stream& operator<<(unsigned short n);
00078 OPS_Stream& operator<<(bool b);
00079 OPS_Stream& operator<<(double n);
00080 OPS_Stream& operator<<(float n);
00081
00082 int sendSelf(int commitTag, Channel &theChannel);
00083 int recvSelf(int commitTag, Channel &theChannel,
00084 FEM_ObjectBroker &theBroker);
00085
00086 private:
00087 ofstream theFile;
00088 int fileOpen;
00089 openMode theOpenMode;
00090 char *fileName;
00091
00092 void indent(void);
00093 int indentSize;
00094 int numIndent;
00095 char *indentString;
00096
00097 bool attributeMode;
00098 int numTag;
00099 int sizeTags;
00100 char **tags;
00101 };
00102
00103 #endif