MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / initialize

Method initialize

Extras/Serialize/HeaderGenerator/apiGen.cpp:385–442  ·  view source on GitHub ↗

//////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

383
384///////////////////////////////////////////////////////////////////////////////
385void bVariable::initialize(bString type, bString variable, bStringMap refDataTable)
386{
387 dataType = type;
388 variableName = variable;
389
390 if (variableName[0] == '*')
391 {
392 isPtr = true;
393 if (variableName[1] == '*')
394 isPtrToPtr = true;
395 }
396 if (variableName[0] == '(')
397 if (variableName[1] == '*')
398 isFunctionPtr = true;
399
400 if (variableName[variableName.size() - 1] == ']')
401 {
402 isArray = true;
403 if (type == "char")
404 isCharArray = true;
405 }
406
407 if (type == "ListBase")
408 isListBase = true;
409
410 if (variableName[0] == 'p')
411 {
412 bString sub = variableName.substr(0, 3);
413 if (sub == "pad")
414 isPadding = true;
415 }
416 if (dataType[0] == '/' && dataType[1] == '/')
417 isCommentedOut = true;
418
419 if (refDataTable.find(dataType) != refDataTable.end())
420 isGeneratedType = true;
421
422 if (!isBulletFile)
423 {
424 // replace valid float arrays
425 if (dataType == "float" && isArray)
426 {
427 int size = _getArraySize((char *)variableName.c_str());
428 if (size == 3)
429 {
430 dataType = "vec3f";
431 variableName = variableName.substr(0, variableName.find_first_of("["));
432 }
433 if (size == 4)
434 {
435 dataType = "vec4f";
436 variableName = variableName.substr(0, variableName.find_first_of("["));
437 }
438 }
439 }
440 memberDataType = dataType;
441 functionArgs = variableName;
442}

Callers 1

writeTemplateFunction · 0.45

Calls 5

_getArraySizeFunction · 0.85
c_strMethod · 0.80
sizeMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected