1// field.h -- 2// $Id: field.h 1230 2007-03-09 15:58:53Z jcw $ 3// This is part of Metakit, see http://www.equi4.com/metakit.html 4 5/** @file 6 * Core class to represent fields 7 */ 8 9#ifndef __FIELD_H__ 10#define __FIELD_H__ 11 12#ifndef __K4CONF_H__ 13#error Please include "k4conf.h" before this header file 14#endif 15 16///////////////////////////////////////////////////////////////////////////// 17 18class c4_Field { 19 c4_PtrArray _subFields; 20 c4_String _name; 21 char _type; 22 c4_Field *_indirect; 23 24 public: 25 /* Construction / destruction */ 26 c4_Field(const char * &, c4_Field * = 0); 27 //: Constructs a new field. 28 ~c4_Field(); 29 30 /* Repeating and compound fields */ 31 int NumSubFields()const; 32 //: Returns the number of subfields. 33 c4_Field &SubField(int)const; 34 //: Returns the description of each subfield. 35 bool IsRepeating()const; 36 //: Returns true if this field contains subtables. 37 38 /* Field name and description */ 39 const c4_String &Name()const; 40 //: Returns name of this field. 41 char Type()const; 42 //: Returns the type description of this field, if any. 43 char OrigType()const; 44 //: Similar, but report types which were originall 'M' as well. 45 c4_String Description(bool anonymous_ = false)const; 46 //: Describes the structure, omit names if anonymous. 47 c4_String DescribeSubFields(bool anonymous_ = false)const; 48 //: Describes just the subfields, omit names if anonymous. 49 50 private: 51 c4_Field(const c4_Field &); // not implemented 52 void operator = (const c4_Field &); // not implemented 53}; 54 55///////////////////////////////////////////////////////////////////////////// 56 57#if q4_INLINE 58#include "field.inl" 59#endif 60 61///////////////////////////////////////////////////////////////////////////// 62 63#endif 64