(componentdefinition ComponentDefinition, w LanguageWriter, outputFolder string, ClassIdentifier string, ExplicitLinking bool)
| 1550 | |
| 1551 | |
| 1552 | func buildDynamicCppExample(componentdefinition ComponentDefinition, w LanguageWriter, outputFolder string, ClassIdentifier string, ExplicitLinking bool) error { |
| 1553 | NameSpace := componentdefinition.NameSpace |
| 1554 | BaseName := componentdefinition.BaseName |
| 1555 | |
| 1556 | w.Writeln("#include <iostream>") |
| 1557 | if (ExplicitLinking) { |
| 1558 | w.Writeln("#include \"%s_dynamic.hpp\"", strings.ToLower(BaseName)) |
| 1559 | } else { |
| 1560 | w.Writeln("#include \"%s_implicit.hpp\"", strings.ToLower(BaseName)) |
| 1561 | } |
| 1562 | |
| 1563 | w.Writeln("") |
| 1564 | w.Writeln("") |
| 1565 | |
| 1566 | w.Writeln("int main()") |
| 1567 | w.Writeln("{") |
| 1568 | w.Writeln(" try") |
| 1569 | w.Writeln(" {") |
| 1570 | if (ExplicitLinking) { |
| 1571 | w.Writeln(" std::string libpath = (\"\"); // TODO: put the location of the %s-library file here.", NameSpace) |
| 1572 | w.Writeln(" auto wrapper = %s::C%sWrapper::loadLibrary(libpath + \"/%s.\"); // TODO: add correct suffix of the library", NameSpace, ClassIdentifier, BaseName,) |
| 1573 | } else { |
| 1574 | w.Writeln(" auto wrapper = %s::C%sWrapper::loadLibrary();", NameSpace, ClassIdentifier) |
| 1575 | } |
| 1576 | w.Writeln(" %s_uint32 nMajor, nMinor, nMicro;", NameSpace) |
| 1577 | w.Writeln(" wrapper->%s(nMajor, nMinor, nMicro);", componentdefinition.Global.VersionMethod) |
| 1578 | w.Writeln(" std::cout << \"%s.Version = \" << nMajor << \".\" << nMinor << \".\" << nMicro;", NameSpace) |
| 1579 | if len(componentdefinition.Global.PrereleaseMethod)>0 { |
| 1580 | w.Writeln(" std::string sPreReleaseInfo;") |
| 1581 | w.Writeln(" if (wrapper->%s(sPreReleaseInfo)) {", componentdefinition.Global.PrereleaseMethod) |
| 1582 | w.Writeln(" std::cout << \"-\" << sPreReleaseInfo;") |
| 1583 | w.Writeln(" }") |
| 1584 | } |
| 1585 | if len(componentdefinition.Global.BuildinfoMethod)>0 { |
| 1586 | w.Writeln(" std::string sBuildInfo;") |
| 1587 | w.Writeln(" if (wrapper->%s(sBuildInfo)) {", componentdefinition.Global.BuildinfoMethod) |
| 1588 | w.Writeln(" std::cout << \"+\" << sBuildInfo;") |
| 1589 | w.Writeln(" }") |
| 1590 | } |
| 1591 | w.Writeln(" std::cout << std::endl;") |
| 1592 | w.Writeln(" }") |
| 1593 | w.Writeln(" catch (std::exception &e)") |
| 1594 | w.Writeln(" {") |
| 1595 | w.Writeln(" std::cout << e.what() << std::endl;") |
| 1596 | w.Writeln(" return 1;") |
| 1597 | w.Writeln(" }") |
| 1598 | w.Writeln(" return 0;") |
| 1599 | w.Writeln("}") |
| 1600 | w.Writeln("") |
| 1601 | |
| 1602 | return nil |
| 1603 | } |
| 1604 | |
| 1605 | func buildCppDynamicExampleCMake(componentdefinition ComponentDefinition, w LanguageWriter, outputFolder string, outputFolderExample string, ExplicitLinking bool) error { |
| 1606 | NameSpace := componentdefinition.NameSpace |
no test coverage detected