Main Page | Class Hierarchy | Compound List | File List | Compound Members

BxString.h

00001 /********************************************************************
00002  * Binx
00003  * $Id: BxString_8h-source.html,v 1.1.1.1 2006/04/19 14:19:02 edikt2 Exp $
00004  *
00005  * Class for the primitive data type string
00006  *
00007  *
00008  * edikt::BinX
00009  * www.edikt.org
00010  * support@edikt.org
00011  *
00012  * Copyright (c) 2005 The University of Edinburgh.
00013  *
00014  ********************************************************************/
00015 
00016 #ifndef BXSTRING_H
00017 #define BXSTRING_H
00018 
00019 #include "BxDataObject.h"
00020 
00021 class BxInteger;
00022 
00046 class BxString : public BxDataObject
00047 {
00048 public:
00049         // The default constructor
00050     BxString();
00051 
00052         // A constructor to initialise a fixed-length string
00053     BxString(const char* str, int size);
00054 
00055         // A constructor to initialise a variable-length string
00056     BxString(const char* str, BxInteger* sizeObj);
00057 
00058         // A constructor to initialise a delimited string (ASCII)
00059     BxString(const char* str);
00060 
00061         // The default copy constructor
00062     BxString(const BxString& copy);
00063 
00064         // The destructor
00065     ~BxString();
00066 
00067     char* className() const { return "BxString"; }
00068     BxString* clone() const;
00069 
00070     char* toString(bool xml);
00071     bool toStream(FILE*);
00072     bool toStreamBinary(FILE*);
00073 
00074         // Write out the binary data with the specified byte order
00075     bool toStreamBinary(FILE*, BxByteOrder);
00076 
00077     bool readFromFile();
00078     void readFromBuffer(const byte*);
00079     void setBinaryFilePtr(BxBinaryFile*);
00080 
00081     void setType(int t) { dataClass_ = t; }
00082     int getType() const { return dataClass_; }
00083 
00084     void setSize(int sz) { sizeInAll_ = sizeInBytes_ = sz; }
00085 
00086     void setSizeObject(BxInteger* sizeObj) { sizeObject_ = sizeObj; }
00087     BxInteger* getSizeObject() const { return sizeObject_; }
00088     void setSizeType(const char* s);
00089 
00090     void setSizeValue(long n);
00091     bx_long64 getSizeValue() const;
00092 
00093     void setText(const char* str);
00094 
00095     void setEncoding(char* encoding);
00096     char const* getEncoding() const { return encoding_; }
00097 
00098     void setDelimiter(char c);
00099     char getDelimiter() const { return delimiter_; }
00100 
00101     void setDelimiter(const char* s);
00102     char* getDelims() const;
00103 
00104 private:
00105         // Private operations
00106 
00107     char* getBuffer() { return buffer_; }
00108 
00109 
00110         // Private data
00111 
00112     char* buffer_;
00113 
00114         // UTF-8, etc
00115     char* encoding_;
00116 
00117         // The delimiter (e.g. "\n")
00118     byte delimiter_;
00119 
00120         // The data element for containing the string length
00121     BxInteger* sizeObject_;
00122 };
00123 
00124 #endif

Generated on Fri May 6 13:36:18 2005 for edikt::BinX by doxygen 1.3.3