Go to the documentation of this file.00001
00002
00003
00004
00005 #ifndef VIL_NITF2_FIELD_FORMATTER_H
00006 #define VIL_NITF2_FIELD_FORMATTER_H
00007
00008 #include <vcl_string.h>
00009 #include <vcl_istream.h>
00010 #include <vcl_ostream.h>
00011
00012 #include "vil_nitf2.h"
00013 class vil_nitf2_field;
00014 class vil_nitf2_field_definition;
00015 class vil_nitf2_date_time;
00016 class vil_nitf2_location;
00017 class vil_nitf2_scalar_field;
00018 class vil_nitf2_array_field;
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 class vil_nitf2_field_formatter
00038 {
00039 public:
00040
00041
00042 vil_nitf2::enum_field_type field_type;
00043 int field_width;
00044
00045 vil_nitf2_field_formatter(vil_nitf2::enum_field_type field_type, int field_width)
00046 : field_type(field_type), field_width(field_width) {}
00047
00048
00049 virtual ~vil_nitf2_field_formatter() {}
00050
00051
00052 virtual vil_nitf2_field_formatter* copy() const = 0;
00053
00054
00055
00056
00057 virtual vil_nitf2_scalar_field* read_field(
00058 vil_nitf2_istream& input, bool& out_blank) = 0;
00059
00060
00061 virtual vil_nitf2_array_field* create_array_field(
00062 int num_dimensions, vil_nitf2_field_definition*) = 0;
00063
00064 virtual bool write_field(vil_nitf2_ostream& output, const vil_nitf2_scalar_field* field) = 0;
00065
00066
00067
00068 bool write_blank(vcl_ostream& output);
00069
00070
00071 bool write_blank(vil_stream& output);
00072
00073
00074
00075
00076
00077 static char* read_char_array(vcl_istream& input, int length);
00078 static bool read_c_str(vcl_istream& input, int length,
00079 char*& out_cstr, bool& all_blank);
00080
00081 static vcl_string read_string(vcl_istream& input, int length);
00082
00083 static vcl_string read_string(vil_stream& input, int length);
00084
00085
00086
00087 static bool check_sign(const char* cstr, bool show_sign);
00088
00089
00090
00091 static bool is_all_blank(const char* cstr);
00092 };
00093
00094 #endif // VIL_NITF2_FIELD_FORMATTER_H