OpenCPN Partial API docs
Loading...
Searching...
No Matches
s57class_registrar.h
Go to the documentation of this file.
1 /**************************************************************************
2 * Copyright (C) 2010 by David S. Register *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 **************************************************************************/
19
25#include <stdio.h>
26
27#ifndef __S57CLASSREGISTRAR_H__
28#define __S57CLASSREGISTRAR_H__
29
30class S57ClassRegistrar; // forward
34 // Class information:
35 int nClasses;
36
37 int iCurrentClass;
38
39 char **papszCurrentFields;
40
41 char **papszTempResult;
42
43 int *pnClassesOBJL;
44 char ***papapszClassesTokenized;
45
46 // Attribute Information:
47 int nAttrMax;
48 int nAttrCount;
49 char **papszAttrNames;
50 char **papszAttrAcronym;
51 char ***papapszAttrValues;
52 char *pachAttrType;
53 char *pachAttrClass;
54 int *panAttrIndex; // sorted by acronym.
55
56 int FindFile(const char *pszTarget, const char *pszDirectory, int bReportErr,
57 FILE **fp);
58
59 const char *ReadLine(FILE *fp);
60 const char *OCPLReadLine(FILE *fp);
61
62 char **papszNextLine;
63 void DestroySparseStringlist(char **papszStrList);
64
65 char *pszRLBuffer = NULL;
66 int nRLBufferSize = 0;
67
68public:
71
72 int LoadInfo(const char *, int);
73
74 // class table methods.
75 int SelectClassByIndex(int);
76 int SelectClass(int);
77 int SelectClass(const char *);
78
79 int Rewind() { return SelectClassByIndex(0); }
80 int NextClass() { return SelectClassByIndex(iCurrentClass + 1); }
81
82 int GetOBJL();
83 const char *GetDescription();
84 const char *GetAcronym();
85
86 char **GetAttributeList(const char * = NULL);
87
88 char GetClassCode();
89 char **GetPrimitives();
90
91 // attribute table methods.
92 int GetMaxAttrIndex() { return nAttrMax; }
93 const char *GetAttrName(int i) { return papszAttrNames[i]; }
94 const char *GetAttrAcronym(int i) { return papszAttrAcronym[i]; }
95 char **GetAttrValues(int i) { return papapszAttrValues[i]; }
96 char GetAttrType(int i) { return pachAttrType[i]; }
97#define SAT_ENUM 'E'
98#define SAT_LIST 'L'
99#define SAT_FLOAT 'F'
100#define SAT_INT 'I'
101#define SAT_CODE_STRING 'A'
102#define SAT_FREE_TEXT 'S'
103
104 char GetAttrClass(int i) { return pachAttrClass[i]; }
105 int FindAttrByAcronym(const char *);
106};
107
108#endif
S57ClassRegistrar * g_poRegistrar
Global instance.