MCPcopy Create free account
hub / github.com/axmolengine/axmol / readProperties

Method readProperties

core/base/Properties.cpp:161–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161void Properties::readProperties()
162{
163 AXASSERT(_data->getSize() > 0, "Invalid data");
164
165 char line[2048];
166 char variable[256];
167 int c;
168 char* name;
169 char* value;
170 char* parentID;
171 char* rc;
172 char* rcc;
173 char* rccc;
174 bool comment = false;
175
176 while (true)
177 {
178 // Skip whitespace at the start of lines
179 skipWhiteSpace();
180
181 // Stop when we have reached the end of the file.
182 if (eof())
183 break;
184
185 // Read the next line.
186 rc = readLine(line, 2048);
187 if (rc == NULL)
188 {
189 AXLOGE("Error reading line from file.");
190 return;
191 }
192
193 // Ignore comments
194 if (comment)
195 {
196 // Check for end of multi-line comment at either start or end of line
197 if (strncmp(line, "*/", 2) == 0)
198 comment = false;
199 else
200 {
201 trimWhiteSpace(line);
202 const auto len = strlen(line);
203 if (len >= 2 && strncmp(line + (len - 2), "*/", 2) == 0)
204 comment = false;
205 }
206 }
207 else if (strncmp(line, "/*", 2) == 0)
208 {
209 // Start of multi-line comment (must be at start of line)
210 comment = true;
211 }
212 else if (strncmp(line, "//", 2) != 0)
213 {
214 // If an '=' appears on this line, parse it as a name/value pair.
215 // Note: strchr() has to be called before strtok(), or a backup of line has to be kept.
216 rc = strchr(line, '=');
217 if (rc != NULL)
218 {

Callers

nothing calls this directly

Calls 4

isVariableFunction · 0.85
PropertyClass · 0.70
getSizeMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected