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