XPMP2
X-Plane multiplayer library 2 - using instancing
RelatedDoc8643.h
Go to the documentation of this file.
1
34
35#ifndef _RelatedDoc8643_h_
36#define _RelatedDoc8643_h_
37
38namespace XPMP2 {
39
40//
41// MARK: related.txt and relOp.txt
42//
43
49
51typedef std::map<std::string, int> mapRelatedTy;
52
55const char* RelatedLoad (RelTxtTy relType, const std::string& _path);
56
59const char* RelatedLoad (const std::string _paths[], size_t _num);
60
62int RelatedGet (RelTxtTy relType, const std::string& _key);
63
64//
65// MARK: Doc843.txt
66//
67
78struct Doc8643 {
79public:
80 char classification[4] = {0,0,0,0};
81 char wtc[4] = {0,0,0,0};
82public:
83 Doc8643 () {}
84 Doc8643 (const std::string& _classification,
85 const std::string& _wtc);
86
88 bool empty () const { return wtc[0] == 0; }
89
90 char GetClassType () const { return classification[0]; }
91 char GetClassNumEng () const { return classification[1]; }
92 int GetNumEngines () const { return ('0' <= classification[1] && classification[1] <= '9') ? classification[1] - '0' : 0; }
93 char GetClassEngType () const { return classification[2]; }
94 bool HasRotor () const { return (classification[0] == 'H' ||
95 classification[0] == 'G'); }
96
99 int GetWakeCat() const;
100};
101
103typedef std::map<std::string, Doc8643> mapDoc8643Ty;
104
106const char* Doc8643Load (const std::string& _path);
107
110const Doc8643& Doc8643Get (const std::string& _type);
111
113bool Doc8643IsTypeValid (const std::string& _type);
114
115//
116// MARK: Obj8DataRefs.txt
117//
118
121 std::string s;
122 std::string r;
123
125 Obj8DataRefs (std::string&& _s, std::string&& _r) :
126 s (std::move(_s)), r (std::move(_r)) {}
127};
128
130typedef std::list<Obj8DataRefs> listObj8DataRefsTy;
131
133const char* Obj8DataRefsLoad (const std::string& _path);
134
135}
136
137#endif
Definition XPMPAircraft.h:70
const char * RelatedLoad(RelTxtTy relType, const std::string &_path)
Read the related.txt file, full path passed in.
Definition RelatedDoc8643.cpp:63
const Doc8643 & Doc8643Get(const std::string &_type)
Return a reference to the matching Doc8643 object.
Definition RelatedDoc8643.cpp:247
std::map< std::string, int > mapRelatedTy
Map of group membership: ICAO a/c type maps to line in related.txt.
Definition RelatedDoc8643.h:51
std::map< std::string, Doc8643 > mapDoc8643Ty
Map of Doc8643 information, key is the (icao) type code.
Definition RelatedDoc8643.h:103
std::list< Obj8DataRefs > listObj8DataRefsTy
a list of Obj8DataRefs definitions
Definition RelatedDoc8643.h:130
int RelatedGet(RelTxtTy relType, const std::string &_acType)
Find the related group for a given key, 0 if none.
Definition RelatedDoc8643.cpp:146
const char * Doc8643Load(const std::string &_path)
Load the content of the provided Doc8643.txt file.
Definition RelatedDoc8643.cpp:183
const char * Obj8DataRefsLoad(const std::string &_path)
Load the content of the provided Obj8DataRefs.txt file.
Definition RelatedDoc8643.cpp:264
bool Doc8643IsTypeValid(const std::string &_type)
Is the given aircraft type a valid ICAO type as per Doc8643?
Definition RelatedDoc8643.cpp:254
RelTxtTy
Definition RelatedDoc8643.h:44
@ REL_TXT_NUM
always last: number of "related" files
Definition RelatedDoc8643.h:47
@ REL_TXT_DESIGNATOR
related file for plane type (designator), related.txt
Definition RelatedDoc8643.h:45
@ REL_TXT_OP
related file for operators, relOp.txt
Definition RelatedDoc8643.h:46
Represents a line in the Doc8643.txt file, of which we use only classification and WTC.
Definition RelatedDoc8643.h:78
Doc8643()
Definition RelatedDoc8643.h:83
bool HasRotor() const
Definition RelatedDoc8643.h:94
bool empty() const
Is empty, doesn't contain anything?
Definition RelatedDoc8643.h:88
int GetNumEngines() const
Definition RelatedDoc8643.h:92
char wtc[4]
Definition RelatedDoc8643.h:81
char GetClassNumEng() const
Definition RelatedDoc8643.h:91
int GetWakeCat() const
Returns the wake category as per XP12's wake system.
Definition RelatedDoc8643.cpp:169
char classification[4]
Definition RelatedDoc8643.h:80
char GetClassEngType() const
Definition RelatedDoc8643.h:93
char GetClassType() const
Definition RelatedDoc8643.h:90
A pair of strings, first one to search for, second one to replace it with.
Definition RelatedDoc8643.h:120
Obj8DataRefs(std::string &&_s, std::string &&_r)
Constructor just loads the strings.
Definition RelatedDoc8643.h:125
std::string r
if found replace it with this string
Definition RelatedDoc8643.h:122
std::string s
search the .obj file for this string
Definition RelatedDoc8643.h:121